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

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: Renamed ChanelBuilder to ChannelFactory Created 6 years, 5 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 #include "content/public/common/content_switches.h" 131 #include "content/public/common/content_switches.h"
132 #include "content/public/common/process_type.h" 132 #include "content/public/common/process_type.h"
133 #include "content/public/common/resource_type.h" 133 #include "content/public/common/resource_type.h"
134 #include "content/public/common/result_codes.h" 134 #include "content/public/common/result_codes.h"
135 #include "content/public/common/sandboxed_process_launcher_delegate.h" 135 #include "content/public/common/sandboxed_process_launcher_delegate.h"
136 #include "content/public/common/url_constants.h" 136 #include "content/public/common/url_constants.h"
137 #include "gpu/command_buffer/service/gpu_switches.h" 137 #include "gpu/command_buffer/service/gpu_switches.h"
138 #include "ipc/ipc_channel.h" 138 #include "ipc/ipc_channel.h"
139 #include "ipc/ipc_logging.h" 139 #include "ipc/ipc_logging.h"
140 #include "ipc/ipc_switches.h" 140 #include "ipc/ipc_switches.h"
141 #include "ipc/mojo/ipc_channel_mojo.h"
141 #include "media/base/media_switches.h" 142 #include "media/base/media_switches.h"
142 #include "net/url_request/url_request_context_getter.h" 143 #include "net/url_request/url_request_context_getter.h"
143 #include "ppapi/shared_impl/ppapi_switches.h" 144 #include "ppapi/shared_impl/ppapi_switches.h"
144 #include "third_party/skia/include/core/SkBitmap.h" 145 #include "third_party/skia/include/core/SkBitmap.h"
145 #include "ui/base/ui_base_switches.h" 146 #include "ui/base/ui_base_switches.h"
146 #include "ui/events/event_switches.h" 147 #include "ui/events/event_switches.h"
147 #include "ui/gfx/switches.h" 148 #include "ui/gfx/switches.h"
148 #include "ui/gl/gl_switches.h" 149 #include "ui/gl/gl_switches.h"
149 #include "ui/native_theme/native_theme_switches.h" 150 #include "ui/native_theme/native_theme_switches.h"
150 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" 151 #include "webkit/browser/fileapi/sandbox_file_system_backend.h"
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 558
558 #if defined(OS_ANDROID) 559 #if defined(OS_ANDROID)
559 CompositorImpl::DestroyAllSurfaceTextures(GetID()); 560 CompositorImpl::DestroyAllSurfaceTextures(GetID());
560 #endif 561 #endif
561 } 562 }
562 563
563 void RenderProcessHostImpl::EnableSendQueue() { 564 void RenderProcessHostImpl::EnableSendQueue() {
564 is_initialized_ = false; 565 is_initialized_ = false;
565 } 566 }
566 567
568 bool RenderProcessHostImpl::IsMojoChannelEnabled() const {
darin (slow to review) 2014/07/23 23:03:32 nit: these functions should be listed after MaybeA
Hajime Morrita 2014/07/24 00:38:44 Done.
569 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
570 return command_line.HasSwitch(switches::kEnableRendererMojoChannel);
571 }
572
573 scoped_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy(
574 const std::string& channel_id) {
575 scoped_refptr<base::SingleThreadTaskRunner> runner =
576 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
577 if (IsMojoChannelEnabled()) {
578 VLOG(1) << "Mojo Channel is enabled on host";
579 return IPC::ChannelProxy::Create(
580 IPC::ChannelMojo::CreateFactory(
581 channel_id, IPC::Channel::MODE_SERVER, runner),
582 this, runner.get());
583 }
584
585 return IPC::ChannelProxy::Create(
586 channel_id, IPC::Channel::MODE_SERVER, this, runner.get());
587 }
588
567 bool RenderProcessHostImpl::Init() { 589 bool RenderProcessHostImpl::Init() {
568 // calling Init() more than once does nothing, this makes it more convenient 590 // calling Init() more than once does nothing, this makes it more convenient
569 // for the view host which may not be sure in some cases 591 // for the view host which may not be sure in some cases
570 if (channel_) 592 if (channel_)
571 return true; 593 return true;
572 594
573 CommandLine::StringType renderer_prefix; 595 CommandLine::StringType renderer_prefix;
574 #if defined(OS_POSIX) 596 #if defined(OS_POSIX)
575 // A command prefix is something prepended to the command line of the spawned 597 // A command prefix is something prepended to the command line of the spawned
576 // process. It is supported only on POSIX systems. 598 // process. It is supported only on POSIX systems.
(...skipping 11 matching lines...) Expand all
588 610
589 // Find the renderer before creating the channel so if this fails early we 611 // Find the renderer before creating the channel so if this fails early we
590 // return without creating the channel. 612 // return without creating the channel.
591 base::FilePath renderer_path = ChildProcessHost::GetChildPath(flags); 613 base::FilePath renderer_path = ChildProcessHost::GetChildPath(flags);
592 if (renderer_path.empty()) 614 if (renderer_path.empty())
593 return false; 615 return false;
594 616
595 // Setup the IPC channel. 617 // Setup the IPC channel.
596 const std::string channel_id = 618 const std::string channel_id =
597 IPC::Channel::GenerateVerifiedChannelID(std::string()); 619 IPC::Channel::GenerateVerifiedChannelID(std::string());
598 channel_ = IPC::ChannelProxy::Create( 620 channel_ = CreateChannelProxy(channel_id);
599 channel_id,
600 IPC::Channel::MODE_SERVER,
601 this,
602 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get());
603 621
604 // Setup the Mojo channel. 622 // Setup the Mojo channel.
605 mojo_application_host_->Init(); 623 mojo_application_host_->Init();
606 624
607 // Call the embedder first so that their IPC filters have priority. 625 // Call the embedder first so that their IPC filters have priority.
608 GetContentClient()->browser()->RenderProcessWillLaunch(this); 626 GetContentClient()->browser()->RenderProcessWillLaunch(this);
609 627
610 CreateMessageFilters(); 628 CreateMessageFilters();
611 629
612 if (run_renderer_in_process()) { 630 if (run_renderer_in_process()) {
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 switches::kEnableLayerSquashing, 1156 switches::kEnableLayerSquashing,
1139 switches::kEnableLogging, 1157 switches::kEnableLogging,
1140 switches::kEnableMemoryBenchmarking, 1158 switches::kEnableMemoryBenchmarking,
1141 switches::kEnableOneCopy, 1159 switches::kEnableOneCopy,
1142 switches::kEnableOverlayFullscreenVideo, 1160 switches::kEnableOverlayFullscreenVideo,
1143 switches::kEnableOverlayScrollbar, 1161 switches::kEnableOverlayScrollbar,
1144 switches::kEnableOverscrollNotifications, 1162 switches::kEnableOverscrollNotifications,
1145 switches::kEnablePinch, 1163 switches::kEnablePinch,
1146 switches::kEnablePreciseMemoryInfo, 1164 switches::kEnablePreciseMemoryInfo,
1147 switches::kEnablePreparsedJsCaching, 1165 switches::kEnablePreparsedJsCaching,
1166 switches::kEnableRendererMojoChannel,
1148 switches::kEnableSeccompFilterSandbox, 1167 switches::kEnableSeccompFilterSandbox,
1149 switches::kEnableSkiaBenchmarking, 1168 switches::kEnableSkiaBenchmarking,
1150 switches::kEnableSmoothScrolling, 1169 switches::kEnableSmoothScrolling,
1151 switches::kEnableSpeechSynthesis, 1170 switches::kEnableSpeechSynthesis,
1152 switches::kEnableStatsTable, 1171 switches::kEnableStatsTable,
1153 switches::kEnableStrictSiteIsolation, 1172 switches::kEnableStrictSiteIsolation,
1154 switches::kEnableTargetedStyleRecalc, 1173 switches::kEnableTargetedStyleRecalc,
1155 switches::kEnableThreadedCompositing, 1174 switches::kEnableThreadedCompositing,
1156 switches::kEnableTouchDragDrop, 1175 switches::kEnableTouchDragDrop,
1157 switches::kEnableTouchEditing, 1176 switches::kEnableTouchEditing,
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2333 void RenderProcessHostImpl::GpuMemoryBufferAllocated( 2352 void RenderProcessHostImpl::GpuMemoryBufferAllocated(
2334 IPC::Message* reply, 2353 IPC::Message* reply,
2335 const gfx::GpuMemoryBufferHandle& handle) { 2354 const gfx::GpuMemoryBufferHandle& handle) {
2336 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2355 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2337 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, 2356 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply,
2338 handle); 2357 handle);
2339 Send(reply); 2358 Send(reply);
2340 } 2359 }
2341 2360
2342 } // namespace content 2361 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698