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

Unified Diff: content/browser/gpu/browser_gpu_channel_host_factory.cc

Issue 11195011: Send vsync timebase updates to the browser compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Work-in-progress Created 8 years, 2 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
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 49717b4980dd9e8863db48455ab179fd584231f3..9a73215dffd7a83d465cd8f3cb8b6e85c0b73add 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

Powered by Google App Engine
This is Rietveld 408576698