OLD | NEW |
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 Loading... |
130 #include "content/public/common/process_type.h" | 130 #include "content/public/common/process_type.h" |
131 #include "content/public/common/resource_type.h" | 131 #include "content/public/common/resource_type.h" |
132 #include "content/public/common/result_codes.h" | 132 #include "content/public/common/result_codes.h" |
133 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 133 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
134 #include "content/public/common/url_constants.h" | 134 #include "content/public/common/url_constants.h" |
135 #include "gpu/command_buffer/service/gpu_switches.h" | 135 #include "gpu/command_buffer/service/gpu_switches.h" |
136 #include "ipc/ipc_channel.h" | 136 #include "ipc/ipc_channel.h" |
137 #include "ipc/ipc_logging.h" | 137 #include "ipc/ipc_logging.h" |
138 #include "ipc/ipc_switches.h" | 138 #include "ipc/ipc_switches.h" |
139 #include "ipc/mojo/ipc_channel_mojo.h" | 139 #include "ipc/mojo/ipc_channel_mojo.h" |
| 140 #include "ipc/mojo/ipc_channel_mojo_host.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 "storage/browser/fileapi/sandbox_file_system_backend.h" | 144 #include "storage/browser/fileapi/sandbox_file_system_backend.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" |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 *base::CommandLine::ForCurrentProcess(); | 663 *base::CommandLine::ForCurrentProcess(); |
663 return command_line.HasSwitch(switches::kEnableRendererMojoChannel); | 664 return command_line.HasSwitch(switches::kEnableRendererMojoChannel); |
664 } | 665 } |
665 | 666 |
666 scoped_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy( | 667 scoped_ptr<IPC::ChannelProxy> RenderProcessHostImpl::CreateChannelProxy( |
667 const std::string& channel_id) { | 668 const std::string& channel_id) { |
668 scoped_refptr<base::SingleThreadTaskRunner> runner = | 669 scoped_refptr<base::SingleThreadTaskRunner> runner = |
669 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 670 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
670 if (ShouldUseMojoChannel()) { | 671 if (ShouldUseMojoChannel()) { |
671 VLOG(1) << "Mojo Channel is enabled on host"; | 672 VLOG(1) << "Mojo Channel is enabled on host"; |
672 return IPC::ChannelProxy::Create( | 673 if (!channel_mojo_host_) { |
673 IPC::ChannelMojo::CreateFactory( | 674 channel_mojo_host_.reset(new IPC::ChannelMojoHost( |
674 channel_id, IPC::Channel::MODE_SERVER, runner), | 675 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
675 this, runner.get()); | 676 } |
| 677 |
| 678 return IPC::ChannelProxy::Create(IPC::ChannelMojo::CreateServerFactory( |
| 679 channel_mojo_host_.get(), channel_id), |
| 680 this, |
| 681 runner.get()); |
676 } | 682 } |
677 | 683 |
678 return IPC::ChannelProxy::Create( | 684 return IPC::ChannelProxy::Create( |
679 channel_id, IPC::Channel::MODE_SERVER, this, runner.get()); | 685 channel_id, IPC::Channel::MODE_SERVER, this, runner.get()); |
680 } | 686 } |
681 | 687 |
682 void RenderProcessHostImpl::CreateMessageFilters() { | 688 void RenderProcessHostImpl::CreateMessageFilters() { |
683 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 689 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
684 AddFilter(new ResourceSchedulerFilter(GetID())); | 690 AddFilter(new ResourceSchedulerFilter(GetID())); |
685 MediaInternals* media_internals = MediaInternals::GetInstance(); | 691 MediaInternals* media_internals = MediaInternals::GetInstance(); |
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2090 NotificationService::current()->Notify( | 2096 NotificationService::current()->Notify( |
2091 NOTIFICATION_RENDERER_PROCESS_CREATED, | 2097 NOTIFICATION_RENDERER_PROCESS_CREATED, |
2092 Source<RenderProcessHost>(this), | 2098 Source<RenderProcessHost>(this), |
2093 NotificationService::NoDetails()); | 2099 NotificationService::NoDetails()); |
2094 | 2100 |
2095 // Allow Mojo to be setup before the renderer sees any Chrome IPC messages. | 2101 // Allow Mojo to be setup before the renderer sees any Chrome IPC messages. |
2096 // This way, Mojo can be safely used from the renderer in response to any | 2102 // This way, Mojo can be safely used from the renderer in response to any |
2097 // Chrome IPC message. | 2103 // Chrome IPC message. |
2098 MaybeActivateMojo(); | 2104 MaybeActivateMojo(); |
2099 | 2105 |
| 2106 if (channel_mojo_host_) |
| 2107 channel_mojo_host_->OnClientLaunched(child_process_launcher_->GetHandle()); |
| 2108 |
2100 while (!queued_messages_.empty()) { | 2109 while (!queued_messages_.empty()) { |
2101 Send(queued_messages_.front()); | 2110 Send(queued_messages_.front()); |
2102 queued_messages_.pop(); | 2111 queued_messages_.pop(); |
2103 } | 2112 } |
2104 | 2113 |
2105 #if defined(ENABLE_WEBRTC) | 2114 #if defined(ENABLE_WEBRTC) |
2106 if (WebRTCInternals::GetInstance()->aec_dump_enabled()) | 2115 if (WebRTCInternals::GetInstance()->aec_dump_enabled()) |
2107 EnableAecDump(WebRTCInternals::GetInstance()->aec_dump_file_path()); | 2116 EnableAecDump(WebRTCInternals::GetInstance()->aec_dump_file_path()); |
2108 #endif | 2117 #endif |
2109 } | 2118 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2235 if (worker_ref_count_ == 0) | 2244 if (worker_ref_count_ == 0) |
2236 Cleanup(); | 2245 Cleanup(); |
2237 } | 2246 } |
2238 | 2247 |
2239 void RenderProcessHostImpl::EnsureMojoActivated() { | 2248 void RenderProcessHostImpl::EnsureMojoActivated() { |
2240 mojo_activation_required_ = true; | 2249 mojo_activation_required_ = true; |
2241 MaybeActivateMojo(); | 2250 MaybeActivateMojo(); |
2242 } | 2251 } |
2243 | 2252 |
2244 } // namespace content | 2253 } // namespace content |
OLD | NEW |