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 "content/common/gpu/gpu_channel_test_common.h" | 5 #include "content/common/gpu/gpu_channel_test_common.h" |
6 | 6 |
7 #include "base/test/test_simple_task_runner.h" | 7 #include "base/test/test_simple_task_runner.h" |
8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
9 #include "content/common/gpu/gpu_channel_manager_delegate.h" | 9 #include "content/common/gpu/gpu_channel_manager_delegate.h" |
10 #include "gpu/command_buffer/service/sync_point_manager.h" | 10 #include "gpu/command_buffer/service/sync_point_manager.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 const AcceleratedSurfaceBuffersSwappedParams& params) {} | 53 const AcceleratedSurfaceBuffersSwappedParams& params) {} |
54 #endif | 54 #endif |
55 | 55 |
56 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
57 void TestGpuChannelManagerDelegate::SendAcceleratedSurfaceCreatedChildWindow( | 57 void TestGpuChannelManagerDelegate::SendAcceleratedSurfaceCreatedChildWindow( |
58 const gfx::PluginWindowHandle& parent_window, | 58 const gfx::PluginWindowHandle& parent_window, |
59 const gfx::PluginWindowHandle& child_window) {} | 59 const gfx::PluginWindowHandle& child_window) {} |
60 #endif | 60 #endif |
61 | 61 |
62 TestGpuChannelManager::TestGpuChannelManager( | 62 TestGpuChannelManager::TestGpuChannelManager( |
| 63 const gpu::GpuPreferences& gpu_preferences, |
63 GpuChannelManagerDelegate* delegate, | 64 GpuChannelManagerDelegate* delegate, |
64 base::SingleThreadTaskRunner* task_runner, | 65 base::SingleThreadTaskRunner* task_runner, |
65 base::SingleThreadTaskRunner* io_task_runner, | 66 base::SingleThreadTaskRunner* io_task_runner, |
66 gpu::SyncPointManager* sync_point_manager, | 67 gpu::SyncPointManager* sync_point_manager, |
67 GpuMemoryBufferFactory* gpu_memory_buffer_factory) | 68 GpuMemoryBufferFactory* gpu_memory_buffer_factory) |
68 : GpuChannelManager(delegate, | 69 : GpuChannelManager(gpu_preferences, |
| 70 delegate, |
69 nullptr, | 71 nullptr, |
70 task_runner, | 72 task_runner, |
71 io_task_runner, | 73 io_task_runner, |
72 nullptr, | 74 nullptr, |
73 sync_point_manager, | 75 sync_point_manager, |
74 gpu_memory_buffer_factory) {} | 76 gpu_memory_buffer_factory) {} |
75 | 77 |
76 TestGpuChannelManager::~TestGpuChannelManager() { | 78 TestGpuChannelManager::~TestGpuChannelManager() { |
77 // Clear gpu channels here so that any IPC messages sent are handled using the | 79 // Clear gpu channels here so that any IPC messages sent are handled using the |
78 // overridden Send method. | 80 // overridden Send method. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 return sink_.Send(msg); | 141 return sink_.Send(msg); |
140 } | 142 } |
141 | 143 |
142 // TODO(sunnyps): Use a mock memory buffer factory when necessary. | 144 // TODO(sunnyps): Use a mock memory buffer factory when necessary. |
143 GpuChannelTestCommon::GpuChannelTestCommon() | 145 GpuChannelTestCommon::GpuChannelTestCommon() |
144 : task_runner_(new base::TestSimpleTaskRunner), | 146 : task_runner_(new base::TestSimpleTaskRunner), |
145 io_task_runner_(new base::TestSimpleTaskRunner), | 147 io_task_runner_(new base::TestSimpleTaskRunner), |
146 sync_point_manager_(new gpu::SyncPointManager(false)), | 148 sync_point_manager_(new gpu::SyncPointManager(false)), |
147 channel_manager_delegate_(new TestGpuChannelManagerDelegate()), | 149 channel_manager_delegate_(new TestGpuChannelManagerDelegate()), |
148 channel_manager_( | 150 channel_manager_( |
149 new TestGpuChannelManager(channel_manager_delegate_.get(), | 151 new TestGpuChannelManager(gpu_preferences_, |
| 152 channel_manager_delegate_.get(), |
150 task_runner_.get(), | 153 task_runner_.get(), |
151 io_task_runner_.get(), | 154 io_task_runner_.get(), |
152 sync_point_manager_.get(), | 155 sync_point_manager_.get(), |
153 nullptr)) {} | 156 nullptr)) {} |
154 | 157 |
155 GpuChannelTestCommon::~GpuChannelTestCommon() { | 158 GpuChannelTestCommon::~GpuChannelTestCommon() { |
156 // Destroying channels causes tasks to run on the IO task runner. | 159 // Destroying channels causes tasks to run on the IO task runner. |
157 channel_manager_ = nullptr; | 160 channel_manager_ = nullptr; |
158 // Clear pending tasks to avoid refptr cycles that get flagged by ASAN. | 161 // Clear pending tasks to avoid refptr cycles that get flagged by ASAN. |
159 task_runner_->ClearPendingTasks(); | 162 task_runner_->ClearPendingTasks(); |
160 io_task_runner_->ClearPendingTasks(); | 163 io_task_runner_->ClearPendingTasks(); |
161 } | 164 } |
162 | 165 |
163 } // namespace content | 166 } // namespace content |
OLD | NEW |