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

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: Don't check return value of DeleteFile. 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 // Posting on the FILE thread and then replying back on the UI thread is only
1526 // for avoiding races between enable and disable. Nothing is done on the FILE
1527 // thread.
1528 BrowserThread::PostTaskAndReply(
1529 BrowserThread::FILE, FROM_HERE,
1530 base::Bind(&DisableAecDumpOnFileThread),
jochen (gone - plz use gerrit) 2013/12/19 12:41:06 would it be enough to create an empty base::Closur
Henrik Grunell 2013/12/19 13:46:10 Well, it just crashes for me. Is that supposed to
1531 base::Bind(&RenderProcessHostImpl::SendDisableAecDumpToRenderer,
1532 weak_factory_.GetWeakPtr()));
1520 } 1533 }
1521 #endif 1534 #endif
1522 1535
1523 IPC::ChannelProxy* RenderProcessHostImpl::GetChannel() { 1536 IPC::ChannelProxy* RenderProcessHostImpl::GetChannel() {
1524 return channel_.get(); 1537 return channel_.get();
1525 } 1538 }
1526 1539
1527 void RenderProcessHostImpl::AddFilter(BrowserMessageFilter* filter) { 1540 void RenderProcessHostImpl::AddFilter(BrowserMessageFilter* filter) {
1528 channel_->AddFilter(filter->GetFilter()); 1541 channel_->AddFilter(filter->GetFilter());
1529 } 1542 }
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 } 1970 }
1958 } 1971 }
1959 1972
1960 #if defined(ENABLE_WEBRTC) 1973 #if defined(ENABLE_WEBRTC)
1961 void RenderProcessHostImpl::SendAecDumpFileToRenderer( 1974 void RenderProcessHostImpl::SendAecDumpFileToRenderer(
1962 IPC::PlatformFileForTransit file_for_transit) { 1975 IPC::PlatformFileForTransit file_for_transit) {
1963 if (file_for_transit == IPC::InvalidPlatformFileForTransit()) 1976 if (file_for_transit == IPC::InvalidPlatformFileForTransit())
1964 return; 1977 return;
1965 Send(new MediaStreamMsg_EnableAecDump(file_for_transit)); 1978 Send(new MediaStreamMsg_EnableAecDump(file_for_transit));
1966 } 1979 }
1980
1981 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() {
1982 Send(new MediaStreamMsg_DisableAecDump());
1983 }
1967 #endif 1984 #endif
1968 1985
1969 } // namespace content 1986 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698