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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 101063003: Add browser test for AEC dump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added another test. Code changes to avoid race. Allow enable dump after PCF creation. Created 7 years 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 file_path, 207 file_path,
208 base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_WRITE, 208 base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_WRITE,
209 NULL, 209 NULL,
210 &error); 210 &error);
211 if (error != base::PLATFORM_FILE_OK) { 211 if (error != base::PLATFORM_FILE_OK) {
212 VLOG(1) << "Could not open AEC dump file, error=" << error; 212 VLOG(1) << "Could not open AEC dump file, error=" << error;
213 return IPC::InvalidPlatformFileForTransit(); 213 return IPC::InvalidPlatformFileForTransit();
214 } 214 }
215 return IPC::GetFileHandleForProcess(aec_dump_file, process, true); 215 return IPC::GetFileHandleForProcess(aec_dump_file, process, true);
216 } 216 }
217
218 // Does nothing. Just to avoid races between enable and disable.
219 void DisableAecDumpOnFileThread() {
220 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
221 }
222
217 #endif 223 #endif
218 224
219 // the global list of all renderer processes 225 // the global list of all renderer processes
220 base::LazyInstance<IDMap<RenderProcessHost> >::Leaky 226 base::LazyInstance<IDMap<RenderProcessHost> >::Leaky
221 g_all_hosts = LAZY_INSTANCE_INITIALIZER; 227 g_all_hosts = LAZY_INSTANCE_INITIALIZER;
222 228
223 base::LazyInstance<scoped_refptr<BrowserPluginGeolocationPermissionContext> > 229 base::LazyInstance<scoped_refptr<BrowserPluginGeolocationPermissionContext> >
224 g_browser_plugin_geolocation_context = LAZY_INSTANCE_INITIALIZER; 230 g_browser_plugin_geolocation_context = LAZY_INSTANCE_INITIALIZER;
225 231
226 // Map of site to process, to ensure we only have one RenderProcessHost per 232 // Map of site to process, to ensure we only have one RenderProcessHost per
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 #if defined(ENABLE_WEBRTC) 1515 #if defined(ENABLE_WEBRTC)
1510 void RenderProcessHostImpl::EnableAecDump(const base::FilePath& file) { 1516 void RenderProcessHostImpl::EnableAecDump(const base::FilePath& file) {
1511 BrowserThread::PostTaskAndReplyWithResult( 1517 BrowserThread::PostTaskAndReplyWithResult(
1512 BrowserThread::FILE, FROM_HERE, 1518 BrowserThread::FILE, FROM_HERE,
1513 base::Bind(&CreateAecDumpFileForProcess, file, GetHandle()), 1519 base::Bind(&CreateAecDumpFileForProcess, file, GetHandle()),
1514 base::Bind(&RenderProcessHostImpl::SendAecDumpFileToRenderer, 1520 base::Bind(&RenderProcessHostImpl::SendAecDumpFileToRenderer,
1515 weak_factory_.GetWeakPtr())); 1521 weak_factory_.GetWeakPtr()));
1516 } 1522 }
1517 1523
1518 void RenderProcessHostImpl::DisableAecDump() { 1524 void RenderProcessHostImpl::DisableAecDump() {
1519 Send(new MediaStreamMsg_DisableAecDump()); 1525 BrowserThread::PostTaskAndReply(
1526 BrowserThread::FILE, FROM_HERE,
1527 base::Bind(&DisableAecDumpOnFileThread),
phoglund_chromium 2013/12/18 14:20:46 So you queue something on the file thread just to
Henrik Grunell 2013/12/19 08:43:14 Exactly. I don't know if there's another way that'
phoglund_chromium 2013/12/19 11:57:04 I think it kind of makes sense. I can't think of a
1528 base::Bind(&RenderProcessHostImpl::SendDisableAecDumpToRenderer,
1529 weak_factory_.GetWeakPtr()));
1520 } 1530 }
1521 #endif 1531 #endif
1522 1532
1523 IPC::ChannelProxy* RenderProcessHostImpl::GetChannel() { 1533 IPC::ChannelProxy* RenderProcessHostImpl::GetChannel() {
1524 return channel_.get(); 1534 return channel_.get();
1525 } 1535 }
1526 1536
1527 void RenderProcessHostImpl::AddFilter(BrowserMessageFilter* filter) { 1537 void RenderProcessHostImpl::AddFilter(BrowserMessageFilter* filter) {
1528 channel_->AddFilter(filter->GetFilter()); 1538 channel_->AddFilter(filter->GetFilter());
1529 } 1539 }
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 } 1963 }
1954 } 1964 }
1955 1965
1956 #if defined(ENABLE_WEBRTC) 1966 #if defined(ENABLE_WEBRTC)
1957 void RenderProcessHostImpl::SendAecDumpFileToRenderer( 1967 void RenderProcessHostImpl::SendAecDumpFileToRenderer(
1958 IPC::PlatformFileForTransit file_for_transit) { 1968 IPC::PlatformFileForTransit file_for_transit) {
1959 if (file_for_transit == IPC::InvalidPlatformFileForTransit()) 1969 if (file_for_transit == IPC::InvalidPlatformFileForTransit())
1960 return; 1970 return;
1961 Send(new MediaStreamMsg_EnableAecDump(file_for_transit)); 1971 Send(new MediaStreamMsg_EnableAecDump(file_for_transit));
1962 } 1972 }
1973
1974 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() {
1975 Send(new MediaStreamMsg_DisableAecDump());
1976 }
1963 #endif 1977 #endif
1964 1978
1965 } // namespace content 1979 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698