| OLD | NEW |
| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 widget_count_ = 0; | 205 widget_count_ = 0; |
| 206 hidden_widget_count_ = 0; | 206 hidden_widget_count_ = 0; |
| 207 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; | 207 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; |
| 208 idle_notifications_to_skip_ = 0; | 208 idle_notifications_to_skip_ = 0; |
| 209 compositor_initialized_ = false; | 209 compositor_initialized_ = false; |
| 210 | 210 |
| 211 appcache_dispatcher_.reset(new AppCacheDispatcher(Get())); | 211 appcache_dispatcher_.reset(new AppCacheDispatcher(Get())); |
| 212 dom_storage_dispatcher_.reset(new DomStorageDispatcher()); | 212 dom_storage_dispatcher_.reset(new DomStorageDispatcher()); |
| 213 main_thread_indexed_db_dispatcher_.reset(new IndexedDBDispatcher()); | 213 main_thread_indexed_db_dispatcher_.reset(new IndexedDBDispatcher()); |
| 214 | 214 |
| 215 browser_plugin_registry_.reset(new content::BrowserPluginRegistry()); |
| 216 channel_manager_ = new content::BrowserPluginChannelManager(); |
| 217 AddObserver(channel_manager_.get()); |
| 218 |
| 215 media_stream_center_ = NULL; | 219 media_stream_center_ = NULL; |
| 216 | 220 |
| 217 db_message_filter_ = new DBMessageFilter(); | 221 db_message_filter_ = new DBMessageFilter(); |
| 218 AddFilter(db_message_filter_.get()); | 222 AddFilter(db_message_filter_.get()); |
| 219 | 223 |
| 220 vc_manager_ = new VideoCaptureImplManager(); | 224 vc_manager_ = new VideoCaptureImplManager(); |
| 221 AddFilter(vc_manager_->video_capture_message_filter()); | 225 AddFilter(vc_manager_->video_capture_message_filter()); |
| 222 | 226 |
| 223 audio_input_message_filter_ = new AudioInputMessageFilter(); | 227 audio_input_message_filter_ = new AudioInputMessageFilter(); |
| 224 AddFilter(audio_input_message_filter_.get()); | 228 AddFilter(audio_input_message_filter_.get()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 audio_input_message_filter_ = NULL; | 263 audio_input_message_filter_ = NULL; |
| 260 | 264 |
| 261 RemoveFilter(audio_message_filter_.get()); | 265 RemoveFilter(audio_message_filter_.get()); |
| 262 audio_message_filter_ = NULL; | 266 audio_message_filter_ = NULL; |
| 263 | 267 |
| 264 RemoveFilter(vc_manager_->video_capture_message_filter()); | 268 RemoveFilter(vc_manager_->video_capture_message_filter()); |
| 265 | 269 |
| 266 RemoveFilter(db_message_filter_.get()); | 270 RemoveFilter(db_message_filter_.get()); |
| 267 db_message_filter_ = NULL; | 271 db_message_filter_ = NULL; |
| 268 | 272 |
| 273 channel_manager_ = NULL; |
| 274 |
| 269 // Shutdown the file thread if it's running. | 275 // Shutdown the file thread if it's running. |
| 270 if (file_thread_.get()) | 276 if (file_thread_.get()) |
| 271 file_thread_->Stop(); | 277 file_thread_->Stop(); |
| 272 | 278 |
| 273 if (compositor_initialized_) { | 279 if (compositor_initialized_) { |
| 274 WebKit::WebCompositor::shutdown(); | 280 WebKit::WebCompositor::shutdown(); |
| 275 compositor_initialized_ = false; | 281 compositor_initialized_ = false; |
| 276 } | 282 } |
| 277 if (compositor_thread_.get()) { | 283 if (compositor_thread_.get()) { |
| 278 RemoveFilter(compositor_thread_->GetMessageFilter()); | 284 RemoveFilter(compositor_thread_->GetMessageFilter()); |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 ++it, ++i) { | 859 ++it, ++i) { |
| 854 color_names[i] = it->first; | 860 color_names[i] = it->first; |
| 855 web_colors[i] = it->second; | 861 web_colors[i] = it->second; |
| 856 } | 862 } |
| 857 WebKit::setNamedColors(color_names.get(), web_colors.get(), num_colors); | 863 WebKit::setNamedColors(color_names.get(), web_colors.get(), num_colors); |
| 858 } | 864 } |
| 859 | 865 |
| 860 void RenderThreadImpl::OnCreateNewView(const ViewMsg_New_Params& params) { | 866 void RenderThreadImpl::OnCreateNewView(const ViewMsg_New_Params& params) { |
| 861 EnsureWebKitInitialized(); | 867 EnsureWebKitInitialized(); |
| 862 // When bringing in render_view, also bring in webkit's glue and jsbindings. | 868 // When bringing in render_view, also bring in webkit's glue and jsbindings. |
| 863 RenderViewImpl::Create( | 869 if (!params.embedder_channel_name.empty()) |
| 864 params.parent_window, | 870 channel_manager_->CreateRenderView(params); |
| 865 params.opener_route_id, | 871 else |
| 866 params.renderer_preferences, | 872 RenderViewImpl::Create( |
| 867 params.web_preferences, | 873 params.parent_window, |
| 868 new SharedRenderViewCounter(0), | 874 params.opener_route_id, |
| 869 params.view_id, | 875 params.renderer_preferences, |
| 870 params.surface_id, | 876 params.web_preferences, |
| 871 params.session_storage_namespace_id, | 877 new SharedRenderViewCounter(0), |
| 872 params.frame_name, | 878 params.view_id, |
| 873 false, | 879 params.surface_id, |
| 874 params.swapped_out, | 880 params.session_storage_namespace_id, |
| 875 params.next_page_id, | 881 params.frame_name, |
| 876 params.screen_info, | 882 false, |
| 877 params.guest, | 883 params.swapped_out, |
| 878 params.accessibility_mode); | 884 params.next_page_id, |
| 885 params.screen_info, |
| 886 NULL, |
| 887 params.accessibility_mode); |
| 879 } | 888 } |
| 880 | 889 |
| 881 GpuChannelHost* RenderThreadImpl::EstablishGpuChannelSync( | 890 GpuChannelHost* RenderThreadImpl::EstablishGpuChannelSync( |
| 882 content::CauseForGpuLaunch cause_for_gpu_launch) { | 891 content::CauseForGpuLaunch cause_for_gpu_launch) { |
| 883 if (gpu_channel_.get()) { | 892 if (gpu_channel_.get()) { |
| 884 // Do nothing if we already have a GPU channel or are already | 893 // Do nothing if we already have a GPU channel or are already |
| 885 // establishing one. | 894 // establishing one. |
| 886 if (gpu_channel_->state() == GpuChannelHost::kUnconnected || | 895 if (gpu_channel_->state() == GpuChannelHost::kUnconnected || |
| 887 gpu_channel_->state() == GpuChannelHost::kConnected) | 896 gpu_channel_->state() == GpuChannelHost::kConnected) |
| 888 return GetGpuChannel(); | 897 return GetGpuChannel(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 | 975 |
| 967 scoped_refptr<base::MessageLoopProxy> | 976 scoped_refptr<base::MessageLoopProxy> |
| 968 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 977 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
| 969 DCHECK(message_loop() == MessageLoop::current()); | 978 DCHECK(message_loop() == MessageLoop::current()); |
| 970 if (!file_thread_.get()) { | 979 if (!file_thread_.get()) { |
| 971 file_thread_.reset(new base::Thread("Renderer::FILE")); | 980 file_thread_.reset(new base::Thread("Renderer::FILE")); |
| 972 file_thread_->Start(); | 981 file_thread_->Start(); |
| 973 } | 982 } |
| 974 return file_thread_->message_loop_proxy(); | 983 return file_thread_->message_loop_proxy(); |
| 975 } | 984 } |
| OLD | NEW |