Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Unified Diff: content/common/gpu/gpu_channel_test_common.cc

Issue 1711533002: Decouple browser-specific GPU IPC messages from GPU service IPCs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restored if guards on GpuChannelManager Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/gpu/gpu_channel_test_common.h ('k') | content/common/gpu/gpu_channel_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_channel_test_common.cc
diff --git a/content/common/gpu/gpu_channel_test_common.cc b/content/common/gpu/gpu_channel_test_common.cc
index 2e8be03c3709f5ad30b3c32424103361319f9294..ad83c2d5479a6072dd895b46c9a16e87449a0d5a 100644
--- a/content/common/gpu/gpu_channel_test_common.cc
+++ b/content/common/gpu/gpu_channel_test_common.cc
@@ -6,25 +6,72 @@
#include "base/test/test_simple_task_runner.h"
#include "base/thread_task_runner_handle.h"
+#include "content/common/gpu/gpu_channel_manager_delegate.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
#include "ipc/ipc_test_sink.h"
namespace content {
+TestGpuChannelManagerDelegate::TestGpuChannelManagerDelegate() {}
+
+TestGpuChannelManagerDelegate::~TestGpuChannelManagerDelegate() {}
+
+void TestGpuChannelManagerDelegate::AddSubscription(int32_t client_id,
+ unsigned int target) {}
+
+void TestGpuChannelManagerDelegate::ChannelEstablished(
+ const IPC::ChannelHandle& channel_handle) {
+ last_established_channel_handle_ = channel_handle;
+}
+
+void TestGpuChannelManagerDelegate::DidCreateOffscreenContext(
+ const GURL& active_url) {}
+
+void TestGpuChannelManagerDelegate::DidDestroyChannel(int client_id) {}
+
+void TestGpuChannelManagerDelegate::DidDestroyOffscreenContext(
+ const GURL& active_url) {}
+
+void TestGpuChannelManagerDelegate::DidLoseContext(
+ bool offscreen,
+ gpu::error::ContextLostReason reason,
+ const GURL& active_url) {}
+
+void TestGpuChannelManagerDelegate::GpuMemoryUmaStats(
+ const GPUMemoryUmaStats& params) {}
+
+void TestGpuChannelManagerDelegate::RemoveSubscription(int32_t client_id,
+ unsigned int target) {}
+
+void TestGpuChannelManagerDelegate::StoreShaderToDisk(
+ int32_t client_id,
+ const std::string& key,
+ const std::string& shader) {}
+
+#if defined(OS_MACOSX)
+void TestGpuChannelManagerDelegate::SendAcceleratedSurfaceBuffersSwapped(
+ const AcceleratedSurfaceBuffersSwappedParams& params) {}
+#endif
+
+#if defined(OS_WIN)
+void TestGpuChannelManagerDelegate::SendAcceleratedSurfaceCreatedChildWindow(
+ const gfx::PluginWindowHandle& parent_window,
+ const gfx::PluginWindowHandle& child_window) {}
+#endif
+
TestGpuChannelManager::TestGpuChannelManager(
- IPC::TestSink* sink,
+ GpuChannelManagerDelegate* delegate,
base::SingleThreadTaskRunner* task_runner,
base::SingleThreadTaskRunner* io_task_runner,
gpu::SyncPointManager* sync_point_manager,
GpuMemoryBufferFactory* gpu_memory_buffer_factory)
- : GpuChannelManager(nullptr,
+ : GpuChannelManager(delegate,
nullptr,
task_runner,
io_task_runner,
nullptr,
sync_point_manager,
- gpu_memory_buffer_factory),
- sink_(sink) {}
+ gpu_memory_buffer_factory) {}
TestGpuChannelManager::~TestGpuChannelManager() {
// Clear gpu channels here so that any IPC messages sent are handled using the
@@ -32,10 +79,6 @@ TestGpuChannelManager::~TestGpuChannelManager() {
gpu_channels_.clear();
}
-bool TestGpuChannelManager::Send(IPC::Message* msg) {
- return sink_->Send(msg);
-}
-
scoped_ptr<GpuChannel> TestGpuChannelManager::CreateGpuChannel(
int client_id,
uint64_t client_tracing_id,
@@ -43,15 +86,14 @@ scoped_ptr<GpuChannel> TestGpuChannelManager::CreateGpuChannel(
bool allow_view_command_buffers,
bool allow_real_time_streams) {
return make_scoped_ptr(new TestGpuChannel(
- sink_, this, sync_point_manager(), share_group(), mailbox_manager(),
+ this, sync_point_manager(), share_group(), mailbox_manager(),
preempts ? preemption_flag() : nullptr,
preempts ? nullptr : preemption_flag(), task_runner_.get(),
io_task_runner_.get(), client_id, client_tracing_id,
allow_view_command_buffers, allow_real_time_streams));
}
-TestGpuChannel::TestGpuChannel(IPC::TestSink* sink,
- GpuChannelManager* gpu_channel_manager,
+TestGpuChannel::TestGpuChannel(GpuChannelManager* gpu_channel_manager,
gpu::SyncPointManager* sync_point_manager,
gfx::GLShareGroup* share_group,
gpu::gles2::MailboxManager* mailbox_manager,
@@ -75,8 +117,7 @@ TestGpuChannel::TestGpuChannel(IPC::TestSink* sink,
client_id,
client_tracing_id,
allow_view_command_buffers,
- allow_real_time_streams),
- sink_(sink) {}
+ allow_real_time_streams) {}
TestGpuChannel::~TestGpuChannel() {
// Call stubs here so that any IPC messages sent are handled using the
@@ -89,26 +130,27 @@ base::ProcessId TestGpuChannel::GetClientPID() const {
}
IPC::ChannelHandle TestGpuChannel::Init(base::WaitableEvent* shutdown_event) {
- filter_->OnFilterAdded(sink_);
+ filter_->OnFilterAdded(&sink_);
return IPC::ChannelHandle(channel_id());
}
bool TestGpuChannel::Send(IPC::Message* msg) {
DCHECK(!msg->is_sync());
- return sink_->Send(msg);
+ return sink_.Send(msg);
}
// TODO(sunnyps): Use a mock memory buffer factory when necessary.
GpuChannelTestCommon::GpuChannelTestCommon()
- : sink_(new IPC::TestSink),
- task_runner_(new base::TestSimpleTaskRunner),
+ : task_runner_(new base::TestSimpleTaskRunner),
io_task_runner_(new base::TestSimpleTaskRunner),
sync_point_manager_(new gpu::SyncPointManager(false)),
- channel_manager_(new TestGpuChannelManager(sink_.get(),
- task_runner_.get(),
- io_task_runner_.get(),
- sync_point_manager_.get(),
- nullptr)) {}
+ channel_manager_delegate_(new TestGpuChannelManagerDelegate()),
+ channel_manager_(
+ new TestGpuChannelManager(channel_manager_delegate_.get(),
+ task_runner_.get(),
+ io_task_runner_.get(),
+ sync_point_manager_.get(),
+ nullptr)) {}
GpuChannelTestCommon::~GpuChannelTestCommon() {
// Destroying channels causes tasks to run on the IO task runner.
« no previous file with comments | « content/common/gpu/gpu_channel_test_common.h ('k') | content/common/gpu/gpu_channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698