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

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

Issue 216473002: Replace DCHECK(BrowserThread::CurrentlyOn) with DCHECK_CURRENTLY_ON in content/browser/renderer_hos… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to r260263 Created 6 years, 8 months 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 GetRequestContext(request_context, media_request_context, 203 GetRequestContext(request_context, media_request_context,
204 request.resource_type); 204 request.resource_type);
205 } 205 }
206 206
207 #if defined(ENABLE_WEBRTC) 207 #if defined(ENABLE_WEBRTC)
208 // Creates a file used for diagnostic echo canceller recordings for handing 208 // Creates a file used for diagnostic echo canceller recordings for handing
209 // over to the renderer. 209 // over to the renderer.
210 IPC::PlatformFileForTransit CreateAecDumpFileForProcess( 210 IPC::PlatformFileForTransit CreateAecDumpFileForProcess(
211 base::FilePath file_path, 211 base::FilePath file_path,
212 base::ProcessHandle process) { 212 base::ProcessHandle process) {
213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 213 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
214 base::PlatformFileError error = base::PLATFORM_FILE_OK; 214 base::PlatformFileError error = base::PLATFORM_FILE_OK;
215 base::PlatformFile aec_dump_file = base::CreatePlatformFile( 215 base::PlatformFile aec_dump_file = base::CreatePlatformFile(
216 file_path, 216 file_path,
217 base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_APPEND, 217 base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_APPEND,
218 NULL, 218 NULL,
219 &error); 219 &error);
220 if (error != base::PLATFORM_FILE_OK) { 220 if (error != base::PLATFORM_FILE_OK) {
221 VLOG(1) << "Could not open AEC dump file, error=" << error; 221 VLOG(1) << "Could not open AEC dump file, error=" << error;
222 return IPC::InvalidPlatformFileForTransit(); 222 return IPC::InvalidPlatformFileForTransit();
223 } 223 }
224 return IPC::GetFileHandleForProcess(aec_dump_file, process, true); 224 return IPC::GetFileHandleForProcess(aec_dump_file, process, true);
225 } 225 }
226 226
227 // Does nothing. Just to avoid races between enable and disable. 227 // Does nothing. Just to avoid races between enable and disable.
228 void DisableAecDumpOnFileThread() { 228 void DisableAecDumpOnFileThread() {
229 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 229 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
230 } 230 }
231 #endif 231 #endif
232 232
233 // the global list of all renderer processes 233 // the global list of all renderer processes
234 base::LazyInstance<IDMap<RenderProcessHost> >::Leaky 234 base::LazyInstance<IDMap<RenderProcessHost> >::Leaky
235 g_all_hosts = LAZY_INSTANCE_INITIALIZER; 235 g_all_hosts = LAZY_INSTANCE_INITIALIZER;
236 236
237 base::LazyInstance<scoped_refptr<BrowserPluginGeolocationPermissionContext> > 237 base::LazyInstance<scoped_refptr<BrowserPluginGeolocationPermissionContext> >
238 g_browser_plugin_geolocation_context = LAZY_INSTANCE_INITIALIZER; 238 g_browser_plugin_geolocation_context = LAZY_INSTANCE_INITIALIZER;
239 239
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 if (!gpu_observer_registered_) { 607 if (!gpu_observer_registered_) {
608 gpu_observer_registered_ = true; 608 gpu_observer_registered_ = true;
609 GpuDataManagerImpl::GetInstance()->AddObserver(this); 609 GpuDataManagerImpl::GetInstance()->AddObserver(this);
610 } 610 }
611 611
612 is_initialized_ = true; 612 is_initialized_ = true;
613 return true; 613 return true;
614 } 614 }
615 615
616 void RenderProcessHostImpl::CreateMessageFilters() { 616 void RenderProcessHostImpl::CreateMessageFilters() {
617 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 617 DCHECK_CURRENTLY_ON(BrowserThread::UI);
618 AddFilter(new ResourceSchedulerFilter(GetID())); 618 AddFilter(new ResourceSchedulerFilter(GetID()));
619 MediaInternals* media_internals = MediaInternals::GetInstance(); 619 MediaInternals* media_internals = MediaInternals::GetInstance();
620 media::AudioManager* audio_manager = 620 media::AudioManager* audio_manager =
621 BrowserMainLoop::GetInstance()->audio_manager(); 621 BrowserMainLoop::GetInstance()->audio_manager();
622 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages 622 // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages
623 // from guests. 623 // from guests.
624 if (supports_browser_plugin_) { 624 if (supports_browser_plugin_) {
625 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter( 625 scoped_refptr<BrowserPluginMessageFilter> bp_message_filter(
626 new BrowserPluginMessageFilter(GetID(), IsGuest())); 626 new BrowserPluginMessageFilter(GetID(), IsGuest()));
627 AddFilter(bp_message_filter.get()); 627 AddFilter(bp_message_filter.get());
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 void RenderProcessHostImpl::ResumeRequestsForView(int route_id) { 1562 void RenderProcessHostImpl::ResumeRequestsForView(int route_id) {
1563 widget_helper_->ResumeRequestsForView(route_id); 1563 widget_helper_->ResumeRequestsForView(route_id);
1564 } 1564 }
1565 1565
1566 void RenderProcessHostImpl::FilterURL(bool empty_allowed, GURL* url) { 1566 void RenderProcessHostImpl::FilterURL(bool empty_allowed, GURL* url) {
1567 FilterURL(this, empty_allowed, url); 1567 FilterURL(this, empty_allowed, url);
1568 } 1568 }
1569 1569
1570 #if defined(ENABLE_WEBRTC) 1570 #if defined(ENABLE_WEBRTC)
1571 void RenderProcessHostImpl::EnableAecDump(const base::FilePath& file) { 1571 void RenderProcessHostImpl::EnableAecDump(const base::FilePath& file) {
1572 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1572 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1573 BrowserThread::PostTaskAndReplyWithResult( 1573 BrowserThread::PostTaskAndReplyWithResult(
1574 BrowserThread::FILE, FROM_HERE, 1574 BrowserThread::FILE, FROM_HERE,
1575 base::Bind(&CreateAecDumpFileForProcess, file, GetHandle()), 1575 base::Bind(&CreateAecDumpFileForProcess, file, GetHandle()),
1576 base::Bind(&RenderProcessHostImpl::SendAecDumpFileToRenderer, 1576 base::Bind(&RenderProcessHostImpl::SendAecDumpFileToRenderer,
1577 weak_factory_.GetWeakPtr())); 1577 weak_factory_.GetWeakPtr()));
1578 } 1578 }
1579 1579
1580 void RenderProcessHostImpl::DisableAecDump() { 1580 void RenderProcessHostImpl::DisableAecDump() {
1581 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1581 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1582 // Posting on the FILE thread and then replying back on the UI thread is only 1582 // Posting on the FILE thread and then replying back on the UI thread is only
1583 // for avoiding races between enable and disable. Nothing is done on the FILE 1583 // for avoiding races between enable and disable. Nothing is done on the FILE
1584 // thread. 1584 // thread.
1585 BrowserThread::PostTaskAndReply( 1585 BrowserThread::PostTaskAndReply(
1586 BrowserThread::FILE, FROM_HERE, 1586 BrowserThread::FILE, FROM_HERE,
1587 base::Bind(&DisableAecDumpOnFileThread), 1587 base::Bind(&DisableAecDumpOnFileThread),
1588 base::Bind(&RenderProcessHostImpl::SendDisableAecDumpToRenderer, 1588 base::Bind(&RenderProcessHostImpl::SendDisableAecDumpToRenderer,
1589 weak_factory_.GetWeakPtr())); 1589 weak_factory_.GetWeakPtr()));
1590 } 1590 }
1591 1591
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 } 1737 }
1738 // TODO(piman): we should really send configuration through bools rather 1738 // TODO(piman): we should really send configuration through bools rather
1739 // than by parsing strings, i.e. sending an IPC rather than command line 1739 // than by parsing strings, i.e. sending an IPC rather than command line
1740 // args. crbug.com/314909 1740 // args. crbug.com/314909
1741 AppendGpuCommandLineFlags(command_line); 1741 AppendGpuCommandLineFlags(command_line);
1742 } 1742 }
1743 } 1743 }
1744 1744
1745 // static 1745 // static
1746 RenderProcessHost::iterator RenderProcessHost::AllHostsIterator() { 1746 RenderProcessHost::iterator RenderProcessHost::AllHostsIterator() {
1747 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1747 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1748 return iterator(g_all_hosts.Pointer()); 1748 return iterator(g_all_hosts.Pointer());
1749 } 1749 }
1750 1750
1751 // static 1751 // static
1752 RenderProcessHost* RenderProcessHost::FromID(int render_process_id) { 1752 RenderProcessHost* RenderProcessHost::FromID(int render_process_id) {
1753 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1753 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1754 return g_all_hosts.Get().Lookup(render_process_id); 1754 return g_all_hosts.Get().Lookup(render_process_id);
1755 } 1755 }
1756 1756
1757 // static 1757 // static
1758 bool RenderProcessHost::ShouldTryToUseExistingProcessHost( 1758 bool RenderProcessHost::ShouldTryToUseExistingProcessHost(
1759 BrowserContext* browser_context, const GURL& url) { 1759 BrowserContext* browser_context, const GURL& url) {
1760 // Experimental: 1760 // Experimental:
1761 // If --enable-strict-site-isolation or --site-per-process is enabled, do not 1761 // If --enable-strict-site-isolation or --site-per-process is enabled, do not
1762 // try to reuse renderer processes when over the limit. (We could allow pages 1762 // try to reuse renderer processes when over the limit. (We could allow pages
1763 // from the same site to share, if we knew what the given process was 1763 // from the same site to share, if we knew what the given process was
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 if (!gpu_message_filter_) 1973 if (!gpu_message_filter_)
1974 return; 1974 return;
1975 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( 1975 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(
1976 &GpuMessageFilter::EndFrameSubscription, 1976 &GpuMessageFilter::EndFrameSubscription,
1977 gpu_message_filter_, 1977 gpu_message_filter_,
1978 route_id)); 1978 route_id));
1979 } 1979 }
1980 1980
1981 #if defined(ENABLE_WEBRTC) 1981 #if defined(ENABLE_WEBRTC)
1982 void RenderProcessHostImpl::WebRtcLogMessage(const std::string& message) { 1982 void RenderProcessHostImpl::WebRtcLogMessage(const std::string& message) {
1983 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1983 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1984 if (!webrtc_log_message_callback_.is_null()) 1984 if (!webrtc_log_message_callback_.is_null())
1985 webrtc_log_message_callback_.Run(message); 1985 webrtc_log_message_callback_.Run(message);
1986 } 1986 }
1987 #endif 1987 #endif
1988 1988
1989 scoped_refptr<ScreenOrientationDispatcherHost> 1989 scoped_refptr<ScreenOrientationDispatcherHost>
1990 RenderProcessHostImpl::screen_orientation_dispatcher_host() const { 1990 RenderProcessHostImpl::screen_orientation_dispatcher_host() const {
1991 return make_scoped_refptr(screen_orientation_dispatcher_host_); 1991 return make_scoped_refptr(screen_orientation_dispatcher_host_);
1992 } 1992 }
1993 1993
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 return; 2136 return;
2137 Send(new MediaStreamMsg_EnableAecDump(file_for_transit)); 2137 Send(new MediaStreamMsg_EnableAecDump(file_for_transit));
2138 } 2138 }
2139 2139
2140 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() { 2140 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() {
2141 Send(new MediaStreamMsg_DisableAecDump()); 2141 Send(new MediaStreamMsg_DisableAecDump());
2142 } 2142 }
2143 #endif 2143 #endif
2144 2144
2145 void RenderProcessHostImpl::IncrementWorkerRefCount() { 2145 void RenderProcessHostImpl::IncrementWorkerRefCount() {
2146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2146 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2147 ++worker_ref_count_; 2147 ++worker_ref_count_;
2148 } 2148 }
2149 2149
2150 void RenderProcessHostImpl::DecrementWorkerRefCount() { 2150 void RenderProcessHostImpl::DecrementWorkerRefCount() {
2151 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2151 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2152 DCHECK_GT(worker_ref_count_, 0); 2152 DCHECK_GT(worker_ref_count_, 0);
2153 --worker_ref_count_; 2153 --worker_ref_count_;
2154 if (worker_ref_count_ == 0) 2154 if (worker_ref_count_ == 0)
2155 Cleanup(); 2155 Cleanup();
2156 } 2156 }
2157 2157
2158 #if defined(USE_MOJO) 2158 #if defined(USE_MOJO)
2159 void RenderProcessHostImpl::SetWebUIHandle( 2159 void RenderProcessHostImpl::SetWebUIHandle(
2160 int32 view_routing_id, 2160 int32 view_routing_id,
2161 mojo::ScopedMessagePipeHandle handle) { 2161 mojo::ScopedMessagePipeHandle handle) {
2162 if (!render_process_host_mojo_) 2162 if (!render_process_host_mojo_)
2163 render_process_host_mojo_.reset(new RenderProcessHostMojoImpl(this)); 2163 render_process_host_mojo_.reset(new RenderProcessHostMojoImpl(this));
2164 render_process_host_mojo_->SetWebUIHandle(view_routing_id, handle.Pass()); 2164 render_process_host_mojo_->SetWebUIHandle(view_routing_id, handle.Pass());
2165 } 2165 }
2166 #endif 2166 #endif
2167 2167
2168 } // namespace content 2168 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_message_filter.cc ('k') | content/browser/renderer_host/render_view_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698