| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 VLOG(1) << "Could not open AEC dump file, error=" | 292 VLOG(1) << "Could not open AEC dump file, error=" |
| 293 << dump_file.error_details(); | 293 << dump_file.error_details(); |
| 294 return IPC::InvalidPlatformFileForTransit(); | 294 return IPC::InvalidPlatformFileForTransit(); |
| 295 } | 295 } |
| 296 return IPC::TakeFileHandleForProcess(std::move(dump_file), process); | 296 return IPC::TakeFileHandleForProcess(std::move(dump_file), process); |
| 297 } | 297 } |
| 298 | 298 |
| 299 // Allow us to only run the trial in the first renderer. | 299 // Allow us to only run the trial in the first renderer. |
| 300 bool has_done_stun_trials = false; | 300 bool has_done_stun_trials = false; |
| 301 | 301 |
| 302 // Does nothing. Just to avoid races between enable and disable. | |
| 303 void DisableAecDumpOnFileThread() { | |
| 304 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | |
| 305 } | |
| 306 #endif | 302 #endif |
| 307 | 303 |
| 308 // the global list of all renderer processes | 304 // the global list of all renderer processes |
| 309 base::LazyInstance<IDMap<RenderProcessHost>>::Leaky g_all_hosts = | 305 base::LazyInstance<IDMap<RenderProcessHost>>::Leaky g_all_hosts = |
| 310 LAZY_INSTANCE_INITIALIZER; | 306 LAZY_INSTANCE_INITIALIZER; |
| 311 | 307 |
| 312 // Map of site to process, to ensure we only have one RenderProcessHost per | 308 // Map of site to process, to ensure we only have one RenderProcessHost per |
| 313 // site in process-per-site mode. Each map is specific to a BrowserContext. | 309 // site in process-per-site mode. Each map is specific to a BrowserContext. |
| 314 class SiteProcessMap : public base::SupportsUserData::Data { | 310 class SiteProcessMap : public base::SupportsUserData::Data { |
| 315 public: | 311 public: |
| (...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2021 } | 2017 } |
| 2022 } | 2018 } |
| 2023 | 2019 |
| 2024 void RenderProcessHostImpl::DisableAudioDebugRecordings() { | 2020 void RenderProcessHostImpl::DisableAudioDebugRecordings() { |
| 2025 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2021 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 2026 | 2022 |
| 2027 // Posting on the FILE thread and then replying back on the UI thread is only | 2023 // Posting on the FILE thread and then replying back on the UI thread is only |
| 2028 // for avoiding races between enable and disable. Nothing is done on the FILE | 2024 // for avoiding races between enable and disable. Nothing is done on the FILE |
| 2029 // thread. | 2025 // thread. |
| 2030 BrowserThread::PostTaskAndReply( | 2026 BrowserThread::PostTaskAndReply( |
| 2031 BrowserThread::FILE, FROM_HERE, base::Bind(&DisableAecDumpOnFileThread), | 2027 BrowserThread::FILE, FROM_HERE, base::Bind(&base::DoNothing), |
| 2032 base::Bind(&RenderProcessHostImpl::SendDisableAecDumpToRenderer, | 2028 base::Bind(&RenderProcessHostImpl::SendDisableAecDumpToRenderer, |
| 2033 weak_factory_.GetWeakPtr())); | 2029 weak_factory_.GetWeakPtr())); |
| 2034 | 2030 |
| 2035 // AudioInputRendererHost is reference counted, so it's lifetime is | 2031 // AudioInputRendererHost is reference counted, so it's lifetime is |
| 2036 // guaranteed during the lifetime of the closure. | 2032 // guaranteed during the lifetime of the closure. |
| 2037 if (audio_input_renderer_host_) { | 2033 if (audio_input_renderer_host_) { |
| 2038 // Not null if RenderProcessHostImpl::Init has already been called. | 2034 // Not null if RenderProcessHostImpl::Init has already been called. |
| 2039 BrowserThread::PostTask( | 2035 BrowserThread::PostTask( |
| 2040 BrowserThread::IO, FROM_HERE, | 2036 BrowserThread::IO, FROM_HERE, |
| 2041 base::Bind(&AudioInputRendererHost::DisableDebugRecording, | 2037 base::Bind(&AudioInputRendererHost::DisableDebugRecording, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2053 EnableEventLogForId(file_with_extensions, id); | 2049 EnableEventLogForId(file_with_extensions, id); |
| 2054 } | 2050 } |
| 2055 | 2051 |
| 2056 void RenderProcessHostImpl::DisableEventLogRecordings() { | 2052 void RenderProcessHostImpl::DisableEventLogRecordings() { |
| 2057 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2053 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 2058 | 2054 |
| 2059 // Posting on the FILE thread and then replying back on the UI thread is only | 2055 // Posting on the FILE thread and then replying back on the UI thread is only |
| 2060 // for avoiding races between enable and disable. Nothing is done on the FILE | 2056 // for avoiding races between enable and disable. Nothing is done on the FILE |
| 2061 // thread. | 2057 // thread. |
| 2062 BrowserThread::PostTaskAndReply( | 2058 BrowserThread::PostTaskAndReply( |
| 2063 BrowserThread::FILE, FROM_HERE, base::Bind(&DisableAecDumpOnFileThread), | 2059 BrowserThread::FILE, FROM_HERE, base::Bind(&base::DoNothing), |
| 2064 base::Bind(&RenderProcessHostImpl::SendDisableEventLogToRenderer, | 2060 base::Bind(&RenderProcessHostImpl::SendDisableEventLogToRenderer, |
| 2065 weak_factory_.GetWeakPtr())); | 2061 weak_factory_.GetWeakPtr())); |
| 2066 } | 2062 } |
| 2067 | 2063 |
| 2068 void RenderProcessHostImpl::SetWebRtcLogMessageCallback( | 2064 void RenderProcessHostImpl::SetWebRtcLogMessageCallback( |
| 2069 base::Callback<void(const std::string&)> callback) { | 2065 base::Callback<void(const std::string&)> callback) { |
| 2070 #if defined(ENABLE_WEBRTC) | 2066 #if defined(ENABLE_WEBRTC) |
| 2071 BrowserMainLoop::GetInstance()->media_stream_manager()-> | 2067 BrowserMainLoop::GetInstance()->media_stream_manager()-> |
| 2072 RegisterNativeLogCallback(GetID(), callback); | 2068 RegisterNativeLogCallback(GetID(), callback); |
| 2073 #endif | 2069 #endif |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2803 | 2799 |
| 2804 // Skip widgets in other processes. | 2800 // Skip widgets in other processes. |
| 2805 if (rvh->GetProcess()->GetID() != GetID()) | 2801 if (rvh->GetProcess()->GetID() != GetID()) |
| 2806 continue; | 2802 continue; |
| 2807 | 2803 |
| 2808 rvh->OnWebkitPreferencesChanged(); | 2804 rvh->OnWebkitPreferencesChanged(); |
| 2809 } | 2805 } |
| 2810 } | 2806 } |
| 2811 | 2807 |
| 2812 } // namespace content | 2808 } // namespace content |
| OLD | NEW |