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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 1685183004: Bootstrap Mojo IPC independent of Chrome IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: and fix posix Created 4 years, 10 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 // attachment broker, rather than an unprivileged attachment broker. 621 // attachment broker, rather than an unprivileged attachment broker.
622 #if defined(OS_MACOSX) && !defined(OS_IOS) 622 #if defined(OS_MACOSX) && !defined(OS_IOS)
623 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded( 623 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(
624 MachBroker::GetInstance()); 624 MachBroker::GetInstance());
625 #else 625 #else
626 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(); 626 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded();
627 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 627 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
628 #endif // USE_ATTACHMENT_BROKER 628 #endif // USE_ATTACHMENT_BROKER
629 629
630 #if defined(MOJO_SHELL_CLIENT) 630 #if defined(MOJO_SHELL_CLIENT)
631 RegisterChildWithExternalShell(id_, this); 631 shell_pipe_token_ = RegisterChildWithExternalShell(id_, this);
632 #endif 632 #endif
633 } 633 }
634 634
635 // static 635 // static
636 void RenderProcessHostImpl::ShutDownInProcessRenderer() { 636 void RenderProcessHostImpl::ShutDownInProcessRenderer() {
637 DCHECK(g_run_renderer_in_process_); 637 DCHECK(g_run_renderer_in_process_);
638 638
639 switch (g_all_hosts.Pointer()->size()) { 639 switch (g_all_hosts.Pointer()->size()) {
640 case 0: 640 case 0:
641 return; 641 return;
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 std::string value = 1616 std::string value =
1617 browser_cmd.GetSwitchValueASCII(switches::kWaitForDebuggerChildren); 1617 browser_cmd.GetSwitchValueASCII(switches::kWaitForDebuggerChildren);
1618 if (value.empty() || value == switches::kRendererProcess) { 1618 if (value.empty() || value == switches::kRendererProcess) {
1619 renderer_cmd->AppendSwitch(switches::kWaitForDebugger); 1619 renderer_cmd->AppendSwitch(switches::kWaitForDebugger);
1620 } 1620 }
1621 } 1621 }
1622 1622
1623 #if defined(MOJO_SHELL_CLIENT) 1623 #if defined(MOJO_SHELL_CLIENT)
1624 if (IsRunningInMojoShell()) 1624 if (IsRunningInMojoShell())
1625 renderer_cmd->AppendSwitch(switches::kEnableMojoShellConnection); 1625 renderer_cmd->AppendSwitch(switches::kEnableMojoShellConnection);
1626 if (!shell_pipe_token_.empty()) {
1627 renderer_cmd->AppendSwitchASCII(switches::kMojoPrimordialPipeToken,
1628 shell_pipe_token_);
jam 2016/02/13 04:15:13 You'll want to do the same thing in BrowserChildPr
Ken Rockot(use gerrit already) 2016/02/13 04:35:09 Yeah, I'm intentionally keeping this on render pro
1629 }
1626 #endif 1630 #endif
1627 } 1631 }
1628 1632
1629 base::ProcessHandle RenderProcessHostImpl::GetHandle() const { 1633 base::ProcessHandle RenderProcessHostImpl::GetHandle() const {
1630 if (run_renderer_in_process()) 1634 if (run_renderer_in_process())
1631 return base::GetCurrentProcessHandle(); 1635 return base::GetCurrentProcessHandle();
1632 1636
1633 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting()) 1637 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting())
1634 return base::kNullProcessHandle; 1638 return base::kNullProcessHandle;
1635 1639
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
2559 // ExtensionService uses this notification to initialize the renderer process 2563 // ExtensionService uses this notification to initialize the renderer process
2560 // with state that must be there before any JavaScript executes. 2564 // with state that must be there before any JavaScript executes.
2561 // 2565 //
2562 // The queued messages contain such things as "navigate". If this notification 2566 // The queued messages contain such things as "navigate". If this notification
2563 // was after, we can end up executing JavaScript before the initialization 2567 // was after, we can end up executing JavaScript before the initialization
2564 // happens. 2568 // happens.
2565 NotificationService::current()->Notify(NOTIFICATION_RENDERER_PROCESS_CREATED, 2569 NotificationService::current()->Notify(NOTIFICATION_RENDERER_PROCESS_CREATED,
2566 Source<RenderProcessHost>(this), 2570 Source<RenderProcessHost>(this),
2567 NotificationService::NoDetails()); 2571 NotificationService::NoDetails());
2568 2572
2569 if (child_process_launcher_.get()) {
2570 base::ProcessHandle process_handle =
2571 child_process_launcher_->GetProcess().Handle();
2572 mojo::edk::ScopedPlatformHandle client_pipe =
2573 mojo::edk::ChildProcessLaunched(process_handle);
2574 Send(new ChildProcessMsg_SetMojoParentPipeHandle(
2575 IPC::GetFileHandleForProcess(client_pipe.release().handle,
2576 process_handle, true)));
2577 }
2578
2579 #if defined(MOJO_SHELL_CLIENT)
2580 // Send the mojo shell handle to the renderer.
2581 SendExternalMojoShellHandleToChild(GetHandle(), this);
2582 #endif
2583
2584 // Allow Mojo to be setup before the renderer sees any Chrome IPC messages. 2573 // Allow Mojo to be setup before the renderer sees any Chrome IPC messages.
2585 // This way, Mojo can be safely used from the renderer in response to any 2574 // This way, Mojo can be safely used from the renderer in response to any
2586 // Chrome IPC message. 2575 // Chrome IPC message.
2587 mojo_application_host_->Activate(this, GetHandle()); 2576 mojo_application_host_->Activate(this, GetHandle());
2588 2577
2589 while (!queued_messages_.empty()) { 2578 while (!queued_messages_.empty()) {
2590 Send(queued_messages_.front()); 2579 Send(queued_messages_.front());
2591 queued_messages_.pop(); 2580 queued_messages_.pop();
2592 } 2581 }
2593 2582
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2790 void RenderProcessHostImpl::GetAudioOutputControllers( 2779 void RenderProcessHostImpl::GetAudioOutputControllers(
2791 const GetAudioOutputControllersCallback& callback) const { 2780 const GetAudioOutputControllersCallback& callback) const {
2792 audio_renderer_host()->GetOutputControllers(callback); 2781 audio_renderer_host()->GetOutputControllers(callback);
2793 } 2782 }
2794 2783
2795 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { 2784 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() {
2796 return bluetooth_dispatcher_host_.get(); 2785 return bluetooth_dispatcher_host_.get();
2797 } 2786 }
2798 2787
2799 } // namespace content 2788 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | content/child/child_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698