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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 317 |
318 // In single process the single process is all there is. | 318 // In single process the single process is all there is. |
319 suspend_webkit_shared_timer_ = true; | 319 suspend_webkit_shared_timer_ = true; |
320 notify_webkit_of_modal_loop_ = true; | 320 notify_webkit_of_modal_loop_ = true; |
321 widget_count_ = 0; | 321 widget_count_ = 0; |
322 hidden_widget_count_ = 0; | 322 hidden_widget_count_ = 0; |
323 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; | 323 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; |
324 idle_notifications_to_skip_ = 0; | 324 idle_notifications_to_skip_ = 0; |
325 should_send_focus_ipcs_ = true; | 325 should_send_focus_ipcs_ = true; |
326 short_circuit_size_updates_ = false; | 326 short_circuit_size_updates_ = false; |
327 compositor_initialized_ = false; | |
328 | 327 |
329 appcache_dispatcher_.reset(new AppCacheDispatcher(Get())); | 328 appcache_dispatcher_.reset(new AppCacheDispatcher(Get())); |
330 dom_storage_dispatcher_.reset(new DomStorageDispatcher()); | 329 dom_storage_dispatcher_.reset(new DomStorageDispatcher()); |
331 main_thread_indexed_db_dispatcher_.reset(new IndexedDBDispatcher()); | 330 main_thread_indexed_db_dispatcher_.reset(new IndexedDBDispatcher()); |
332 | 331 |
333 media_stream_center_ = NULL; | 332 media_stream_center_ = NULL; |
334 | 333 |
335 db_message_filter_ = new DBMessageFilter(); | 334 db_message_filter_ = new DBMessageFilter(); |
336 AddFilter(db_message_filter_.get()); | 335 AddFilter(db_message_filter_.get()); |
337 | 336 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 403 |
405 // Shutdown the file thread if it's running. | 404 // Shutdown the file thread if it's running. |
406 if (file_thread_.get()) | 405 if (file_thread_.get()) |
407 file_thread_->Stop(); | 406 file_thread_->Stop(); |
408 | 407 |
409 if (compositor_output_surface_filter_.get()) { | 408 if (compositor_output_surface_filter_.get()) { |
410 RemoveFilter(compositor_output_surface_filter_.get()); | 409 RemoveFilter(compositor_output_surface_filter_.get()); |
411 compositor_output_surface_filter_ = NULL; | 410 compositor_output_surface_filter_ = NULL; |
412 } | 411 } |
413 | 412 |
414 if (compositor_initialized_) { | |
415 WebKit::Platform::current()->compositorSupport()->shutdown(); | |
416 compositor_initialized_ = false; | |
417 } | |
418 if (compositor_thread_.get()) { | 413 if (compositor_thread_.get()) { |
419 RemoveFilter(compositor_thread_->GetMessageFilter()); | 414 RemoveFilter(compositor_thread_->GetMessageFilter()); |
420 compositor_thread_.reset(); | 415 compositor_thread_.reset(); |
421 } | 416 } |
422 | 417 |
423 if (webkit_platform_support_.get()) | 418 if (webkit_platform_support_.get()) |
424 WebKit::shutdown(); | 419 WebKit::shutdown(); |
425 | 420 |
426 lazy_tls.Pointer()->Set(NULL); | 421 lazy_tls.Pointer()->Set(NULL); |
427 | 422 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 if (webkit_platform_support_.get()) | 589 if (webkit_platform_support_.get()) |
595 return; | 590 return; |
596 | 591 |
597 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); | 592 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); |
598 WebKit::initialize(webkit_platform_support_.get()); | 593 WebKit::initialize(webkit_platform_support_.get()); |
599 WebKit::setSharedWorkerRepository( | 594 WebKit::setSharedWorkerRepository( |
600 webkit_platform_support_.get()->sharedWorkerRepository()); | 595 webkit_platform_support_.get()->sharedWorkerRepository()); |
601 WebKit::setIDBFactory( | 596 WebKit::setIDBFactory( |
602 webkit_platform_support_.get()->idbFactory()); | 597 webkit_platform_support_.get()->idbFactory()); |
603 | 598 |
604 WebKit::WebCompositorSupport* compositor_support = | |
605 WebKit::Platform::current()->compositorSupport(); | |
606 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 599 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
607 | 600 |
608 bool enable = command_line.HasSwitch(switches::kEnableThreadedCompositing); | 601 bool enable = command_line.HasSwitch(switches::kEnableThreadedCompositing); |
609 if (enable) { | 602 if (enable) { |
610 compositor_thread_.reset(new CompositorThread(this)); | 603 compositor_thread_.reset(new CompositorThread(this)); |
611 AddFilter(compositor_thread_->GetMessageFilter()); | 604 AddFilter(compositor_thread_->GetMessageFilter()); |
612 compositor_support->initialize(compositor_thread_->GetWebThread()); | |
613 } else { | |
614 compositor_support->initialize(NULL); | |
615 } | 605 } |
616 compositor_initialized_ = true; | |
617 | 606 |
618 MessageLoop* output_surface_loop = enable ? | 607 base::MessageLoopProxy* output_surface_loop; |
619 compositor_thread_->message_loop() : | 608 if (enable) |
620 MessageLoop::current(); | 609 output_surface_loop = compositor_thread_->message_loop_proxy(); |
| 610 else |
| 611 output_surface_loop = base::MessageLoopProxy::current(); |
621 | 612 |
622 compositor_output_surface_filter_ = CompositorOutputSurface::CreateFilter( | 613 compositor_output_surface_filter_ = |
623 output_surface_loop->message_loop_proxy()); | 614 CompositorOutputSurface::CreateFilter(output_surface_loop); |
624 AddFilter(compositor_output_surface_filter_.get()); | 615 AddFilter(compositor_output_surface_filter_.get()); |
625 | 616 |
626 WebScriptController::enableV8SingleThreadMode(); | 617 WebScriptController::enableV8SingleThreadMode(); |
627 | 618 |
628 RenderThreadImpl::RegisterSchemes(); | 619 RenderThreadImpl::RegisterSchemes(); |
629 | 620 |
630 webkit_glue::EnableWebCoreLogChannels( | 621 webkit_glue::EnableWebCoreLogChannels( |
631 command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels)); | 622 command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels)); |
632 | 623 |
633 web_database_observer_impl_.reset( | 624 web_database_observer_impl_.reset( |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 idle_notifications_to_skip_ = 2; | 871 idle_notifications_to_skip_ = 2; |
881 } | 872 } |
882 | 873 |
883 /* static */ | 874 /* static */ |
884 void RenderThreadImpl::OnGpuVDAContextLoss() { | 875 void RenderThreadImpl::OnGpuVDAContextLoss() { |
885 RenderThreadImpl* self = RenderThreadImpl::current(); | 876 RenderThreadImpl* self = RenderThreadImpl::current(); |
886 DCHECK(self); | 877 DCHECK(self); |
887 if (!self->gpu_vda_context3d_.get()) | 878 if (!self->gpu_vda_context3d_.get()) |
888 return; | 879 return; |
889 if (self->compositor_thread()) { | 880 if (self->compositor_thread()) { |
890 self->compositor_thread()->GetWebThread()->message_loop()->DeleteSoon( | 881 self->compositor_thread()->message_loop_proxy()->DeleteSoon( |
891 FROM_HERE, self->gpu_vda_context3d_.release()); | 882 FROM_HERE, self->gpu_vda_context3d_.release()); |
892 } else { | 883 } else { |
893 self->gpu_vda_context3d_.reset(); | 884 self->gpu_vda_context3d_.reset(); |
894 } | 885 } |
895 } | 886 } |
896 | 887 |
897 WebGraphicsContext3DCommandBufferImpl* | 888 WebGraphicsContext3DCommandBufferImpl* |
898 RenderThreadImpl::GetGpuVDAContext3D() { | 889 RenderThreadImpl::GetGpuVDAContext3D() { |
899 if (!gpu_vda_context3d_.get()) { | 890 if (!gpu_vda_context3d_.get()) { |
900 gpu_vda_context3d_.reset( | 891 gpu_vda_context3d_.reset( |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 | 1241 |
1251 void RenderThreadImpl::SetFlingCurveParameters( | 1242 void RenderThreadImpl::SetFlingCurveParameters( |
1252 const std::vector<float>& new_touchpad, | 1243 const std::vector<float>& new_touchpad, |
1253 const std::vector<float>& new_touchscreen) { | 1244 const std::vector<float>& new_touchscreen) { |
1254 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, | 1245 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, |
1255 new_touchscreen); | 1246 new_touchscreen); |
1256 | 1247 |
1257 } | 1248 } |
1258 | 1249 |
1259 } // namespace content | 1250 } // namespace content |
OLD | NEW |