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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 ResourceContext** resource_context_out, | 275 ResourceContext** resource_context_out, |
276 net::URLRequestContext** request_context_out) { | 276 net::URLRequestContext** request_context_out) { |
277 *resource_context_out = resource_context; | 277 *resource_context_out = resource_context; |
278 *request_context_out = | 278 *request_context_out = |
279 GetRequestContext(request_context, media_request_context, resource_type); | 279 GetRequestContext(request_context, media_request_context, resource_type); |
280 } | 280 } |
281 | 281 |
282 #if defined(ENABLE_WEBRTC) | 282 #if defined(ENABLE_WEBRTC) |
283 | 283 |
284 // Creates a file used for handing over to the renderer. | 284 // Creates a file used for handing over to the renderer. |
285 IPC::PlatformFileForTransit CreateFileForProcess(base::FilePath file_path, | 285 IPC::PlatformFileForTransit CreateFileForProcess(base::FilePath file_path) { |
286 base::ProcessHandle process) { | |
287 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 286 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
288 base::File dump_file(file_path, | 287 base::File dump_file(file_path, |
289 base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_APPEND); | 288 base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_APPEND); |
290 if (!dump_file.IsValid()) { | 289 if (!dump_file.IsValid()) { |
291 VLOG(1) << "Could not open AEC dump file, error=" | 290 VLOG(1) << "Could not open AEC dump file, error=" |
292 << dump_file.error_details(); | 291 << dump_file.error_details(); |
293 return IPC::InvalidPlatformFileForTransit(); | 292 return IPC::InvalidPlatformFileForTransit(); |
294 } | 293 } |
295 return IPC::TakeFileHandleForProcess(std::move(dump_file), process); | 294 return IPC::TakePlatformFileForTransit(std::move(dump_file)); |
296 } | 295 } |
297 | 296 |
298 // Allow us to only run the trial in the first renderer. | 297 // Allow us to only run the trial in the first renderer. |
299 bool has_done_stun_trials = false; | 298 bool has_done_stun_trials = false; |
300 | 299 |
301 #endif | 300 #endif |
302 | 301 |
303 // the global list of all renderer processes | 302 // the global list of all renderer processes |
304 base::LazyInstance<IDMap<RenderProcessHost>>::Leaky g_all_hosts = | 303 base::LazyInstance<IDMap<RenderProcessHost>>::Leaky g_all_hosts = |
305 LAZY_INSTANCE_INITIALIZER; | 304 LAZY_INSTANCE_INITIALIZER; |
(...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2707 break; | 2706 break; |
2708 } | 2707 } |
2709 } | 2708 } |
2710 } | 2709 } |
2711 | 2710 |
2712 void RenderProcessHostImpl::EnableAecDumpForId(const base::FilePath& file, | 2711 void RenderProcessHostImpl::EnableAecDumpForId(const base::FilePath& file, |
2713 int id) { | 2712 int id) { |
2714 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2713 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
2715 BrowserThread::PostTaskAndReplyWithResult( | 2714 BrowserThread::PostTaskAndReplyWithResult( |
2716 BrowserThread::FILE, FROM_HERE, | 2715 BrowserThread::FILE, FROM_HERE, |
2717 base::Bind(&CreateFileForProcess, file.AddExtension(IntToStringType(id)), | 2716 base::Bind(&CreateFileForProcess, file.AddExtension(IntToStringType(id))), |
2718 GetHandle()), | |
2719 base::Bind(&RenderProcessHostImpl::SendAecDumpFileToRenderer, | 2717 base::Bind(&RenderProcessHostImpl::SendAecDumpFileToRenderer, |
2720 weak_factory_.GetWeakPtr(), id)); | 2718 weak_factory_.GetWeakPtr(), id)); |
2721 } | 2719 } |
2722 | 2720 |
2723 void RenderProcessHostImpl::EnableEventLogForId(const base::FilePath& file, | 2721 void RenderProcessHostImpl::EnableEventLogForId(const base::FilePath& file, |
2724 int id) { | 2722 int id) { |
2725 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2723 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
2726 BrowserThread::PostTaskAndReplyWithResult( | 2724 BrowserThread::PostTaskAndReplyWithResult( |
2727 BrowserThread::FILE, FROM_HERE, | 2725 BrowserThread::FILE, FROM_HERE, |
2728 base::Bind(&CreateFileForProcess, file.AddExtension(IntToStringType(id)), | 2726 base::Bind(&CreateFileForProcess, file.AddExtension(IntToStringType(id))), |
2729 GetHandle()), | |
2730 base::Bind(&RenderProcessHostImpl::SendEventLogFileToRenderer, | 2727 base::Bind(&RenderProcessHostImpl::SendEventLogFileToRenderer, |
2731 weak_factory_.GetWeakPtr(), id)); | 2728 weak_factory_.GetWeakPtr(), id)); |
2732 } | 2729 } |
2733 | 2730 |
2734 void RenderProcessHostImpl::SendAecDumpFileToRenderer( | 2731 void RenderProcessHostImpl::SendAecDumpFileToRenderer( |
2735 int id, | 2732 int id, |
2736 IPC::PlatformFileForTransit file_for_transit) { | 2733 IPC::PlatformFileForTransit file_for_transit) { |
2737 if (file_for_transit == IPC::InvalidPlatformFileForTransit()) | 2734 if (file_for_transit == IPC::InvalidPlatformFileForTransit()) |
2738 return; | 2735 return; |
2739 Send(new AecDumpMsg_EnableAecDump(id, file_for_transit)); | 2736 Send(new AecDumpMsg_EnableAecDump(id, file_for_transit)); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2788 | 2785 |
2789 // Skip widgets in other processes. | 2786 // Skip widgets in other processes. |
2790 if (rvh->GetProcess()->GetID() != GetID()) | 2787 if (rvh->GetProcess()->GetID() != GetID()) |
2791 continue; | 2788 continue; |
2792 | 2789 |
2793 rvh->OnWebkitPreferencesChanged(); | 2790 rvh->OnWebkitPreferencesChanged(); |
2794 } | 2791 } |
2795 } | 2792 } |
2796 | 2793 |
2797 } // namespace content | 2794 } // namespace content |
OLD | NEW |