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

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: Fixing Mac build failure 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 #include "content/public/common/content_switches.h" 132 #include "content/public/common/content_switches.h"
133 #include "content/public/common/process_type.h" 133 #include "content/public/common/process_type.h"
134 #include "content/public/common/resource_type.h" 134 #include "content/public/common/resource_type.h"
135 #include "content/public/common/result_codes.h" 135 #include "content/public/common/result_codes.h"
136 #include "content/public/common/sandboxed_process_launcher_delegate.h" 136 #include "content/public/common/sandboxed_process_launcher_delegate.h"
137 #include "content/public/common/url_constants.h" 137 #include "content/public/common/url_constants.h"
138 #include "gpu/command_buffer/service/gpu_switches.h" 138 #include "gpu/command_buffer/service/gpu_switches.h"
139 #include "ipc/ipc_channel.h" 139 #include "ipc/ipc_channel.h"
140 #include "ipc/ipc_logging.h" 140 #include "ipc/ipc_logging.h"
141 #include "ipc/ipc_switches.h" 141 #include "ipc/ipc_switches.h"
142 #include "ipc/mojo/ipc_channel_mojo.h"
142 #include "media/base/media_switches.h" 143 #include "media/base/media_switches.h"
143 #include "net/url_request/url_request_context_getter.h" 144 #include "net/url_request/url_request_context_getter.h"
144 #include "ppapi/shared_impl/ppapi_switches.h" 145 #include "ppapi/shared_impl/ppapi_switches.h"
145 #include "third_party/skia/include/core/SkBitmap.h" 146 #include "third_party/skia/include/core/SkBitmap.h"
146 #include "ui/base/ui_base_switches.h" 147 #include "ui/base/ui_base_switches.h"
147 #include "ui/events/event_switches.h" 148 #include "ui/events/event_switches.h"
148 #include "ui/gfx/switches.h" 149 #include "ui/gfx/switches.h"
149 #include "ui/gl/gl_switches.h" 150 #include "ui/gl/gl_switches.h"
150 #include "ui/native_theme/native_theme_switches.h" 151 #include "ui/native_theme/native_theme_switches.h"
151 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" 152 #include "webkit/browser/fileapi/sandbox_file_system_backend.h"
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 552
552 #if defined(OS_ANDROID) 553 #if defined(OS_ANDROID)
553 CompositorImpl::DestroyAllSurfaceTextures(GetID()); 554 CompositorImpl::DestroyAllSurfaceTextures(GetID());
554 #endif 555 #endif
555 } 556 }
556 557
557 void RenderProcessHostImpl::EnableSendQueue() { 558 void RenderProcessHostImpl::EnableSendQueue() {
558 is_initialized_ = false; 559 is_initialized_ = false;
559 } 560 }
560 561
562 bool RenderProcessHostImpl::IsMojoChannelEnabled() const {
563 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
564 return command_line.HasSwitch(switches::kEnableRendererMojoChannel);
565 }
566
567 scoped_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy(
568 const std::string& channel_id) {
569 scoped_refptr<base::SingleThreadTaskRunner> runner =
570 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
571 if (IsMojoChannelEnabled()) {
572 VLOG(1) << "Mojo Channel is enabled on host";
573 return IPC::ChannelProxy::Create(
574 IPC::ChannelMojo::CreateBuilder(
575 channel_id, IPC::Channel::MODE_SERVER, runner),
576 this, runner.get());
577 }
578
579 return IPC::ChannelProxy::Create(
580 channel_id, IPC::Channel::MODE_SERVER, this, runner.get());
581 }
582
561 bool RenderProcessHostImpl::Init() { 583 bool RenderProcessHostImpl::Init() {
562 // calling Init() more than once does nothing, this makes it more convenient 584 // calling Init() more than once does nothing, this makes it more convenient
563 // for the view host which may not be sure in some cases 585 // for the view host which may not be sure in some cases
564 if (channel_) 586 if (channel_)
565 return true; 587 return true;
566 588
567 CommandLine::StringType renderer_prefix; 589 CommandLine::StringType renderer_prefix;
568 #if defined(OS_POSIX) 590 #if defined(OS_POSIX)
569 // A command prefix is something prepended to the command line of the spawned 591 // A command prefix is something prepended to the command line of the spawned
570 // process. It is supported only on POSIX systems. 592 // process. It is supported only on POSIX systems.
(...skipping 11 matching lines...) Expand all
582 604
583 // Find the renderer before creating the channel so if this fails early we 605 // Find the renderer before creating the channel so if this fails early we
584 // return without creating the channel. 606 // return without creating the channel.
585 base::FilePath renderer_path = ChildProcessHost::GetChildPath(flags); 607 base::FilePath renderer_path = ChildProcessHost::GetChildPath(flags);
586 if (renderer_path.empty()) 608 if (renderer_path.empty())
587 return false; 609 return false;
588 610
589 // Setup the IPC channel. 611 // Setup the IPC channel.
590 const std::string channel_id = 612 const std::string channel_id =
591 IPC::Channel::GenerateVerifiedChannelID(std::string()); 613 IPC::Channel::GenerateVerifiedChannelID(std::string());
592 channel_ = IPC::ChannelProxy::Create( 614 channel_ = CreateChannelProxy(channel_id);
593 channel_id,
594 IPC::Channel::MODE_SERVER,
595 this,
596 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get());
597 615
598 // Setup the Mojo channel. 616 // Setup the Mojo channel.
599 mojo_application_host_->Init(); 617 mojo_application_host_->Init();
600 618
601 // Call the embedder first so that their IPC filters have priority. 619 // Call the embedder first so that their IPC filters have priority.
602 GetContentClient()->browser()->RenderProcessWillLaunch(this); 620 GetContentClient()->browser()->RenderProcessWillLaunch(this);
603 621
604 CreateMessageFilters(); 622 CreateMessageFilters();
605 623
606 if (run_renderer_in_process()) { 624 if (run_renderer_in_process()) {
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 switches::kEnableLayerSquashing, 1165 switches::kEnableLayerSquashing,
1148 switches::kEnableLogging, 1166 switches::kEnableLogging,
1149 switches::kEnableMemoryBenchmarking, 1167 switches::kEnableMemoryBenchmarking,
1150 switches::kEnableOneCopy, 1168 switches::kEnableOneCopy,
1151 switches::kEnableOverlayFullscreenVideo, 1169 switches::kEnableOverlayFullscreenVideo,
1152 switches::kEnableOverlayScrollbar, 1170 switches::kEnableOverlayScrollbar,
1153 switches::kEnableOverscrollNotifications, 1171 switches::kEnableOverscrollNotifications,
1154 switches::kEnablePinch, 1172 switches::kEnablePinch,
1155 switches::kEnablePreciseMemoryInfo, 1173 switches::kEnablePreciseMemoryInfo,
1156 switches::kEnablePreparsedJsCaching, 1174 switches::kEnablePreparsedJsCaching,
1175 switches::kEnableRendererMojoChannel,
1157 switches::kEnableSeccompFilterSandbox, 1176 switches::kEnableSeccompFilterSandbox,
1158 switches::kEnableSkiaBenchmarking, 1177 switches::kEnableSkiaBenchmarking,
1159 switches::kEnableSmoothScrolling, 1178 switches::kEnableSmoothScrolling,
1160 switches::kEnableSpeechSynthesis, 1179 switches::kEnableSpeechSynthesis,
1161 switches::kEnableStatsTable, 1180 switches::kEnableStatsTable,
1162 switches::kEnableStrictSiteIsolation, 1181 switches::kEnableStrictSiteIsolation,
1163 switches::kEnableTargetedStyleRecalc, 1182 switches::kEnableTargetedStyleRecalc,
1164 switches::kEnableTouchDragDrop, 1183 switches::kEnableTouchDragDrop,
1165 switches::kEnableTouchEditing, 1184 switches::kEnableTouchEditing,
1166 switches::kEnableViewport, 1185 switches::kEnableViewport,
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 void RenderProcessHostImpl::GpuMemoryBufferAllocated( 2381 void RenderProcessHostImpl::GpuMemoryBufferAllocated(
2363 IPC::Message* reply, 2382 IPC::Message* reply,
2364 const gfx::GpuMemoryBufferHandle& handle) { 2383 const gfx::GpuMemoryBufferHandle& handle) {
2365 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2384 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2366 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, 2385 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply,
2367 handle); 2386 handle);
2368 Send(reply); 2387 Send(reply);
2369 } 2388 }
2370 2389
2371 } // namespace content 2390 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698