Chromium Code Reviews| Index: content/browser/gpu/gpu_process_host.cc |
| diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc |
| index 990d5b5d313fd372e5000ba9b295334e7000b9de..664053cc27de908f5aa1e0823724e830765ee34b 100644 |
| --- a/content/browser/gpu/gpu_process_host.cc |
| +++ b/content/browser/gpu/gpu_process_host.cc |
| @@ -34,8 +34,6 @@ |
| #include "content/browser/gpu/gpu_main_thread_factory.h" |
| #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| #include "content/browser/gpu/shader_cache_factory.h" |
| -#include "content/browser/renderer_host/render_widget_host_impl.h" |
| -#include "content/browser/renderer_host/render_widget_host_view_frame_subscriber.h" |
| #include "content/browser/service_manager/service_manager_context.h" |
| #include "content/common/child_process_host_impl.h" |
| #include "content/common/gpu_host_messages.h" |
| @@ -45,8 +43,6 @@ |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/content_browser_client.h" |
| #include "content/public/browser/gpu_utils.h" |
| -#include "content/public/browser/render_process_host.h" |
| -#include "content/public/browser/render_widget_host_view.h" |
| #include "content/public/common/connection_filter.h" |
| #include "content/public/common/content_client.h" |
| #include "content/public/common/content_switches.h" |
| @@ -199,17 +195,6 @@ void RunCallbackOnIO(GpuProcessHost::GpuProcessKind kind, |
| callback.Run(host); |
| } |
| -#if defined(USE_OZONE) |
| -void SendGpuProcessMessageByHostId(int host_id, IPC::Message* message) { |
| - GpuProcessHost* host = GpuProcessHost::FromID(host_id); |
| - if (host) { |
| - host->Send(message); |
| - } else { |
| - delete message; |
| - } |
| -} |
| -#endif |
| - |
| // NOTE: changes to this class need to be reviewed by the security team. |
| class GpuSandboxedProcessLauncherDelegate |
| : public SandboxedProcessLauncherDelegate { |
| @@ -313,14 +298,6 @@ class GpuSandboxedProcessLauncherDelegate |
| #endif // OS_WIN |
| }; |
| -void HostLoadedShader(int host_id, |
| - const std::string& key, |
| - const std::string& data) { |
| - GpuProcessHost* host = GpuProcessHost::FromID(host_id); |
| - if (host) |
| - host->LoadedShader(key, data); |
| -} |
| - |
| } // anonymous namespace |
| class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter { |
| @@ -642,8 +619,9 @@ bool GpuProcessHost::Init() { |
| ui::OzonePlatform::GetInstance() |
| ->GetGpuPlatformSupportHost() |
| ->OnGpuProcessLaunched( |
| - host_id_, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
| - base::Bind(&SendGpuProcessMessageByHostId, host_id_)); |
| + host_id_, base::ThreadTaskRunnerHandle::Get(), |
| + base::Bind(base::IgnoreResult(&GpuProcessHost::Send), |
|
piman
2017/04/06 20:51:14
So, if the weak_ptr is null, the message will be l
sadrul
2017/04/07 02:16:12
Good catch! Done. (... although maybe IPC::Sender:
piman
2017/04/07 18:16:41
That would be ideal... but I think there's so many
|
| + weak_ptr_factory_.GetWeakPtr())); |
| #endif |
| return true; |
| @@ -1215,7 +1193,8 @@ void GpuProcessHost::CreateChannelCache(int32_t client_id) { |
| if (!cache.get()) |
| return; |
| - cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); |
| + cache->set_shader_loaded_callback(base::Bind(&GpuProcessHost::LoadedShader, |
| + weak_ptr_factory_.GetWeakPtr())); |
| client_id_to_shader_cache_[client_id] = cache; |
| } |