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

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

Issue 1137453002: content: Pass IOSurface references using Mach IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, remove extra DCHECKs and fix reply port typo Created 5 years, 7 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "ipc/ipc_logging.h" 56 #include "ipc/ipc_logging.h"
57 #include "ipc/ipc_switches.h" 57 #include "ipc/ipc_switches.h"
58 #include "ipc/ipc_sync_channel.h" 58 #include "ipc/ipc_sync_channel.h"
59 #include "ipc/ipc_sync_message_filter.h" 59 #include "ipc/ipc_sync_message_filter.h"
60 #include "ipc/mojo/ipc_channel_mojo.h" 60 #include "ipc/mojo/ipc_channel_mojo.h"
61 61
62 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) 62 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED)
63 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" 63 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
64 #endif 64 #endif
65 65
66 #if defined(OS_MACOSX) && !defined(OS_IOS)
67 #include "content/child/child_io_surface_manager_mac.h"
68 #endif
69
66 using tracked_objects::ThreadData; 70 using tracked_objects::ThreadData;
67 71
68 namespace content { 72 namespace content {
69 namespace { 73 namespace {
70 74
71 // How long to wait for a connection to the browser process before giving up. 75 // How long to wait for a connection to the browser process before giving up.
72 const int kConnectionTimeoutS = 15; 76 const int kConnectionTimeoutS = 15;
73 77
74 base::LazyInstance<base::ThreadLocalPointer<ChildThreadImpl> > g_lazy_tls = 78 base::LazyInstance<base::ThreadLocalPointer<ChildThreadImpl> > g_lazy_tls =
75 LAZY_INSTANCE_INITIALIZER; 79 LAZY_INSTANCE_INITIALIZER;
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 OnSetProfilerStatus) 567 OnSetProfilerStatus)
564 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData, 568 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData,
565 OnGetChildProfilerData) 569 OnGetChildProfilerData)
566 IPC_MESSAGE_HANDLER(ChildProcessMsg_ProfilingPhaseCompleted, 570 IPC_MESSAGE_HANDLER(ChildProcessMsg_ProfilingPhaseCompleted,
567 OnProfilingPhaseCompleted) 571 OnProfilingPhaseCompleted)
568 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded, 572 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded,
569 OnProcessBackgrounded) 573 OnProcessBackgrounded)
570 #if defined(USE_TCMALLOC) 574 #if defined(USE_TCMALLOC)
571 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats) 575 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats)
572 #endif 576 #endif
577 #if defined(OS_MACOSX) && !defined(OS_IOS)
578 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIOSurfaceManagerMailbox,
579 OnSetIOSurfaceManagerMailbox)
580 #endif
573 IPC_MESSAGE_UNHANDLED(handled = false) 581 IPC_MESSAGE_UNHANDLED(handled = false)
574 IPC_END_MESSAGE_MAP() 582 IPC_END_MESSAGE_MAP()
575 583
576 if (handled) 584 if (handled)
577 return true; 585 return true;
578 586
579 if (msg.routing_id() == MSG_ROUTING_CONTROL) 587 if (msg.routing_id() == MSG_ROUTING_CONTROL)
580 return OnControlMessageReceived(msg); 588 return OnControlMessageReceived(msg);
581 589
582 return router_.OnMessageReceived(msg); 590 return router_.OnMessageReceived(msg);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 #if defined(USE_TCMALLOC) 627 #if defined(USE_TCMALLOC)
620 void ChildThreadImpl::OnGetTcmallocStats() { 628 void ChildThreadImpl::OnGetTcmallocStats() {
621 std::string result; 629 std::string result;
622 char buffer[1024 * 32]; 630 char buffer[1024 * 32];
623 base::allocator::GetStats(buffer, sizeof(buffer)); 631 base::allocator::GetStats(buffer, sizeof(buffer));
624 result.append(buffer); 632 result.append(buffer);
625 Send(new ChildProcessHostMsg_TcmallocStats(result)); 633 Send(new ChildProcessHostMsg_TcmallocStats(result));
626 } 634 }
627 #endif 635 #endif
628 636
637 #if defined(OS_MACOSX) && !defined(OS_IOS)
638 void ChildThreadImpl::OnSetIOSurfaceManagerMailbox(
639 const gpu::Mailbox& mailbox) {
640 ChildIOSurfaceManager::GetInstance()->set_mailbox(mailbox);
641 }
642 #endif
643
629 ChildThreadImpl* ChildThreadImpl::current() { 644 ChildThreadImpl* ChildThreadImpl::current() {
630 return g_lazy_tls.Pointer()->Get(); 645 return g_lazy_tls.Pointer()->Get();
631 } 646 }
632 647
633 #if defined(OS_ANDROID) 648 #if defined(OS_ANDROID)
634 // The method must NOT be called on the child thread itself. 649 // The method must NOT be called on the child thread itself.
635 // It may block the child thread if so. 650 // It may block the child thread if so.
636 void ChildThreadImpl::ShutdownThread() { 651 void ChildThreadImpl::ShutdownThread() {
637 DCHECK(!ChildThreadImpl::current()) << 652 DCHECK(!ChildThreadImpl::current()) <<
638 "this method should NOT be called from child thread itself"; 653 "this method should NOT be called from child thread itself";
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 694
680 void ChildThreadImpl::OnProcessBackgrounded(bool background) { 695 void ChildThreadImpl::OnProcessBackgrounded(bool background) {
681 // Set timer slack to maximum on main thread when in background. 696 // Set timer slack to maximum on main thread when in background.
682 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; 697 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE;
683 if (background) 698 if (background)
684 timer_slack = base::TIMER_SLACK_MAXIMUM; 699 timer_slack = base::TIMER_SLACK_MAXIMUM;
685 base::MessageLoop::current()->SetTimerSlack(timer_slack); 700 base::MessageLoop::current()->SetTimerSlack(timer_slack);
686 } 701 }
687 702
688 } // namespace content 703 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698