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

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

Issue 599333002: ChannelMojo: Handle when ChannelMojo outlives ChannelMojoHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Landing Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | ipc/mojo/ipc_channel_mojo.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // 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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 const std::string& channel_id) { 668 const std::string& channel_id) {
669 scoped_refptr<base::SingleThreadTaskRunner> runner = 669 scoped_refptr<base::SingleThreadTaskRunner> runner =
670 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); 670 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
671 if (ShouldUseMojoChannel()) { 671 if (ShouldUseMojoChannel()) {
672 VLOG(1) << "Mojo Channel is enabled on host"; 672 VLOG(1) << "Mojo Channel is enabled on host";
673 if (!channel_mojo_host_) { 673 if (!channel_mojo_host_) {
674 channel_mojo_host_.reset(new IPC::ChannelMojoHost( 674 channel_mojo_host_.reset(new IPC::ChannelMojoHost(
675 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); 675 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
676 } 676 }
677 677
678 return IPC::ChannelProxy::Create(IPC::ChannelMojo::CreateServerFactory( 678 return IPC::ChannelProxy::Create(
679 channel_mojo_host_.get(), channel_id), 679 IPC::ChannelMojo::CreateServerFactory(
680 this, 680 channel_mojo_host_->channel_delegate(), channel_id),
681 runner.get()); 681 this,
682 runner.get());
682 } 683 }
683 684
684 return IPC::ChannelProxy::Create( 685 return IPC::ChannelProxy::Create(
685 channel_id, IPC::Channel::MODE_SERVER, this, runner.get()); 686 channel_id, IPC::Channel::MODE_SERVER, this, runner.get());
686 } 687 }
687 688
688 void RenderProcessHostImpl::CreateMessageFilters() { 689 void RenderProcessHostImpl::CreateMessageFilters() {
689 DCHECK_CURRENTLY_ON(BrowserThread::UI); 690 DCHECK_CURRENTLY_ON(BrowserThread::UI);
690 AddFilter(new ResourceSchedulerFilter(GetID())); 691 AddFilter(new ResourceSchedulerFilter(GetID()));
691 MediaInternals* media_internals = MediaInternals::GetInstance(); 692 MediaInternals* media_internals = MediaInternals::GetInstance();
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 NOTIFICATION_RENDERER_PROCESS_CREATED, 2099 NOTIFICATION_RENDERER_PROCESS_CREATED,
2099 Source<RenderProcessHost>(this), 2100 Source<RenderProcessHost>(this),
2100 NotificationService::NoDetails()); 2101 NotificationService::NoDetails());
2101 2102
2102 // Allow Mojo to be setup before the renderer sees any Chrome IPC messages. 2103 // Allow Mojo to be setup before the renderer sees any Chrome IPC messages.
2103 // This way, Mojo can be safely used from the renderer in response to any 2104 // This way, Mojo can be safely used from the renderer in response to any
2104 // Chrome IPC message. 2105 // Chrome IPC message.
2105 MaybeActivateMojo(); 2106 MaybeActivateMojo();
2106 2107
2107 if (channel_mojo_host_) 2108 if (channel_mojo_host_)
2108 channel_mojo_host_->OnClientLaunched(child_process_launcher_->GetHandle()); 2109 channel_mojo_host_->OnClientLaunched(GetHandle());
2109 2110
2110 while (!queued_messages_.empty()) { 2111 while (!queued_messages_.empty()) {
2111 Send(queued_messages_.front()); 2112 Send(queued_messages_.front());
2112 queued_messages_.pop(); 2113 queued_messages_.pop();
2113 } 2114 }
2114 2115
2115 #if defined(ENABLE_WEBRTC) 2116 #if defined(ENABLE_WEBRTC)
2116 if (WebRTCInternals::GetInstance()->aec_dump_enabled()) 2117 if (WebRTCInternals::GetInstance()->aec_dump_enabled())
2117 EnableAecDump(WebRTCInternals::GetInstance()->aec_dump_file_path()); 2118 EnableAecDump(WebRTCInternals::GetInstance()->aec_dump_file_path());
2118 #endif 2119 #endif
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2245 if (worker_ref_count_ == 0) 2246 if (worker_ref_count_ == 0)
2246 Cleanup(); 2247 Cleanup();
2247 } 2248 }
2248 2249
2249 void RenderProcessHostImpl::EnsureMojoActivated() { 2250 void RenderProcessHostImpl::EnsureMojoActivated() {
2250 mojo_activation_required_ = true; 2251 mojo_activation_required_ = true;
2251 MaybeActivateMojo(); 2252 MaybeActivateMojo();
2252 } 2253 }
2253 2254
2254 } // namespace content 2255 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ipc/mojo/ipc_channel_mojo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698