summaryrefslogtreecommitdiffstats
path: root/content/child/child_thread_impl.cc
diff options
context:
space:
mode:
authorreveman <reveman@chromium.org>2015-06-26 14:47:49 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-26 21:48:17 +0000
commitf6dffe4bd02803dd7cae455ff1a4c1ddb848e09f (patch)
treef7f49250b3d18512bf29ff7eaf9447a88322c611 /content/child/child_thread_impl.cc
parent80201d111bd6f4221b70dd2cf101153e71945fca (diff)
downloadchromium_src-f6dffe4bd02803dd7cae455ff1a4c1ddb848e09f.zip
chromium_src-f6dffe4bd02803dd7cae455ff1a4c1ddb848e09f.tar.gz
chromium_src-f6dffe4bd02803dd7cae455ff1a4c1ddb848e09f.tar.bz2
content: Set IOSurface manager token in the Gpu process before handling GpuMemoryBuffer allocation requests.
This makes sure we send and process a valid IOSurface manager token on the Gpu process side before we handle any GpuMemoryBuffer allocation requests. BUG=486922 TEST=content/test/gpu/run_gpu_test.py context_lost --extra-browser-args=--enable-native-gpu-memory-buffers --story-filter=GpuCrash.GPUProcessCrashesExactlyOnce Review URL: https://codereview.chromium.org/1207043003 Cr-Commit-Position: refs/heads/master@{#336461}
Diffstat (limited to 'content/child/child_thread_impl.cc')
-rw-r--r--content/child/child_thread_impl.cc38
1 files changed, 27 insertions, 11 deletions
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
index 04e020c..45d8cdb 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -175,6 +175,29 @@ class SuicideOnChannelErrorFilter : public IPC::MessageFilter {
#endif // OS(POSIX)
+#if defined(OS_MACOSX)
+class IOSurfaceManagerFilter : public IPC::MessageFilter {
+ public:
+ // Overridden from IPC::MessageFilter:
+ bool OnMessageReceived(const IPC::Message& message) override {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(IOSurfaceManagerFilter, message)
+ IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIOSurfaceManagerToken,
+ OnSetIOSurfaceManagerToken)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+ }
+
+ protected:
+ ~IOSurfaceManagerFilter() override {}
+
+ void OnSetIOSurfaceManagerToken(const IOSurfaceManagerToken& token) {
+ ChildIOSurfaceManager::GetInstance()->set_token(token);
+ }
+};
+#endif
+
#if defined(OS_ANDROID)
// A class that allows for triggering a clean shutdown from another
// thread through draining the main thread's msg loop.
@@ -415,6 +438,10 @@ void ChildThreadImpl::Init(const Options& options) {
channel_->AddFilter(new SuicideOnChannelErrorFilter());
#endif
+#if defined(OS_MACOSX)
+ channel_->AddFilter(new IOSurfaceManagerFilter());
+#endif
+
// Add filters passed here via options.
for (auto startup_filter : options.startup_filters) {
channel_->AddFilter(startup_filter);
@@ -596,10 +623,6 @@ bool ChildThreadImpl::OnMessageReceived(const IPC::Message& msg) {
#if defined(USE_TCMALLOC)
IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats)
#endif
-#if defined(OS_MACOSX)
- IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIOSurfaceManagerToken,
- OnSetIOSurfaceManagerToken)
-#endif
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -656,13 +679,6 @@ void ChildThreadImpl::OnGetTcmallocStats() {
}
#endif
-#if defined(OS_MACOSX)
-void ChildThreadImpl::OnSetIOSurfaceManagerToken(
- const IOSurfaceManagerToken& token) {
- ChildIOSurfaceManager::GetInstance()->set_token(token);
-}
-#endif
-
ChildThreadImpl* ChildThreadImpl::current() {
return g_lazy_tls.Pointer()->Get();
}