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

Side by Side Diff: content/child/child_thread_impl.cc

Issue 1248713002: ozone: ClientPixmapManager passes VGEM fd from browser to renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: follow IOSurface pattern. remove wrapper classes Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/child_thread_impl.h" 5 #include "content/child/child_thread_impl.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "ipc/mojo/ipc_channel_mojo.h" 61 #include "ipc/mojo/ipc_channel_mojo.h"
62 62
63 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) 63 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED)
64 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" 64 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
65 #endif 65 #endif
66 66
67 #if defined(OS_MACOSX) 67 #if defined(OS_MACOSX)
68 #include "content/child/child_io_surface_manager_mac.h" 68 #include "content/child/child_io_surface_manager_mac.h"
69 #endif 69 #endif
70 70
71 #if defined(USE_OZONE)
72 #include "ui/ozone/public/client_native_pixmap_factory.h"
73 #endif
74
71 #if defined(OS_WIN) 75 #if defined(OS_WIN)
72 #include "ipc/attachment_broker_unprivileged_win.h" 76 #include "ipc/attachment_broker_unprivileged_win.h"
73 #endif 77 #endif
74 78
75 using tracked_objects::ThreadData; 79 using tracked_objects::ThreadData;
76 80
77 namespace content { 81 namespace content {
78 namespace { 82 namespace {
79 83
80 // How long to wait for a connection to the browser process before giving up. 84 // How long to wait for a connection to the browser process before giving up.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 189
186 protected: 190 protected:
187 ~IOSurfaceManagerFilter() override {} 191 ~IOSurfaceManagerFilter() override {}
188 192
189 void OnSetIOSurfaceManagerToken(const IOSurfaceManagerToken& token) { 193 void OnSetIOSurfaceManagerToken(const IOSurfaceManagerToken& token) {
190 ChildIOSurfaceManager::GetInstance()->set_token(token); 194 ChildIOSurfaceManager::GetInstance()->set_token(token);
191 } 195 }
192 }; 196 };
193 #endif 197 #endif
194 198
199 #if defined(USE_OZONE)
200 class ClientNativePixmapFactoryFilter : public IPC::MessageFilter {
201 public:
202 // Overridden from IPC::MessageFilter:
203 bool OnMessageReceived(const IPC::Message& message) override {
204 bool handled = true;
205 IPC_BEGIN_MESSAGE_MAP(ClientNativePixmapFactoryFilter, message)
206 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetVgemFD, OnSetVgemFD)
207 IPC_MESSAGE_UNHANDLED(handled = false)
208 IPC_END_MESSAGE_MAP()
209 return handled;
210 }
211
212 protected:
213 ~ClientNativePixmapFactoryFilter() override {}
214
215 void OnSetVgemFD(const base::FileDescriptor& virtual_device) {
reveman 2015/08/14 13:19:13 nit: s/virtual_device/vgem_fd/
dshwang 2015/08/14 16:20:27 Done.
216 DCHECK(ui::ClientNativePixmapFactory::GetInstance());
reveman 2015/08/14 13:19:13 nit: unnecessary as dereferencing null will alread
dshwang 2015/08/14 16:20:27 Done.
217 ui::ClientNativePixmapFactory::GetInstance()->SetVgemFD(virtual_device);
218 }
219 };
220 #endif
221
195 #if defined(OS_ANDROID) 222 #if defined(OS_ANDROID)
196 // A class that allows for triggering a clean shutdown from another 223 // A class that allows for triggering a clean shutdown from another
197 // thread through draining the main thread's msg loop. 224 // thread through draining the main thread's msg loop.
198 class QuitClosure { 225 class QuitClosure {
199 public: 226 public:
200 QuitClosure(); 227 QuitClosure();
201 ~QuitClosure(); 228 ~QuitClosure();
202 229
203 void BindToMainThread(); 230 void BindToMainThread();
204 void PostQuitFromNonMainThread(); 231 void PostQuitFromNonMainThread();
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 // Check that --process-type is specified so we don't do this in unit tests 448 // Check that --process-type is specified so we don't do this in unit tests
422 // and single-process mode. 449 // and single-process mode.
423 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) 450 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType))
424 channel_->AddFilter(new SuicideOnChannelErrorFilter()); 451 channel_->AddFilter(new SuicideOnChannelErrorFilter());
425 #endif 452 #endif
426 453
427 #if defined(OS_MACOSX) 454 #if defined(OS_MACOSX)
428 channel_->AddFilter(new IOSurfaceManagerFilter()); 455 channel_->AddFilter(new IOSurfaceManagerFilter());
429 #endif 456 #endif
430 457
458 #if defined(USE_OZONE)
459 channel_->AddFilter(new ClientNativePixmapFactoryFilter());
460 #endif
461
431 // Add filters passed here via options. 462 // Add filters passed here via options.
432 for (auto startup_filter : options.startup_filters) { 463 for (auto startup_filter : options.startup_filters) {
433 channel_->AddFilter(startup_filter); 464 channel_->AddFilter(startup_filter);
434 } 465 }
435 466
436 ConnectChannel(options.use_mojo_channel); 467 ConnectChannel(options.use_mojo_channel);
437 if (attachment_broker_) 468 if (attachment_broker_)
438 attachment_broker_->DesignateBrokerCommunicationChannel(channel_.get()); 469 attachment_broker_->DesignateBrokerCommunicationChannel(channel_.get());
439 470
440 int connection_timeout = kConnectionTimeoutS; 471 int connection_timeout = kConnectionTimeoutS;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 738
708 void ChildThreadImpl::OnProcessBackgrounded(bool background) { 739 void ChildThreadImpl::OnProcessBackgrounded(bool background) {
709 // Set timer slack to maximum on main thread when in background. 740 // Set timer slack to maximum on main thread when in background.
710 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; 741 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE;
711 if (background) 742 if (background)
712 timer_slack = base::TIMER_SLACK_MAXIMUM; 743 timer_slack = base::TIMER_SLACK_MAXIMUM;
713 base::MessageLoop::current()->SetTimerSlack(timer_slack); 744 base::MessageLoop::current()->SetTimerSlack(timer_slack);
714 } 745 }
715 746
716 } // namespace content 747 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698