Chromium Code Reviews| Index: content/gpu/gpu_child_thread.cc |
| diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc |
| index a81892212b99691f016740f34d36d04d53904e5c..271cde79bcc5921cc5e732a8d4775495946a83ac 100644 |
| --- a/content/gpu/gpu_child_thread.cc |
| +++ b/content/gpu/gpu_child_thread.cc |
| @@ -36,6 +36,7 @@ |
| #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h" |
| #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h" |
| #include "media/gpu/ipc/service/media_service.h" |
| +#include "services/shell/public/cpp/interface_registry.h" |
| #include "ui/gl/gl_implementation.h" |
| #include "ui/gl/gl_switches.h" |
| #include "ui/gl/gpu_switching_manager.h" |
| @@ -221,6 +222,20 @@ void GpuChildThread::Init(const base::Time& process_start_time) { |
| // Only set once per process instance. |
| process_control_.reset(new GpuProcessControlImpl()); |
| + // Use of base::Unretained(this) is safe here because |service_registry()| |
|
Ben Goodger (Google)
2016/07/03 03:29:27
This seems worse than before - given that you don'
Ken Rockot(use gerrit already)
2016/07/04 18:22:58
Right, so it's not really worse in practice since
|
| + // will be destroyed before GpuChildThread is destructed. |
| + GetInterfaceRegistry()->AddInterface(base::Bind( |
| + &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); |
| + |
| + if (GetContentClient()->gpu()) { // NULL in tests. |
| + GetContentClient()->gpu()->ExposeInterfacesToBrowser( |
| + GetInterfaceRegistry()); |
| + } |
| + |
| + // We don't want to process any incoming interface requests until |
| + // OnInitialize() is invoked. |
| + GetInterfaceRegistry()->PauseBinding(); |
| + |
| if (GetContentClient()->gpu()) // NULL in tests. |
| GetContentClient()->gpu()->Initialize(this); |
| } |
| @@ -290,37 +305,6 @@ bool GpuChildThread::OnMessageReceived(const IPC::Message& msg) { |
| return false; |
| } |
| -bool GpuChildThread::AcceptConnection(shell::Connection* connection) { |
| - // Use of base::Unretained(this) is safe here because |service_registry()| |
| - // will be destroyed before GpuChildThread is destructed. |
| - connection->GetInterfaceRegistry()->AddInterface(base::Bind( |
| - &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); |
| - |
| - if (GetContentClient()->gpu()) { // NULL in tests. |
| - GetContentClient()->gpu()->ExposeInterfacesToBrowser( |
| - connection->GetInterfaceRegistry()); |
| - } |
| - |
| - // We don't want to process any incoming interface requests until |
| - // OnInitialize(). |
| - if (!gpu_channel_manager_) { |
| - connection->GetInterfaceRegistry()->PauseBinding(); |
| - resume_interface_bindings_callback_ = base::Bind( |
| - &shell::InterfaceRegistry::ResumeBinding, |
| - connection->GetInterfaceRegistry()->GetWeakPtr()); |
| - } |
| - |
| - return true; |
| -} |
| - |
| -shell::InterfaceRegistry* GpuChildThread::GetInterfaceRegistryForConnection() { |
| - return nullptr; |
| -} |
| - |
| -shell::InterfaceProvider* GpuChildThread::GetInterfaceProviderForConnection() { |
| - return nullptr; |
| -} |
| - |
| void GpuChildThread::SetActiveURL(const GURL& url) { |
| GetContentClient()->SetActiveURL(url); |
| } |
| @@ -364,8 +348,7 @@ void GpuChildThread::StoreShaderToDisk(int32_t client_id, |
| } |
| void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { |
| - if (!resume_interface_bindings_callback_.is_null()) |
| - base::ResetAndReturn(&resume_interface_bindings_callback_).Run(); |
| + GetInterfaceRegistry()->ResumeBinding(); |
| gpu_preferences_ = gpu_preferences; |