| Index: content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| index ee6ac87270cf4f10c8f11f05e33557f8622870bd..b0b5513f8cd6660f5502046824590417ffb85f5b 100644
|
| --- a/content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| +++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| @@ -13,6 +13,7 @@
|
| #include "content/common/child_process_host_impl.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/common/content_client.h"
|
| +#include "ipc/ipc_forwarding_message_filter.h"
|
|
|
| namespace content {
|
|
|
| @@ -290,4 +291,32 @@ GpuChannelHost* BrowserGpuChannelHostFactory::EstablishGpuChannelSync(
|
| return gpu_channel_.get();
|
| }
|
|
|
| +// static
|
| +void BrowserGpuChannelHostFactory::AddFilterOnIO(
|
| + int host_id,
|
| + scoped_refptr<IPC::ChannelProxy::MessageFilter> filter) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| + GpuProcessHost* host = GpuProcessHost::FromID(host_id);
|
| + if (host)
|
| + host->AddFilter(filter);
|
| +}
|
| +
|
| +void BrowserGpuChannelHostFactory::SetHandlerForControlMessages(
|
| + const uint32* message_ids,
|
| + size_t num_messages,
|
| + const base::Callback<void(const IPC::Message&)>& handler,
|
| + base::TaskRunner* target_task_runner) {
|
| + scoped_refptr<IPC::ForwardingMessageFilter> filter =
|
| + new IPC::ForwardingMessageFilter(message_ids,
|
| + num_messages,
|
| + target_task_runner);
|
| + filter->AddRoute(MSG_ROUTING_CONTROL, handler);
|
| +
|
| + GetIOLoopProxy()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&BrowserGpuChannelHostFactory::AddFilterOnIO,
|
| + gpu_host_id_,
|
| + filter));
|
| +}
|
| +
|
| } // namespace content
|
|
|