| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #endif | 57 #endif |
| 58 | 58 |
| 59 #if defined(OS_WIN) | 59 #if defined(OS_WIN) |
| 60 void TestGpuChannelManagerDelegate::SendAcceleratedSurfaceCreatedChildWindow( | 60 void TestGpuChannelManagerDelegate::SendAcceleratedSurfaceCreatedChildWindow( |
| 61 gpu::SurfaceHandle parent_window, | 61 gpu::SurfaceHandle parent_window, |
| 62 gpu::SurfaceHandle child_window) {} | 62 gpu::SurfaceHandle child_window) {} |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 TestGpuChannelManager::TestGpuChannelManager( | 65 TestGpuChannelManager::TestGpuChannelManager( |
| 66 const gpu::GpuPreferences& gpu_preferences, | 66 const gpu::GpuPreferences& gpu_preferences, |
| 67 const gpu::GpuDriverBugWorkarounds& gpu_driver_bug_workarounds, |
| 67 GpuChannelManagerDelegate* delegate, | 68 GpuChannelManagerDelegate* delegate, |
| 68 base::SingleThreadTaskRunner* task_runner, | 69 base::SingleThreadTaskRunner* task_runner, |
| 69 base::SingleThreadTaskRunner* io_task_runner, | 70 base::SingleThreadTaskRunner* io_task_runner, |
| 70 gpu::SyncPointManager* sync_point_manager, | 71 gpu::SyncPointManager* sync_point_manager, |
| 71 GpuMemoryBufferFactory* gpu_memory_buffer_factory) | 72 GpuMemoryBufferFactory* gpu_memory_buffer_factory) |
| 72 : GpuChannelManager(gpu_preferences, | 73 : GpuChannelManager(gpu_preferences, |
| 74 gpu_driver_bug_workarounds, |
| 73 delegate, | 75 delegate, |
| 74 nullptr, | 76 nullptr, |
| 75 task_runner, | 77 task_runner, |
| 76 io_task_runner, | 78 io_task_runner, |
| 77 nullptr, | 79 nullptr, |
| 78 sync_point_manager, | 80 sync_point_manager, |
| 79 gpu_memory_buffer_factory) {} | 81 gpu_memory_buffer_factory) {} |
| 80 | 82 |
| 81 TestGpuChannelManager::~TestGpuChannelManager() { | 83 TestGpuChannelManager::~TestGpuChannelManager() { |
| 82 // Clear gpu channels here so that any IPC messages sent are handled using the | 84 // Clear gpu channels here so that any IPC messages sent are handled using the |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 147 } |
| 146 | 148 |
| 147 // TODO(sunnyps): Use a mock memory buffer factory when necessary. | 149 // TODO(sunnyps): Use a mock memory buffer factory when necessary. |
| 148 GpuChannelTestCommon::GpuChannelTestCommon() | 150 GpuChannelTestCommon::GpuChannelTestCommon() |
| 149 : task_runner_(new base::TestSimpleTaskRunner), | 151 : task_runner_(new base::TestSimpleTaskRunner), |
| 150 io_task_runner_(new base::TestSimpleTaskRunner), | 152 io_task_runner_(new base::TestSimpleTaskRunner), |
| 151 sync_point_manager_(new gpu::SyncPointManager(false)), | 153 sync_point_manager_(new gpu::SyncPointManager(false)), |
| 152 channel_manager_delegate_(new TestGpuChannelManagerDelegate()), | 154 channel_manager_delegate_(new TestGpuChannelManagerDelegate()), |
| 153 channel_manager_( | 155 channel_manager_( |
| 154 new TestGpuChannelManager(gpu_preferences_, | 156 new TestGpuChannelManager(gpu_preferences_, |
| 157 gpu_driver_bug_workarounds_, |
| 155 channel_manager_delegate_.get(), | 158 channel_manager_delegate_.get(), |
| 156 task_runner_.get(), | 159 task_runner_.get(), |
| 157 io_task_runner_.get(), | 160 io_task_runner_.get(), |
| 158 sync_point_manager_.get(), | 161 sync_point_manager_.get(), |
| 159 nullptr)) {} | 162 nullptr)) {} |
| 160 | 163 |
| 161 GpuChannelTestCommon::~GpuChannelTestCommon() { | 164 GpuChannelTestCommon::~GpuChannelTestCommon() { |
| 162 // Destroying channels causes tasks to run on the IO task runner. | 165 // Destroying channels causes tasks to run on the IO task runner. |
| 163 channel_manager_ = nullptr; | 166 channel_manager_ = nullptr; |
| 164 // Clear pending tasks to avoid refptr cycles that get flagged by ASAN. | 167 // Clear pending tasks to avoid refptr cycles that get flagged by ASAN. |
| 165 task_runner_->ClearPendingTasks(); | 168 task_runner_->ClearPendingTasks(); |
| 166 io_task_runner_->ClearPendingTasks(); | 169 io_task_runner_->ClearPendingTasks(); |
| 167 } | 170 } |
| 168 | 171 |
| 169 } // namespace content | 172 } // namespace content |
| OLD | NEW |