OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 #include "device/time_zone_monitor/time_zone_monitor.h" | 166 #include "device/time_zone_monitor/time_zone_monitor.h" |
167 #include "gpu/GLES2/gl2extchromium.h" | 167 #include "gpu/GLES2/gl2extchromium.h" |
168 #include "gpu/command_buffer/client/gpu_switches.h" | 168 #include "gpu/command_buffer/client/gpu_switches.h" |
169 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 169 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
170 #include "gpu/command_buffer/service/gpu_switches.h" | 170 #include "gpu/command_buffer/service/gpu_switches.h" |
171 #include "ipc/ipc.mojom.h" | 171 #include "ipc/ipc.mojom.h" |
172 #include "ipc/ipc_channel.h" | 172 #include "ipc/ipc_channel.h" |
173 #include "ipc/ipc_channel_mojo.h" | 173 #include "ipc/ipc_channel_mojo.h" |
174 #include "ipc/ipc_logging.h" | 174 #include "ipc/ipc_logging.h" |
175 #include "media/base/media_switches.h" | 175 #include "media/base/media_switches.h" |
| 176 #include "media/media_features.h" |
176 #include "mojo/edk/embedder/embedder.h" | 177 #include "mojo/edk/embedder/embedder.h" |
177 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" | 178 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
178 #include "net/url_request/url_request_context_getter.h" | 179 #include "net/url_request/url_request_context_getter.h" |
179 #include "ppapi/features/features.h" | 180 #include "ppapi/features/features.h" |
180 #include "ppapi/shared_impl/ppapi_switches.h" | 181 #include "ppapi/shared_impl/ppapi_switches.h" |
181 #include "services/service_manager/public/cpp/connection.h" | 182 #include "services/service_manager/public/cpp/connection.h" |
182 #include "services/service_manager/public/cpp/interface_provider.h" | 183 #include "services/service_manager/public/cpp/interface_provider.h" |
183 #include "services/service_manager/public/cpp/interface_registry.h" | 184 #include "services/service_manager/public/cpp/interface_registry.h" |
184 #include "services/service_manager/runner/common/switches.h" | 185 #include "services/service_manager/runner/common/switches.h" |
185 #include "storage/browser/fileapi/sandbox_file_system_backend.h" | 186 #include "storage/browser/fileapi/sandbox_file_system_backend.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 #endif // defined(OS_POSIX) | 224 #endif // defined(OS_POSIX) |
224 | 225 |
225 #if defined(USE_OZONE) | 226 #if defined(USE_OZONE) |
226 #include "ui/ozone/public/ozone_switches.h" | 227 #include "ui/ozone/public/ozone_switches.h" |
227 #endif | 228 #endif |
228 | 229 |
229 #if BUILDFLAG(ENABLE_PLUGINS) | 230 #if BUILDFLAG(ENABLE_PLUGINS) |
230 #include "content/browser/plugin_service_impl.h" | 231 #include "content/browser/plugin_service_impl.h" |
231 #endif | 232 #endif |
232 | 233 |
233 #if defined(ENABLE_WEBRTC) | 234 #if BUILDFLAG(ENABLE_WEBRTC) |
234 #include "content/browser/renderer_host/media/media_stream_track_metrics_host.h" | 235 #include "content/browser/renderer_host/media/media_stream_track_metrics_host.h" |
235 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h" | 236 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h" |
236 #include "content/browser/webrtc/webrtc_internals.h" | 237 #include "content/browser/webrtc/webrtc_internals.h" |
237 #include "content/common/media/aec_dump_messages.h" | 238 #include "content/common/media/aec_dump_messages.h" |
238 #include "content/common/media/media_stream_messages.h" | 239 #include "content/common/media/media_stream_messages.h" |
239 #endif | 240 #endif |
240 | 241 |
241 #if BUILDFLAG(USE_MINIKIN_HYPHENATION) | 242 #if BUILDFLAG(USE_MINIKIN_HYPHENATION) |
242 #include "content/browser/hyphenation/hyphenation_impl.h" | 243 #include "content/browser/hyphenation/hyphenation_impl.h" |
243 #endif | 244 #endif |
244 | 245 |
245 #if defined(OS_WIN) | 246 #if defined(OS_WIN) |
246 #define IntToStringType base::IntToString16 | 247 #define IntToStringType base::IntToString16 |
247 #else | 248 #else |
248 #define IntToStringType base::IntToString | 249 #define IntToStringType base::IntToString |
249 #endif | 250 #endif |
250 | 251 |
251 namespace content { | 252 namespace content { |
252 namespace { | 253 namespace { |
253 | 254 |
254 const char kSiteProcessMapKeyName[] = "content_site_process_map"; | 255 const char kSiteProcessMapKeyName[] = "content_site_process_map"; |
255 | 256 |
256 #ifdef ENABLE_WEBRTC | 257 #if BUILDFLAG(ENABLE_WEBRTC) |
257 const base::FilePath::CharType kAecDumpFileNameAddition[] = | 258 const base::FilePath::CharType kAecDumpFileNameAddition[] = |
258 FILE_PATH_LITERAL("aec_dump"); | 259 FILE_PATH_LITERAL("aec_dump"); |
259 #endif | 260 #endif |
260 | 261 |
261 void CacheShaderInfo(int32_t id, base::FilePath path) { | 262 void CacheShaderInfo(int32_t id, base::FilePath path) { |
262 if (ShaderCacheFactory::GetInstance()) | 263 if (ShaderCacheFactory::GetInstance()) |
263 ShaderCacheFactory::GetInstance()->SetCacheInfo(id, path); | 264 ShaderCacheFactory::GetInstance()->SetCacheInfo(id, path); |
264 } | 265 } |
265 | 266 |
266 void RemoveShaderInfo(int32_t id) { | 267 void RemoveShaderInfo(int32_t id) { |
(...skipping 18 matching lines...) Expand all Loading... |
285 scoped_refptr<net::URLRequestContextGetter> request_context, | 286 scoped_refptr<net::URLRequestContextGetter> request_context, |
286 scoped_refptr<net::URLRequestContextGetter> media_request_context, | 287 scoped_refptr<net::URLRequestContextGetter> media_request_context, |
287 ResourceType resource_type, | 288 ResourceType resource_type, |
288 ResourceContext** resource_context_out, | 289 ResourceContext** resource_context_out, |
289 net::URLRequestContext** request_context_out) { | 290 net::URLRequestContext** request_context_out) { |
290 *resource_context_out = resource_context; | 291 *resource_context_out = resource_context; |
291 *request_context_out = | 292 *request_context_out = |
292 GetRequestContext(request_context, media_request_context, resource_type); | 293 GetRequestContext(request_context, media_request_context, resource_type); |
293 } | 294 } |
294 | 295 |
295 #if defined(ENABLE_WEBRTC) | 296 #if BUILDFLAG(ENABLE_WEBRTC) |
296 | 297 |
297 // Creates a file used for handing over to the renderer. | 298 // Creates a file used for handing over to the renderer. |
298 IPC::PlatformFileForTransit CreateFileForProcess(base::FilePath file_path) { | 299 IPC::PlatformFileForTransit CreateFileForProcess(base::FilePath file_path) { |
299 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 300 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
300 base::File dump_file(file_path, | 301 base::File dump_file(file_path, |
301 base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_APPEND); | 302 base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_APPEND); |
302 if (!dump_file.IsValid()) { | 303 if (!dump_file.IsValid()) { |
303 VLOG(1) << "Could not open AEC dump file, error=" | 304 VLOG(1) << "Could not open AEC dump file, error=" |
304 << dump_file.error_details(); | 305 << dump_file.error_details(); |
305 return IPC::InvalidPlatformFileForTransit(); | 306 return IPC::InvalidPlatformFileForTransit(); |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 is_process_backgrounded_(false), | 669 is_process_backgrounded_(false), |
669 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 670 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
670 browser_context_(browser_context), | 671 browser_context_(browser_context), |
671 storage_partition_impl_(storage_partition_impl), | 672 storage_partition_impl_(storage_partition_impl), |
672 sudden_termination_allowed_(true), | 673 sudden_termination_allowed_(true), |
673 ignore_input_events_(false), | 674 ignore_input_events_(false), |
674 is_for_guests_only_(is_for_guests_only), | 675 is_for_guests_only_(is_for_guests_only), |
675 gpu_observer_registered_(false), | 676 gpu_observer_registered_(false), |
676 delayed_cleanup_needed_(false), | 677 delayed_cleanup_needed_(false), |
677 within_process_died_observer_(false), | 678 within_process_died_observer_(false), |
678 #if defined(ENABLE_WEBRTC) | 679 #if BUILDFLAG(ENABLE_WEBRTC) |
679 webrtc_eventlog_host_(id_), | 680 webrtc_eventlog_host_(id_), |
680 #endif | 681 #endif |
681 max_worker_count_(0), | 682 max_worker_count_(0), |
682 permission_service_context_(new PermissionServiceContext(this)), | 683 permission_service_context_(new PermissionServiceContext(this)), |
683 channel_connected_(false), | 684 channel_connected_(false), |
684 sent_render_process_ready_(false), | 685 sent_render_process_ready_(false), |
685 #if defined(OS_ANDROID) | 686 #if defined(OS_ANDROID) |
686 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL, | 687 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL, |
687 base::WaitableEvent::InitialState::NOT_SIGNALED), | 688 base::WaitableEvent::InitialState::NOT_SIGNALED), |
688 #endif | 689 #endif |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 AddFilter(new AppCacheDispatcherHost( | 1077 AddFilter(new AppCacheDispatcherHost( |
1077 storage_partition_impl_->GetAppCacheService(), GetID())); | 1078 storage_partition_impl_->GetAppCacheService(), GetID())); |
1078 AddFilter(new ClipboardMessageFilter(blob_storage_context)); | 1079 AddFilter(new ClipboardMessageFilter(blob_storage_context)); |
1079 AddFilter(new DOMStorageMessageFilter( | 1080 AddFilter(new DOMStorageMessageFilter( |
1080 storage_partition_impl_->GetDOMStorageContext())); | 1081 storage_partition_impl_->GetDOMStorageContext())); |
1081 AddFilter(new IndexedDBDispatcherHost( | 1082 AddFilter(new IndexedDBDispatcherHost( |
1082 GetID(), storage_partition_impl_->GetURLRequestContext(), | 1083 GetID(), storage_partition_impl_->GetURLRequestContext(), |
1083 storage_partition_impl_->GetIndexedDBContext(), | 1084 storage_partition_impl_->GetIndexedDBContext(), |
1084 blob_storage_context.get())); | 1085 blob_storage_context.get())); |
1085 | 1086 |
1086 #if defined(ENABLE_WEBRTC) | 1087 #if BUILDFLAG(ENABLE_WEBRTC) |
1087 peer_connection_tracker_host_ = new PeerConnectionTrackerHost( | 1088 peer_connection_tracker_host_ = new PeerConnectionTrackerHost( |
1088 GetID(), webrtc_eventlog_host_.GetWeakPtr()); | 1089 GetID(), webrtc_eventlog_host_.GetWeakPtr()); |
1089 AddFilter(peer_connection_tracker_host_.get()); | 1090 AddFilter(peer_connection_tracker_host_.get()); |
1090 AddFilter(new MediaStreamDispatcherHost( | 1091 AddFilter(new MediaStreamDispatcherHost( |
1091 GetID(), browser_context->GetResourceContext()->GetMediaDeviceIDSalt(), | 1092 GetID(), browser_context->GetResourceContext()->GetMediaDeviceIDSalt(), |
1092 media_stream_manager)); | 1093 media_stream_manager)); |
1093 AddFilter(new MediaStreamTrackMetricsHost()); | 1094 AddFilter(new MediaStreamTrackMetricsHost()); |
1094 #endif | 1095 #endif |
1095 #if BUILDFLAG(ENABLE_PLUGINS) | 1096 #if BUILDFLAG(ENABLE_PLUGINS) |
1096 AddFilter(new PepperRendererConnection(GetID())); | 1097 AddFilter(new PepperRendererConnection(GetID())); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 storage_partition_impl_->GetURLRequestContext(), | 1143 storage_partition_impl_->GetURLRequestContext(), |
1143 storage_partition_impl_->GetMediaURLRequestContext(), | 1144 storage_partition_impl_->GetMediaURLRequestContext(), |
1144 storage_partition_impl_->GetAppCacheService(), | 1145 storage_partition_impl_->GetAppCacheService(), |
1145 storage_partition_impl_->GetQuotaManager(), | 1146 storage_partition_impl_->GetQuotaManager(), |
1146 storage_partition_impl_->GetFileSystemContext(), | 1147 storage_partition_impl_->GetFileSystemContext(), |
1147 storage_partition_impl_->GetDatabaseTracker(), | 1148 storage_partition_impl_->GetDatabaseTracker(), |
1148 storage_partition_impl_->GetIndexedDBContext(), | 1149 storage_partition_impl_->GetIndexedDBContext(), |
1149 storage_partition_impl_->GetServiceWorkerContext()), | 1150 storage_partition_impl_->GetServiceWorkerContext()), |
1150 message_port_message_filter_.get())); | 1151 message_port_message_filter_.get())); |
1151 | 1152 |
1152 #if defined(ENABLE_WEBRTC) | 1153 #if BUILDFLAG(ENABLE_WEBRTC) |
1153 p2p_socket_dispatcher_host_ = new P2PSocketDispatcherHost( | 1154 p2p_socket_dispatcher_host_ = new P2PSocketDispatcherHost( |
1154 resource_context, request_context.get()); | 1155 resource_context, request_context.get()); |
1155 AddFilter(p2p_socket_dispatcher_host_.get()); | 1156 AddFilter(p2p_socket_dispatcher_host_.get()); |
1156 #endif | 1157 #endif |
1157 | 1158 |
1158 AddFilter(new TraceMessageFilter(GetID())); | 1159 AddFilter(new TraceMessageFilter(GetID())); |
1159 AddFilter(new ResolveProxyMsgHelper(request_context.get())); | 1160 AddFilter(new ResolveProxyMsgHelper(request_context.get())); |
1160 AddFilter(new QuotaDispatcherHost( | 1161 AddFilter(new QuotaDispatcherHost( |
1161 GetID(), storage_partition_impl_->GetQuotaManager(), | 1162 GetID(), storage_partition_impl_->GetQuotaManager(), |
1162 GetContentClient()->browser()->CreateQuotaPermissionContext())); | 1163 GetContentClient()->browser()->CreateQuotaPermissionContext())); |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 cc::switches::kShowPropertyChangedRects, | 1776 cc::switches::kShowPropertyChangedRects, |
1776 cc::switches::kShowScreenSpaceRects, | 1777 cc::switches::kShowScreenSpaceRects, |
1777 cc::switches::kShowSurfaceDamageRects, | 1778 cc::switches::kShowSurfaceDamageRects, |
1778 cc::switches::kSlowDownRasterScaleFactor, | 1779 cc::switches::kSlowDownRasterScaleFactor, |
1779 cc::switches::kBrowserControlsHideThreshold, | 1780 cc::switches::kBrowserControlsHideThreshold, |
1780 cc::switches::kBrowserControlsShowThreshold, | 1781 cc::switches::kBrowserControlsShowThreshold, |
1781 | 1782 |
1782 #if BUILDFLAG(ENABLE_PLUGINS) | 1783 #if BUILDFLAG(ENABLE_PLUGINS) |
1783 switches::kEnablePepperTesting, | 1784 switches::kEnablePepperTesting, |
1784 #endif | 1785 #endif |
1785 #if defined(ENABLE_WEBRTC) | 1786 #if BUILDFLAG(ENABLE_WEBRTC) |
1786 switches::kDisableWebRtcHWDecoding, | 1787 switches::kDisableWebRtcHWDecoding, |
1787 switches::kDisableWebRtcHWEncoding, | 1788 switches::kDisableWebRtcHWEncoding, |
1788 switches::kEnableWebRtcStunOrigin, | 1789 switches::kEnableWebRtcStunOrigin, |
1789 switches::kEnforceWebRtcIPPermissionCheck, | 1790 switches::kEnforceWebRtcIPPermissionCheck, |
1790 switches::kForceWebRtcIPHandlingPolicy, | 1791 switches::kForceWebRtcIPHandlingPolicy, |
1791 switches::kWebRtcMaxCaptureFramerate, | 1792 switches::kWebRtcMaxCaptureFramerate, |
1792 #endif | 1793 #endif |
1793 switches::kEnableLowEndDeviceMode, | 1794 switches::kEnableLowEndDeviceMode, |
1794 switches::kDisableLowEndDeviceMode, | 1795 switches::kDisableLowEndDeviceMode, |
1795 #if defined(OS_ANDROID) | 1796 #if defined(OS_ANDROID) |
(...skipping 30 matching lines...) Expand all Loading... |
1826 | 1827 |
1827 if (browser_cmd.HasSwitch(switches::kTraceStartup) && | 1828 if (browser_cmd.HasSwitch(switches::kTraceStartup) && |
1828 BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) { | 1829 BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) { |
1829 // Pass kTraceStartup switch to renderer only if startup tracing has not | 1830 // Pass kTraceStartup switch to renderer only if startup tracing has not |
1830 // finished. | 1831 // finished. |
1831 renderer_cmd->AppendSwitchASCII( | 1832 renderer_cmd->AppendSwitchASCII( |
1832 switches::kTraceStartup, | 1833 switches::kTraceStartup, |
1833 browser_cmd.GetSwitchValueASCII(switches::kTraceStartup)); | 1834 browser_cmd.GetSwitchValueASCII(switches::kTraceStartup)); |
1834 } | 1835 } |
1835 | 1836 |
1836 #if defined(ENABLE_WEBRTC) | 1837 #if BUILDFLAG(ENABLE_WEBRTC) |
1837 // Only run the Stun trials in the first renderer. | 1838 // Only run the Stun trials in the first renderer. |
1838 if (!has_done_stun_trials && | 1839 if (!has_done_stun_trials && |
1839 browser_cmd.HasSwitch(switches::kWebRtcStunProbeTrialParameter)) { | 1840 browser_cmd.HasSwitch(switches::kWebRtcStunProbeTrialParameter)) { |
1840 has_done_stun_trials = true; | 1841 has_done_stun_trials = true; |
1841 renderer_cmd->AppendSwitchASCII( | 1842 renderer_cmd->AppendSwitchASCII( |
1842 switches::kWebRtcStunProbeTrialParameter, | 1843 switches::kWebRtcStunProbeTrialParameter, |
1843 browser_cmd.GetSwitchValueASCII( | 1844 browser_cmd.GetSwitchValueASCII( |
1844 switches::kWebRtcStunProbeTrialParameter)); | 1845 switches::kWebRtcStunProbeTrialParameter)); |
1845 } | 1846 } |
1846 #endif | 1847 #endif |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 if (msg.routing_id() == MSG_ROUTING_CONTROL) { | 1979 if (msg.routing_id() == MSG_ROUTING_CONTROL) { |
1979 // Dispatch control messages. | 1980 // Dispatch control messages. |
1980 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg) | 1981 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg) |
1981 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, | 1982 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, |
1982 OnShutdownRequest) | 1983 OnShutdownRequest) |
1983 IPC_MESSAGE_HANDLER(RenderProcessHostMsg_SuddenTerminationChanged, | 1984 IPC_MESSAGE_HANDLER(RenderProcessHostMsg_SuddenTerminationChanged, |
1984 SuddenTerminationChanged) | 1985 SuddenTerminationChanged) |
1985 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, | 1986 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, |
1986 OnUserMetricsRecordAction) | 1987 OnUserMetricsRecordAction) |
1987 IPC_MESSAGE_HANDLER(ViewHostMsg_Close_ACK, OnCloseACK) | 1988 IPC_MESSAGE_HANDLER(ViewHostMsg_Close_ACK, OnCloseACK) |
1988 #if defined(ENABLE_WEBRTC) | 1989 #if BUILDFLAG(ENABLE_WEBRTC) |
1989 IPC_MESSAGE_HANDLER(AecDumpMsg_RegisterAecDumpConsumer, | 1990 IPC_MESSAGE_HANDLER(AecDumpMsg_RegisterAecDumpConsumer, |
1990 OnRegisterAecDumpConsumer) | 1991 OnRegisterAecDumpConsumer) |
1991 IPC_MESSAGE_HANDLER(AecDumpMsg_UnregisterAecDumpConsumer, | 1992 IPC_MESSAGE_HANDLER(AecDumpMsg_UnregisterAecDumpConsumer, |
1992 OnUnregisterAecDumpConsumer) | 1993 OnUnregisterAecDumpConsumer) |
1993 #endif | 1994 #endif |
1994 // Adding single handlers for your service here is fine, but once your | 1995 // Adding single handlers for your service here is fine, but once your |
1995 // service needs more than one handler, please extract them into a new | 1996 // service needs more than one handler, please extract them into a new |
1996 // message filter and add that filter to CreateMessageFilters(). | 1997 // message filter and add that filter to CreateMessageFilters(). |
1997 IPC_END_MESSAGE_MAP() | 1998 IPC_END_MESSAGE_MAP() |
1998 | 1999 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2104 // Records the time when the process starts surviving for workers for UMA. | 2105 // Records the time when the process starts surviving for workers for UMA. |
2105 if (listeners_.IsEmpty() && worker_ref_count() > 0 && | 2106 if (listeners_.IsEmpty() && worker_ref_count() > 0 && |
2106 survive_for_worker_start_time_.is_null()) { | 2107 survive_for_worker_start_time_.is_null()) { |
2107 survive_for_worker_start_time_ = base::TimeTicks::Now(); | 2108 survive_for_worker_start_time_ = base::TimeTicks::Now(); |
2108 } | 2109 } |
2109 | 2110 |
2110 // Until there are no other owners of this object, we can't delete ourselves. | 2111 // Until there are no other owners of this object, we can't delete ourselves. |
2111 if (!listeners_.IsEmpty() || worker_ref_count() != 0) | 2112 if (!listeners_.IsEmpty() || worker_ref_count() != 0) |
2112 return; | 2113 return; |
2113 | 2114 |
2114 #if defined(ENABLE_WEBRTC) | 2115 #if BUILDFLAG(ENABLE_WEBRTC) |
2115 if (is_initialized_) | 2116 if (is_initialized_) |
2116 ClearWebRtcLogMessageCallback(); | 2117 ClearWebRtcLogMessageCallback(); |
2117 #endif | 2118 #endif |
2118 | 2119 |
2119 if (!survive_for_worker_start_time_.is_null()) { | 2120 if (!survive_for_worker_start_time_.is_null()) { |
2120 UMA_HISTOGRAM_LONG_TIMES( | 2121 UMA_HISTOGRAM_LONG_TIMES( |
2121 "SharedWorker.RendererSurviveForWorkerTime", | 2122 "SharedWorker.RendererSurviveForWorkerTime", |
2122 base::TimeTicks::Now() - survive_for_worker_start_time_); | 2123 base::TimeTicks::Now() - survive_for_worker_start_time_); |
2123 } | 2124 } |
2124 | 2125 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2209 } | 2210 } |
2210 | 2211 |
2211 base::TimeDelta RenderProcessHostImpl::GetChildProcessIdleTime() const { | 2212 base::TimeDelta RenderProcessHostImpl::GetChildProcessIdleTime() const { |
2212 return base::TimeTicks::Now() - child_process_activity_time_; | 2213 return base::TimeTicks::Now() - child_process_activity_time_; |
2213 } | 2214 } |
2214 | 2215 |
2215 void RenderProcessHostImpl::FilterURL(bool empty_allowed, GURL* url) { | 2216 void RenderProcessHostImpl::FilterURL(bool empty_allowed, GURL* url) { |
2216 FilterURL(this, empty_allowed, url); | 2217 FilterURL(this, empty_allowed, url); |
2217 } | 2218 } |
2218 | 2219 |
2219 #if defined(ENABLE_WEBRTC) | 2220 #if BUILDFLAG(ENABLE_WEBRTC) |
2220 void RenderProcessHostImpl::EnableAudioDebugRecordings( | 2221 void RenderProcessHostImpl::EnableAudioDebugRecordings( |
2221 const base::FilePath& file) { | 2222 const base::FilePath& file) { |
2222 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2223 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
2223 | 2224 |
2224 // Enable AEC dump for each registered consumer. | 2225 // Enable AEC dump for each registered consumer. |
2225 base::FilePath file_with_extensions = GetAecDumpFilePathWithExtensions(file); | 2226 base::FilePath file_with_extensions = GetAecDumpFilePathWithExtensions(file); |
2226 for (std::vector<int>::iterator it = aec_dump_consumers_.begin(); | 2227 for (std::vector<int>::iterator it = aec_dump_consumers_.begin(); |
2227 it != aec_dump_consumers_.end(); ++it) { | 2228 it != aec_dump_consumers_.end(); ++it) { |
2228 EnableAecDumpForId(file_with_extensions, *it); | 2229 EnableAecDumpForId(file_with_extensions, *it); |
2229 } | 2230 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2265 const base::FilePath& file_path) { | 2266 const base::FilePath& file_path) { |
2266 return webrtc_eventlog_host_.StartWebRTCEventLog(file_path); | 2267 return webrtc_eventlog_host_.StartWebRTCEventLog(file_path); |
2267 } | 2268 } |
2268 | 2269 |
2269 bool RenderProcessHostImpl::StopWebRTCEventLog() { | 2270 bool RenderProcessHostImpl::StopWebRTCEventLog() { |
2270 return webrtc_eventlog_host_.StopWebRTCEventLog(); | 2271 return webrtc_eventlog_host_.StopWebRTCEventLog(); |
2271 } | 2272 } |
2272 | 2273 |
2273 void RenderProcessHostImpl::SetWebRtcLogMessageCallback( | 2274 void RenderProcessHostImpl::SetWebRtcLogMessageCallback( |
2274 base::Callback<void(const std::string&)> callback) { | 2275 base::Callback<void(const std::string&)> callback) { |
2275 #if defined(ENABLE_WEBRTC) | 2276 #if BUILDFLAG(ENABLE_WEBRTC) |
2276 BrowserMainLoop::GetInstance()->media_stream_manager()-> | 2277 BrowserMainLoop::GetInstance()->media_stream_manager()-> |
2277 RegisterNativeLogCallback(GetID(), callback); | 2278 RegisterNativeLogCallback(GetID(), callback); |
2278 #endif | 2279 #endif |
2279 } | 2280 } |
2280 | 2281 |
2281 void RenderProcessHostImpl::ClearWebRtcLogMessageCallback() { | 2282 void RenderProcessHostImpl::ClearWebRtcLogMessageCallback() { |
2282 #if defined(ENABLE_WEBRTC) | 2283 #if BUILDFLAG(ENABLE_WEBRTC) |
2283 BrowserMainLoop::GetInstance() | 2284 BrowserMainLoop::GetInstance() |
2284 ->media_stream_manager() | 2285 ->media_stream_manager() |
2285 ->UnregisterNativeLogCallback(GetID()); | 2286 ->UnregisterNativeLogCallback(GetID()); |
2286 #endif | 2287 #endif |
2287 } | 2288 } |
2288 | 2289 |
2289 RenderProcessHostImpl::WebRtcStopRtpDumpCallback | 2290 RenderProcessHostImpl::WebRtcStopRtpDumpCallback |
2290 RenderProcessHostImpl::StartRtpDump( | 2291 RenderProcessHostImpl::StartRtpDump( |
2291 bool incoming, | 2292 bool incoming, |
2292 bool outgoing, | 2293 bool outgoing, |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2855 channel_->Flush(); | 2856 channel_->Flush(); |
2856 | 2857 |
2857 if (IsReady()) { | 2858 if (IsReady()) { |
2858 DCHECK(!sent_render_process_ready_); | 2859 DCHECK(!sent_render_process_ready_); |
2859 sent_render_process_ready_ = true; | 2860 sent_render_process_ready_ = true; |
2860 // Send RenderProcessReady only if the channel is already connected. | 2861 // Send RenderProcessReady only if the channel is already connected. |
2861 for (auto& observer : observers_) | 2862 for (auto& observer : observers_) |
2862 observer.RenderProcessReady(this); | 2863 observer.RenderProcessReady(this); |
2863 } | 2864 } |
2864 | 2865 |
2865 #if defined(ENABLE_WEBRTC) | 2866 #if BUILDFLAG(ENABLE_WEBRTC) |
2866 if (WebRTCInternals::GetInstance()->IsAudioDebugRecordingsEnabled()) { | 2867 if (WebRTCInternals::GetInstance()->IsAudioDebugRecordingsEnabled()) { |
2867 EnableAudioDebugRecordings( | 2868 EnableAudioDebugRecordings( |
2868 WebRTCInternals::GetInstance()->GetAudioDebugRecordingsFilePath()); | 2869 WebRTCInternals::GetInstance()->GetAudioDebugRecordingsFilePath()); |
2869 } | 2870 } |
2870 #endif | 2871 #endif |
2871 } | 2872 } |
2872 | 2873 |
2873 void RenderProcessHostImpl::OnProcessLaunchFailed(int error_code) { | 2874 void RenderProcessHostImpl::OnProcessLaunchFailed(int error_code) { |
2874 // If this object will be destructed soon, then observers have already been | 2875 // If this object will be destructed soon, then observers have already been |
2875 // sent a RenderProcessHostDestroyed notification, and we must observe our | 2876 // sent a RenderProcessHostDestroyed notification, and we must observe our |
(...skipping 21 matching lines...) Expand all Loading... |
2897 static_cast<SessionStorageHolder*>(GetUserData(kSessionStorageHolderKey)); | 2898 static_cast<SessionStorageHolder*>(GetUserData(kSessionStorageHolderKey)); |
2898 if (!holder) | 2899 if (!holder) |
2899 return; | 2900 return; |
2900 holder->Release(old_route_id); | 2901 holder->Release(old_route_id); |
2901 } | 2902 } |
2902 | 2903 |
2903 void RenderProcessHostImpl::OnGpuSwitched() { | 2904 void RenderProcessHostImpl::OnGpuSwitched() { |
2904 RecomputeAndUpdateWebKitPreferences(); | 2905 RecomputeAndUpdateWebKitPreferences(); |
2905 } | 2906 } |
2906 | 2907 |
2907 #if defined(ENABLE_WEBRTC) | 2908 #if BUILDFLAG(ENABLE_WEBRTC) |
2908 void RenderProcessHostImpl::OnRegisterAecDumpConsumer(int id) { | 2909 void RenderProcessHostImpl::OnRegisterAecDumpConsumer(int id) { |
2909 BrowserThread::PostTask( | 2910 BrowserThread::PostTask( |
2910 BrowserThread::UI, FROM_HERE, | 2911 BrowserThread::UI, FROM_HERE, |
2911 base::Bind(&RenderProcessHostImpl::RegisterAecDumpConsumerOnUIThread, | 2912 base::Bind(&RenderProcessHostImpl::RegisterAecDumpConsumerOnUIThread, |
2912 weak_factory_.GetWeakPtr(), id)); | 2913 weak_factory_.GetWeakPtr(), id)); |
2913 } | 2914 } |
2914 | 2915 |
2915 void RenderProcessHostImpl::OnUnregisterAecDumpConsumer(int id) { | 2916 void RenderProcessHostImpl::OnUnregisterAecDumpConsumer(int id) { |
2916 BrowserThread::PostTask( | 2917 BrowserThread::PostTask( |
2917 BrowserThread::UI, FROM_HERE, | 2918 BrowserThread::UI, FROM_HERE, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2961 | 2962 |
2962 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() { | 2963 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() { |
2963 Send(new AecDumpMsg_DisableAecDump()); | 2964 Send(new AecDumpMsg_DisableAecDump()); |
2964 } | 2965 } |
2965 | 2966 |
2966 base::FilePath RenderProcessHostImpl::GetAecDumpFilePathWithExtensions( | 2967 base::FilePath RenderProcessHostImpl::GetAecDumpFilePathWithExtensions( |
2967 const base::FilePath& file) { | 2968 const base::FilePath& file) { |
2968 return file.AddExtension(IntToStringType(base::GetProcId(GetHandle()))) | 2969 return file.AddExtension(IntToStringType(base::GetProcId(GetHandle()))) |
2969 .AddExtension(kAecDumpFileNameAddition); | 2970 .AddExtension(kAecDumpFileNameAddition); |
2970 } | 2971 } |
2971 #endif // defined(ENABLE_WEBRTC) | 2972 #endif // BUILDFLAG(ENABLE_WEBRTC) |
2972 | 2973 |
2973 void RenderProcessHostImpl::GetAudioOutputControllers( | 2974 void RenderProcessHostImpl::GetAudioOutputControllers( |
2974 const GetAudioOutputControllersCallback& callback) const { | 2975 const GetAudioOutputControllersCallback& callback) const { |
2975 audio_renderer_host()->GetOutputControllers(callback); | 2976 audio_renderer_host()->GetOutputControllers(callback); |
2976 } | 2977 } |
2977 | 2978 |
2978 void RenderProcessHostImpl::RecomputeAndUpdateWebKitPreferences() { | 2979 void RenderProcessHostImpl::RecomputeAndUpdateWebKitPreferences() { |
2979 // We are updating all widgets including swapped out ones. | 2980 // We are updating all widgets including swapped out ones. |
2980 std::unique_ptr<RenderWidgetHostIterator> widgets( | 2981 std::unique_ptr<RenderWidgetHostIterator> widgets( |
2981 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); | 2982 RenderWidgetHostImpl::GetAllRenderWidgetHosts()); |
(...skipping 16 matching lines...) Expand all Loading... |
2998 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2999 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
2999 | 3000 |
3000 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 3001 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
3001 // enough information here so that we can determine what the bad message was. | 3002 // enough information here so that we can determine what the bad message was. |
3002 base::debug::Alias(&error); | 3003 base::debug::Alias(&error); |
3003 bad_message::ReceivedBadMessage(render_process_id, | 3004 bad_message::ReceivedBadMessage(render_process_id, |
3004 bad_message::RPH_MOJO_PROCESS_ERROR); | 3005 bad_message::RPH_MOJO_PROCESS_ERROR); |
3005 } | 3006 } |
3006 | 3007 |
3007 } // namespace content | 3008 } // namespace content |
OLD | NEW |