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

Side by Side Diff: content/renderer/render_thread_impl.cc

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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
« no previous file with comments | « content/renderer/plugin_channel_host.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/renderer/render_thread_impl.h" 5 #include "content/renderer/render_thread_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 db_message_filter_ = new DBMessageFilter(); 366 db_message_filter_ = new DBMessageFilter();
367 AddFilter(db_message_filter_.get()); 367 AddFilter(db_message_filter_.get());
368 368
369 #if defined(ENABLE_WEBRTC) 369 #if defined(ENABLE_WEBRTC)
370 webrtc::SetupEventTracer(&GetCategoryGroupEnabled, &AddTraceEvent); 370 webrtc::SetupEventTracer(&GetCategoryGroupEnabled, &AddTraceEvent);
371 371
372 peer_connection_tracker_.reset(new PeerConnectionTracker()); 372 peer_connection_tracker_.reset(new PeerConnectionTracker());
373 AddObserver(peer_connection_tracker_.get()); 373 AddObserver(peer_connection_tracker_.get());
374 374
375 p2p_socket_dispatcher_ = new P2PSocketDispatcher(GetIOMessageLoopProxy()); 375 p2p_socket_dispatcher_ = new P2PSocketDispatcher(GetIOMessageLoopProxy());
376 AddFilter(p2p_socket_dispatcher_); 376 AddFilter(p2p_socket_dispatcher_.get());
377 #endif // defined(ENABLE_WEBRTC) 377 #endif // defined(ENABLE_WEBRTC)
378 vc_manager_ = new VideoCaptureImplManager(); 378 vc_manager_ = new VideoCaptureImplManager();
379 AddFilter(vc_manager_->video_capture_message_filter()); 379 AddFilter(vc_manager_->video_capture_message_filter());
380 380
381 audio_input_message_filter_ = 381 audio_input_message_filter_ =
382 new AudioInputMessageFilter(GetIOMessageLoopProxy()); 382 new AudioInputMessageFilter(GetIOMessageLoopProxy());
383 AddFilter(audio_input_message_filter_.get()); 383 AddFilter(audio_input_message_filter_.get());
384 384
385 audio_message_filter_ = new AudioMessageFilter(GetIOMessageLoopProxy()); 385 audio_message_filter_ = new AudioMessageFilter(GetIOMessageLoopProxy());
386 AddFilter(audio_message_filter_.get()); 386 AddFilter(audio_message_filter_.get());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 420
421 void RenderThreadImpl::Shutdown() { 421 void RenderThreadImpl::Shutdown() {
422 FOR_EACH_OBSERVER( 422 FOR_EACH_OBSERVER(
423 RenderProcessObserver, observers_, OnRenderProcessShutdown()); 423 RenderProcessObserver, observers_, OnRenderProcessShutdown());
424 424
425 // Wait for all databases to be closed. 425 // Wait for all databases to be closed.
426 if (web_database_observer_impl_) 426 if (web_database_observer_impl_)
427 web_database_observer_impl_->WaitForAllDatabasesToClose(); 427 web_database_observer_impl_->WaitForAllDatabasesToClose();
428 428
429 // Shutdown in reverse of the initialization order. 429 // Shutdown in reverse of the initialization order.
430 if (devtools_agent_message_filter_) { 430 if (devtools_agent_message_filter_.get()) {
431 RemoveFilter(devtools_agent_message_filter_.get()); 431 RemoveFilter(devtools_agent_message_filter_.get());
432 devtools_agent_message_filter_ = NULL; 432 devtools_agent_message_filter_ = NULL;
433 } 433 }
434 434
435 RemoveFilter(audio_input_message_filter_.get()); 435 RemoveFilter(audio_input_message_filter_.get());
436 audio_input_message_filter_ = NULL; 436 audio_input_message_filter_ = NULL;
437 437
438 RemoveFilter(audio_message_filter_.get()); 438 RemoveFilter(audio_message_filter_.get());
439 audio_message_filter_ = NULL; 439 audio_message_filter_ = NULL;
440 440
441 RemoveFilter(vc_manager_->video_capture_message_filter()); 441 RemoveFilter(vc_manager_->video_capture_message_filter());
442 442
443 RemoveFilter(db_message_filter_.get()); 443 RemoveFilter(db_message_filter_.get());
444 db_message_filter_ = NULL; 444 db_message_filter_ = NULL;
445 445
446 // Shutdown the file thread if it's running. 446 // Shutdown the file thread if it's running.
447 if (file_thread_) 447 if (file_thread_)
448 file_thread_->Stop(); 448 file_thread_->Stop();
449 449
450 if (compositor_output_surface_filter_) { 450 if (compositor_output_surface_filter_.get()) {
451 RemoveFilter(compositor_output_surface_filter_.get()); 451 RemoveFilter(compositor_output_surface_filter_.get());
452 compositor_output_surface_filter_ = NULL; 452 compositor_output_surface_filter_ = NULL;
453 } 453 }
454 454
455 compositor_thread_.reset(); 455 compositor_thread_.reset();
456 if (input_handler_manager_) { 456 if (input_handler_manager_) {
457 RemoveFilter(input_handler_manager_->GetMessageFilter()); 457 RemoveFilter(input_handler_manager_->GetMessageFilter());
458 input_handler_manager_.reset(); 458 input_handler_manager_.reset();
459 } 459 }
460 460
461 if (webkit_platform_support_) 461 if (webkit_platform_support_)
462 WebKit::shutdown(); 462 WebKit::shutdown();
463 463
464 lazy_tls.Pointer()->Set(NULL); 464 lazy_tls.Pointer()->Set(NULL);
465 465
466 // TODO(port) 466 // TODO(port)
467 #if defined(OS_WIN) 467 #if defined(OS_WIN)
468 // Clean up plugin channels before this thread goes away. 468 // Clean up plugin channels before this thread goes away.
469 NPChannelBase::CleanupChannels(); 469 NPChannelBase::CleanupChannels();
470 #endif 470 #endif
471 471
472 // Leak shared contexts on other threads, as we can not get to the correct 472 // Leak shared contexts on other threads, as we can not get to the correct
473 // thread to destroy them. 473 // thread to destroy them.
474 if (shared_contexts_compositor_thread_) 474 if (shared_contexts_compositor_thread_.get())
475 shared_contexts_compositor_thread_->set_leak_on_destroy(); 475 shared_contexts_compositor_thread_->set_leak_on_destroy();
476 } 476 }
477 477
478 bool RenderThreadImpl::Send(IPC::Message* msg) { 478 bool RenderThreadImpl::Send(IPC::Message* msg) {
479 // Certain synchronous messages cannot always be processed synchronously by 479 // Certain synchronous messages cannot always be processed synchronously by
480 // the browser, e.g., Chrome frame communicating with the embedding browser. 480 // the browser, e.g., Chrome frame communicating with the embedding browser.
481 // This could cause a complete hang of Chrome if a windowed plug-in is trying 481 // This could cause a complete hang of Chrome if a windowed plug-in is trying
482 // to communicate with the renderer thread since the browser's UI thread 482 // to communicate with the renderer thread since the browser's UI thread
483 // could be stuck (within a Windows API call) trying to synchronously 483 // could be stuck (within a Windows API call) trying to synchronously
484 // communicate with the plug-in. The remedy is to pump messages on this 484 // communicate with the plug-in. The remedy is to pump messages on this
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 AddFilter(input_handler_manager_->GetMessageFilter()); 770 AddFilter(input_handler_manager_->GetMessageFilter());
771 } 771 }
772 772
773 scoped_refptr<base::MessageLoopProxy> output_surface_loop; 773 scoped_refptr<base::MessageLoopProxy> output_surface_loop;
774 if (enable) 774 if (enable)
775 output_surface_loop = compositor_message_loop_proxy_; 775 output_surface_loop = compositor_message_loop_proxy_;
776 else 776 else
777 output_surface_loop = base::MessageLoopProxy::current(); 777 output_surface_loop = base::MessageLoopProxy::current();
778 778
779 compositor_output_surface_filter_ = 779 compositor_output_surface_filter_ =
780 CompositorOutputSurface::CreateFilter(output_surface_loop); 780 CompositorOutputSurface::CreateFilter(output_surface_loop.get());
781 AddFilter(compositor_output_surface_filter_.get()); 781 AddFilter(compositor_output_surface_filter_.get());
782 782
783 WebScriptController::enableV8SingleThreadMode(); 783 WebScriptController::enableV8SingleThreadMode();
784 784
785 RenderThreadImpl::RegisterSchemes(); 785 RenderThreadImpl::RegisterSchemes();
786 786
787 webkit_glue::EnableWebCoreLogChannels( 787 webkit_glue::EnableWebCoreLogChannels(
788 command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels)); 788 command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels));
789 789
790 web_database_observer_impl_.reset( 790 web_database_observer_impl_.reset(
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( 998 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
999 this, 999 this,
1000 attributes, 1000 attributes,
1001 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"))); 1001 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d")));
1002 } 1002 }
1003 1003
1004 scoped_refptr<ContextProviderCommandBuffer> 1004 scoped_refptr<ContextProviderCommandBuffer>
1005 RenderThreadImpl::OffscreenContextProviderForMainThread() { 1005 RenderThreadImpl::OffscreenContextProviderForMainThread() {
1006 DCHECK(IsMainThread()); 1006 DCHECK(IsMainThread());
1007 1007
1008 if (!shared_contexts_main_thread_ || 1008 if (!shared_contexts_main_thread_.get() ||
1009 shared_contexts_main_thread_->DestroyedOnMainThread()) { 1009 shared_contexts_main_thread_->DestroyedOnMainThread()) {
1010 shared_contexts_main_thread_ = 1010 shared_contexts_main_thread_ =
1011 RendererContextProviderCommandBuffer::Create(); 1011 RendererContextProviderCommandBuffer::Create();
1012 if (shared_contexts_main_thread_ && 1012 if (shared_contexts_main_thread_.get() &&
1013 !shared_contexts_main_thread_->BindToCurrentThread()) 1013 !shared_contexts_main_thread_->BindToCurrentThread())
1014 shared_contexts_main_thread_ = NULL; 1014 shared_contexts_main_thread_ = NULL;
1015 } 1015 }
1016 return shared_contexts_main_thread_; 1016 return shared_contexts_main_thread_;
1017 } 1017 }
1018 1018
1019 scoped_refptr<ContextProviderCommandBuffer> 1019 scoped_refptr<ContextProviderCommandBuffer>
1020 RenderThreadImpl::OffscreenContextProviderForCompositorThread() { 1020 RenderThreadImpl::OffscreenContextProviderForCompositorThread() {
1021 DCHECK(IsMainThread()); 1021 DCHECK(IsMainThread());
1022 1022
1023 if (!shared_contexts_compositor_thread_ || 1023 if (!shared_contexts_compositor_thread_.get() ||
1024 shared_contexts_compositor_thread_->DestroyedOnMainThread()) { 1024 shared_contexts_compositor_thread_->DestroyedOnMainThread()) {
1025 shared_contexts_compositor_thread_ = 1025 shared_contexts_compositor_thread_ =
1026 RendererContextProviderCommandBuffer::Create(); 1026 RendererContextProviderCommandBuffer::Create();
1027 } 1027 }
1028 return shared_contexts_compositor_thread_; 1028 return shared_contexts_compositor_thread_;
1029 } 1029 }
1030 1030
1031 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { 1031 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() {
1032 if (!audio_renderer_mixer_manager_) { 1032 if (!audio_renderer_mixer_manager_) {
1033 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager( 1033 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager(
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 params.next_page_id, 1203 params.next_page_id,
1204 params.screen_info, 1204 params.screen_info,
1205 params.accessibility_mode, 1205 params.accessibility_mode,
1206 params.allow_partial_swap); 1206 params.allow_partial_swap);
1207 } 1207 }
1208 1208
1209 GpuChannelHost* RenderThreadImpl::EstablishGpuChannelSync( 1209 GpuChannelHost* RenderThreadImpl::EstablishGpuChannelSync(
1210 CauseForGpuLaunch cause_for_gpu_launch) { 1210 CauseForGpuLaunch cause_for_gpu_launch) {
1211 TRACE_EVENT0("gpu", "RenderThreadImpl::EstablishGpuChannelSync"); 1211 TRACE_EVENT0("gpu", "RenderThreadImpl::EstablishGpuChannelSync");
1212 1212
1213 if (gpu_channel_) { 1213 if (gpu_channel_.get()) {
1214 // Do nothing if we already have a GPU channel or are already 1214 // Do nothing if we already have a GPU channel or are already
1215 // establishing one. 1215 // establishing one.
1216 if (gpu_channel_->state() == GpuChannelHost::kUnconnected || 1216 if (gpu_channel_->state() == GpuChannelHost::kUnconnected ||
1217 gpu_channel_->state() == GpuChannelHost::kConnected) 1217 gpu_channel_->state() == GpuChannelHost::kConnected)
1218 return GetGpuChannel(); 1218 return GetGpuChannel();
1219 1219
1220 // Recreate the channel if it has been lost. 1220 // Recreate the channel if it has been lost.
1221 gpu_channel_ = NULL; 1221 gpu_channel_ = NULL;
1222 } 1222 }
1223 1223
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 } 1267 }
1268 #endif 1268 #endif
1269 return media_stream_center_; 1269 return media_stream_center_;
1270 } 1270 }
1271 1271
1272 MediaStreamDependencyFactory* 1272 MediaStreamDependencyFactory*
1273 RenderThreadImpl::GetMediaStreamDependencyFactory() { 1273 RenderThreadImpl::GetMediaStreamDependencyFactory() {
1274 #if defined(ENABLE_WEBRTC) 1274 #if defined(ENABLE_WEBRTC)
1275 if (!media_stream_factory_) { 1275 if (!media_stream_factory_) {
1276 media_stream_factory_.reset(new MediaStreamDependencyFactory( 1276 media_stream_factory_.reset(new MediaStreamDependencyFactory(
1277 vc_manager_, p2p_socket_dispatcher_)); 1277 vc_manager_.get(), p2p_socket_dispatcher_.get()));
1278 } 1278 }
1279 #endif 1279 #endif
1280 return media_stream_factory_.get(); 1280 return media_stream_factory_.get();
1281 } 1281 }
1282 1282
1283 GpuChannelHost* RenderThreadImpl::GetGpuChannel() { 1283 GpuChannelHost* RenderThreadImpl::GetGpuChannel() {
1284 if (!gpu_channel_) 1284 if (!gpu_channel_.get())
1285 return NULL; 1285 return NULL;
1286 1286
1287 if (gpu_channel_->state() != GpuChannelHost::kConnected) 1287 if (gpu_channel_->state() != GpuChannelHost::kConnected)
1288 return NULL; 1288 return NULL;
1289 1289
1290 return gpu_channel_.get(); 1290 return gpu_channel_.get();
1291 } 1291 }
1292 1292
1293 void RenderThreadImpl::OnPurgePluginListCache(bool reload_pages) { 1293 void RenderThreadImpl::OnPurgePluginListCache(bool reload_pages) {
1294 EnsureWebKitInitialized(); 1294 EnsureWebKitInitialized();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 1329
1330 void RenderThreadImpl::SetFlingCurveParameters( 1330 void RenderThreadImpl::SetFlingCurveParameters(
1331 const std::vector<float>& new_touchpad, 1331 const std::vector<float>& new_touchpad,
1332 const std::vector<float>& new_touchscreen) { 1332 const std::vector<float>& new_touchscreen) {
1333 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, 1333 webkit_platform_support_->SetFlingCurveParameters(new_touchpad,
1334 new_touchscreen); 1334 new_touchscreen);
1335 1335
1336 } 1336 }
1337 1337
1338 } // namespace content 1338 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/plugin_channel_host.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698