| 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 "gpu/command_buffer/service/sync_point_manager.h" | 9 #include "gpu/command_buffer/service/sync_point_manager.h" |
| 10 #include "ipc/ipc_test_sink.h" | 10 #include "ipc/ipc_test_sink.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 TestGpuChannelManager::TestGpuChannelManager( | 14 TestGpuChannelManager::TestGpuChannelManager( |
| 15 IPC::TestSink* sink, | 15 IPC::TestSink* sink, |
| 16 base::SingleThreadTaskRunner* task_runner, | 16 base::SingleThreadTaskRunner* task_runner, |
| 17 base::SingleThreadTaskRunner* io_task_runner, | 17 base::SingleThreadTaskRunner* io_task_runner, |
| 18 gpu::SyncPointManager* sync_point_manager, | 18 gpu::SyncPointManager* sync_point_manager, |
| 19 GpuMemoryBufferFactory* gpu_memory_buffer_factory) | 19 GpuMemoryBufferFactory* gpu_memory_buffer_factory) |
| 20 : GpuChannelManager(nullptr, | 20 : GpuChannelManager(nullptr, |
| 21 nullptr, | 21 nullptr, |
| 22 task_runner, | 22 task_runner, |
| 23 io_task_runner, | 23 io_task_runner, |
| 24 nullptr, | 24 nullptr, |
| 25 nullptr, | |
| 26 sync_point_manager, | 25 sync_point_manager, |
| 27 gpu_memory_buffer_factory), | 26 gpu_memory_buffer_factory), |
| 28 sink_(sink) {} | 27 sink_(sink) {} |
| 29 | 28 |
| 30 TestGpuChannelManager::~TestGpuChannelManager() { | 29 TestGpuChannelManager::~TestGpuChannelManager() { |
| 31 // Clear gpu channels here so that any IPC messages sent are handled using the | 30 // Clear gpu channels here so that any IPC messages sent are handled using the |
| 32 // overridden Send method. | 31 // overridden Send method. |
| 33 gpu_channels_.clear(); | 32 gpu_channels_.clear(); |
| 34 } | 33 } |
| 35 | 34 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Call stubs here so that any IPC messages sent are handled using the | 73 // Call stubs here so that any IPC messages sent are handled using the |
| 75 // overridden Send method. | 74 // overridden Send method. |
| 76 stubs_.clear(); | 75 stubs_.clear(); |
| 77 } | 76 } |
| 78 | 77 |
| 79 base::ProcessId TestGpuChannel::GetClientPID() const { | 78 base::ProcessId TestGpuChannel::GetClientPID() const { |
| 80 return base::kNullProcessId; | 79 return base::kNullProcessId; |
| 81 } | 80 } |
| 82 | 81 |
| 83 IPC::ChannelHandle TestGpuChannel::Init( | 82 IPC::ChannelHandle TestGpuChannel::Init( |
| 84 base::WaitableEvent* shutdown_event, | 83 base::WaitableEvent* shutdown_event) { |
| 85 IPC::AttachmentBroker* attachment_broker) { | |
| 86 return IPC::ChannelHandle(channel_id()); | 84 return IPC::ChannelHandle(channel_id()); |
| 87 } | 85 } |
| 88 | 86 |
| 89 bool TestGpuChannel::Send(IPC::Message* msg) { | 87 bool TestGpuChannel::Send(IPC::Message* msg) { |
| 90 DCHECK(!msg->is_sync()); | 88 DCHECK(!msg->is_sync()); |
| 91 return sink_->Send(msg); | 89 return sink_->Send(msg); |
| 92 } | 90 } |
| 93 | 91 |
| 94 void TestGpuChannel::AddFilter(IPC::MessageFilter* filter) {} | 92 void TestGpuChannel::AddFilter(IPC::MessageFilter* filter) {} |
| 95 | 93 |
| 96 void TestGpuChannel::RemoveFilter(IPC::MessageFilter* filter) {} | 94 void TestGpuChannel::RemoveFilter(IPC::MessageFilter* filter) {} |
| 97 | 95 |
| 98 // TODO(sunnyps): Use a mock memory buffer factory when necessary. | 96 // TODO(sunnyps): Use a mock memory buffer factory when necessary. |
| 99 GpuChannelTestCommon::GpuChannelTestCommon() | 97 GpuChannelTestCommon::GpuChannelTestCommon() |
| 100 : sink_(new IPC::TestSink), | 98 : sink_(new IPC::TestSink), |
| 101 task_runner_(new base::TestSimpleTaskRunner), | 99 task_runner_(new base::TestSimpleTaskRunner), |
| 102 io_task_runner_(new base::TestSimpleTaskRunner), | 100 io_task_runner_(new base::TestSimpleTaskRunner), |
| 103 sync_point_manager_(new gpu::SyncPointManager(false)), | 101 sync_point_manager_(new gpu::SyncPointManager(false)), |
| 104 channel_manager_(new TestGpuChannelManager(sink_.get(), | 102 channel_manager_(new TestGpuChannelManager(sink_.get(), |
| 105 task_runner_.get(), | 103 task_runner_.get(), |
| 106 io_task_runner_.get(), | 104 io_task_runner_.get(), |
| 107 sync_point_manager_.get(), | 105 sync_point_manager_.get(), |
| 108 nullptr)) {} | 106 nullptr)) {} |
| 109 | 107 |
| 110 GpuChannelTestCommon::~GpuChannelTestCommon() {} | 108 GpuChannelTestCommon::~GpuChannelTestCommon() {} |
| 111 | 109 |
| 112 } // namespace content | 110 } // namespace content |
| OLD | NEW |