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

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

Issue 382333002: Introduce ChannelMojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 #include "content/public/common/content_switches.h" 130 #include "content/public/common/content_switches.h"
131 #include "content/public/common/process_type.h" 131 #include "content/public/common/process_type.h"
132 #include "content/public/common/resource_type.h" 132 #include "content/public/common/resource_type.h"
133 #include "content/public/common/result_codes.h" 133 #include "content/public/common/result_codes.h"
134 #include "content/public/common/sandboxed_process_launcher_delegate.h" 134 #include "content/public/common/sandboxed_process_launcher_delegate.h"
135 #include "content/public/common/url_constants.h" 135 #include "content/public/common/url_constants.h"
136 #include "gpu/command_buffer/service/gpu_switches.h" 136 #include "gpu/command_buffer/service/gpu_switches.h"
137 #include "ipc/ipc_channel.h" 137 #include "ipc/ipc_channel.h"
138 #include "ipc/ipc_logging.h" 138 #include "ipc/ipc_logging.h"
139 #include "ipc/ipc_switches.h" 139 #include "ipc/ipc_switches.h"
140 #include "ipc/mojo/ipc_channel_mojo.h"
140 #include "media/base/media_switches.h" 141 #include "media/base/media_switches.h"
141 #include "net/url_request/url_request_context_getter.h" 142 #include "net/url_request/url_request_context_getter.h"
142 #include "ppapi/shared_impl/ppapi_switches.h" 143 #include "ppapi/shared_impl/ppapi_switches.h"
143 #include "third_party/skia/include/core/SkBitmap.h" 144 #include "third_party/skia/include/core/SkBitmap.h"
144 #include "ui/base/ui_base_switches.h" 145 #include "ui/base/ui_base_switches.h"
145 #include "ui/events/event_switches.h" 146 #include "ui/events/event_switches.h"
146 #include "ui/gfx/switches.h" 147 #include "ui/gfx/switches.h"
147 #include "ui/gl/gl_switches.h" 148 #include "ui/gl/gl_switches.h"
148 #include "ui/native_theme/native_theme_switches.h" 149 #include "ui/native_theme/native_theme_switches.h"
149 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" 150 #include "webkit/browser/fileapi/sandbox_file_system_backend.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 588
588 // Find the renderer before creating the channel so if this fails early we 589 // Find the renderer before creating the channel so if this fails early we
589 // return without creating the channel. 590 // return without creating the channel.
590 base::FilePath renderer_path = ChildProcessHost::GetChildPath(flags); 591 base::FilePath renderer_path = ChildProcessHost::GetChildPath(flags);
591 if (renderer_path.empty()) 592 if (renderer_path.empty())
592 return false; 593 return false;
593 594
594 // Setup the IPC channel. 595 // Setup the IPC channel.
595 const std::string channel_id = 596 const std::string channel_id =
596 IPC::Channel::GenerateVerifiedChannelID(std::string()); 597 IPC::Channel::GenerateVerifiedChannelID(std::string());
597 channel_ = IPC::ChannelProxy::Create( 598 channel_ = CreateChannelProxy(channel_id);
598 channel_id,
599 IPC::Channel::MODE_SERVER,
600 this,
601 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get());
602 599
603 // Setup the Mojo channel. 600 // Setup the Mojo channel.
604 mojo_application_host_->Init(); 601 mojo_application_host_->Init();
605 602
606 // Call the embedder first so that their IPC filters have priority. 603 // Call the embedder first so that their IPC filters have priority.
607 GetContentClient()->browser()->RenderProcessWillLaunch(this); 604 GetContentClient()->browser()->RenderProcessWillLaunch(this);
608 605
609 CreateMessageFilters(); 606 CreateMessageFilters();
610 607
611 if (run_renderer_in_process()) { 608 if (run_renderer_in_process()) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 if (!mojo_activation_required_) 668 if (!mojo_activation_required_)
672 return; // Waiting on someone to require Mojo. 669 return; // Waiting on someone to require Mojo.
673 670
674 if (!GetHandle()) 671 if (!GetHandle())
675 return; // Waiting on renderer startup. 672 return; // Waiting on renderer startup.
676 673
677 if (!mojo_application_host_->did_activate()) 674 if (!mojo_application_host_->did_activate())
678 mojo_application_host_->Activate(this, GetHandle()); 675 mojo_application_host_->Activate(this, GetHandle());
679 } 676 }
680 677
678 bool RenderProcessHostImpl::ShouldUseMojoChannel() const {
679 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
680 return command_line.HasSwitch(switches::kEnableRendererMojoChannel);
681 }
682
683 scoped_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy(
684 const std::string& channel_id) {
685 scoped_refptr<base::SingleThreadTaskRunner> runner =
686 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
687 if (ShouldUseMojoChannel()) {
688 VLOG(1) << "Mojo Channel is enabled on host";
689 return IPC::ChannelProxy::Create(
690 IPC::ChannelMojo::CreateFactory(
691 channel_id, IPC::Channel::MODE_SERVER, runner),
692 this, runner.get());
693 }
694
695 return IPC::ChannelProxy::Create(
696 channel_id, IPC::Channel::MODE_SERVER, this, runner.get());
697 }
698
681 void RenderProcessHostImpl::CreateMessageFilters() { 699 void RenderProcessHostImpl::CreateMessageFilters() {
682 DCHECK_CURRENTLY_ON(BrowserThread::UI); 700 DCHECK_CURRENTLY_ON(BrowserThread::UI);
683 AddFilter(new ResourceSchedulerFilter(GetID())); 701 AddFilter(new ResourceSchedulerFilter(GetID()));
684 MediaInternals* media_internals = MediaInternals::GetInstance(); 702 MediaInternals* media_internals = MediaInternals::GetInstance();
685 media::AudioManager* audio_manager = 703 media::AudioManager* audio_manager =
686 BrowserMainLoop::GetInstance()->audio_manager(); 704 BrowserMainLoop::GetInstance()->audio_manager();
687 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages 705 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages
688 // from guests. 706 // from guests.
689 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( 707 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter(
690 new BrowserPluginMessageFilter(GetID())); 708 new BrowserPluginMessageFilter(GetID()));
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 switches::kEnableLogging, 1139 switches::kEnableLogging,
1122 switches::kEnableMemoryBenchmarking, 1140 switches::kEnableMemoryBenchmarking,
1123 switches::kEnableNetworkInformation, 1141 switches::kEnableNetworkInformation,
1124 switches::kEnableOneCopy, 1142 switches::kEnableOneCopy,
1125 switches::kEnableOverlayFullscreenVideo, 1143 switches::kEnableOverlayFullscreenVideo,
1126 switches::kEnableOverlayScrollbar, 1144 switches::kEnableOverlayScrollbar,
1127 switches::kEnableOverscrollNotifications, 1145 switches::kEnableOverscrollNotifications,
1128 switches::kEnablePinch, 1146 switches::kEnablePinch,
1129 switches::kEnablePreciseMemoryInfo, 1147 switches::kEnablePreciseMemoryInfo,
1130 switches::kEnablePreparsedJsCaching, 1148 switches::kEnablePreparsedJsCaching,
1149 switches::kEnableRendererMojoChannel,
1131 switches::kEnableSeccompFilterSandbox, 1150 switches::kEnableSeccompFilterSandbox,
1132 switches::kEnableSkiaBenchmarking, 1151 switches::kEnableSkiaBenchmarking,
1133 switches::kEnableSmoothScrolling, 1152 switches::kEnableSmoothScrolling,
1134 switches::kEnableStatsTable, 1153 switches::kEnableStatsTable,
1135 switches::kEnableStrictSiteIsolation, 1154 switches::kEnableStrictSiteIsolation,
1136 switches::kEnableTargetedStyleRecalc, 1155 switches::kEnableTargetedStyleRecalc,
1137 switches::kEnableThreadedCompositing, 1156 switches::kEnableThreadedCompositing,
1138 switches::kEnableTouchDragDrop, 1157 switches::kEnableTouchDragDrop,
1139 switches::kEnableTouchEditing, 1158 switches::kEnableTouchEditing,
1140 switches::kEnableViewport, 1159 switches::kEnableViewport,
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 } 2341 }
2323 2342
2324 void RenderProcessHostImpl::OnDeletedGpuMemoryBuffer( 2343 void RenderProcessHostImpl::OnDeletedGpuMemoryBuffer(
2325 gfx::GpuMemoryBufferType type, 2344 gfx::GpuMemoryBufferType type,
2326 const gfx::GpuMemoryBufferId& id) { 2345 const gfx::GpuMemoryBufferId& id) {
2327 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2346 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2328 GpuMemoryBufferImpl::DeletedByChildProcess(type, id, GetHandle()); 2347 GpuMemoryBufferImpl::DeletedByChildProcess(type, id, GetHandle());
2329 } 2348 }
2330 2349
2331 } // namespace content 2350 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698