OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/ipc/service/gpu_channel_test_common.h" | 5 #include "gpu/ipc/service/gpu_channel_test_common.h" |
6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
7 #include "base/test/test_simple_task_runner.h" | 8 #include "base/test/test_simple_task_runner.h" |
8 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
9 #include "gpu/command_buffer/service/sync_point_manager.h" | 10 #include "gpu/command_buffer/service/sync_point_manager.h" |
10 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" | 11 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" |
11 #include "ipc/ipc_test_sink.h" | 12 #include "ipc/ipc_test_sink.h" |
12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
13 | 14 |
14 namespace gpu { | 15 namespace gpu { |
15 | 16 |
16 TestGpuChannelManagerDelegate::TestGpuChannelManagerDelegate() {} | 17 TestGpuChannelManagerDelegate::TestGpuChannelManagerDelegate() {} |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 nullptr, | 78 nullptr, |
78 sync_point_manager, | 79 sync_point_manager, |
79 gpu_memory_buffer_factory) {} | 80 gpu_memory_buffer_factory) {} |
80 | 81 |
81 TestGpuChannelManager::~TestGpuChannelManager() { | 82 TestGpuChannelManager::~TestGpuChannelManager() { |
82 // Clear gpu channels here so that any IPC messages sent are handled using the | 83 // Clear gpu channels here so that any IPC messages sent are handled using the |
83 // overridden Send method. | 84 // overridden Send method. |
84 gpu_channels_.clear(); | 85 gpu_channels_.clear(); |
85 } | 86 } |
86 | 87 |
87 scoped_ptr<GpuChannel> TestGpuChannelManager::CreateGpuChannel( | 88 std::unique_ptr<GpuChannel> TestGpuChannelManager::CreateGpuChannel( |
88 int client_id, | 89 int client_id, |
89 uint64_t client_tracing_id, | 90 uint64_t client_tracing_id, |
90 bool preempts, | 91 bool preempts, |
91 bool allow_view_command_buffers, | 92 bool allow_view_command_buffers, |
92 bool allow_real_time_streams) { | 93 bool allow_real_time_streams) { |
93 return make_scoped_ptr(new TestGpuChannel( | 94 return base::WrapUnique(new TestGpuChannel( |
94 this, sync_point_manager(), share_group(), mailbox_manager(), | 95 this, sync_point_manager(), share_group(), mailbox_manager(), |
95 preempts ? preemption_flag() : nullptr, | 96 preempts ? preemption_flag() : nullptr, |
96 preempts ? nullptr : preemption_flag(), task_runner_.get(), | 97 preempts ? nullptr : preemption_flag(), task_runner_.get(), |
97 io_task_runner_.get(), client_id, client_tracing_id, | 98 io_task_runner_.get(), client_id, client_tracing_id, |
98 allow_view_command_buffers, allow_real_time_streams)); | 99 allow_view_command_buffers, allow_real_time_streams)); |
99 } | 100 } |
100 | 101 |
101 TestGpuChannel::TestGpuChannel(GpuChannelManager* gpu_channel_manager, | 102 TestGpuChannel::TestGpuChannel(GpuChannelManager* gpu_channel_manager, |
102 SyncPointManager* sync_point_manager, | 103 SyncPointManager* sync_point_manager, |
103 gfx::GLShareGroup* share_group, | 104 gfx::GLShareGroup* share_group, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 161 |
161 GpuChannelTestCommon::~GpuChannelTestCommon() { | 162 GpuChannelTestCommon::~GpuChannelTestCommon() { |
162 // Destroying channels causes tasks to run on the IO task runner. | 163 // Destroying channels causes tasks to run on the IO task runner. |
163 channel_manager_ = nullptr; | 164 channel_manager_ = nullptr; |
164 // Clear pending tasks to avoid refptr cycles that get flagged by ASAN. | 165 // Clear pending tasks to avoid refptr cycles that get flagged by ASAN. |
165 task_runner_->ClearPendingTasks(); | 166 task_runner_->ClearPendingTasks(); |
166 io_task_runner_->ClearPendingTasks(); | 167 io_task_runner_->ClearPendingTasks(); |
167 } | 168 } |
168 | 169 |
169 } // namespace gpu | 170 } // namespace gpu |
OLD | NEW |