Chromium Code Reviews| 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 315 ChildProcess::current()->set_main_thread(this); | 315 ChildProcess::current()->set_main_thread(this); |
| 316 | 316 |
| 317 // In single process the single process is all there is. | 317 // In single process the single process is all there is. |
| 318 suspend_webkit_shared_timer_ = true; | 318 suspend_webkit_shared_timer_ = true; |
| 319 notify_webkit_of_modal_loop_ = true; | 319 notify_webkit_of_modal_loop_ = true; |
| 320 widget_count_ = 0; | 320 widget_count_ = 0; |
| 321 hidden_widget_count_ = 0; | 321 hidden_widget_count_ = 0; |
| 322 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; | 322 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; |
| 323 idle_notifications_to_skip_ = 0; | 323 idle_notifications_to_skip_ = 0; |
| 324 require_user_gesture_for_focus_ = true; | 324 require_user_gesture_for_focus_ = true; |
| 325 compositor_initialized_ = false; | |
| 326 | 325 |
| 327 appcache_dispatcher_.reset(new AppCacheDispatcher(Get())); | 326 appcache_dispatcher_.reset(new AppCacheDispatcher(Get())); |
| 328 dom_storage_dispatcher_.reset(new DomStorageDispatcher()); | 327 dom_storage_dispatcher_.reset(new DomStorageDispatcher()); |
| 329 main_thread_indexed_db_dispatcher_.reset(new IndexedDBDispatcher()); | 328 main_thread_indexed_db_dispatcher_.reset(new IndexedDBDispatcher()); |
| 330 | 329 |
| 331 media_stream_center_ = NULL; | 330 media_stream_center_ = NULL; |
| 332 | 331 |
| 333 db_message_filter_ = new DBMessageFilter(); | 332 db_message_filter_ = new DBMessageFilter(); |
| 334 AddFilter(db_message_filter_.get()); | 333 AddFilter(db_message_filter_.get()); |
| 335 | 334 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 | 401 |
| 403 // Shutdown the file thread if it's running. | 402 // Shutdown the file thread if it's running. |
| 404 if (file_thread_.get()) | 403 if (file_thread_.get()) |
| 405 file_thread_->Stop(); | 404 file_thread_->Stop(); |
| 406 | 405 |
| 407 if (compositor_output_surface_filter_.get()) { | 406 if (compositor_output_surface_filter_.get()) { |
| 408 RemoveFilter(compositor_output_surface_filter_.get()); | 407 RemoveFilter(compositor_output_surface_filter_.get()); |
| 409 compositor_output_surface_filter_ = NULL; | 408 compositor_output_surface_filter_ = NULL; |
| 410 } | 409 } |
| 411 | 410 |
| 412 if (compositor_initialized_) { | |
| 413 WebKit::Platform::current()->compositorSupport()->shutdown(); | |
| 414 compositor_initialized_ = false; | |
| 415 } | |
| 416 if (compositor_thread_.get()) { | 411 if (compositor_thread_.get()) { |
| 417 RemoveFilter(compositor_thread_->GetMessageFilter()); | 412 RemoveFilter(compositor_thread_->GetMessageFilter()); |
| 418 compositor_thread_.reset(); | 413 compositor_thread_.reset(); |
| 419 } | 414 } |
| 420 | 415 |
| 421 if (webkit_platform_support_.get()) | 416 if (webkit_platform_support_.get()) |
| 422 WebKit::shutdown(); | 417 WebKit::shutdown(); |
| 423 | 418 |
| 424 lazy_tls.Pointer()->Set(NULL); | 419 lazy_tls.Pointer()->Set(NULL); |
| 425 | 420 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 592 if (webkit_platform_support_.get()) | 587 if (webkit_platform_support_.get()) |
| 593 return; | 588 return; |
| 594 | 589 |
| 595 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); | 590 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); |
| 596 WebKit::initialize(webkit_platform_support_.get()); | 591 WebKit::initialize(webkit_platform_support_.get()); |
| 597 WebKit::setSharedWorkerRepository( | 592 WebKit::setSharedWorkerRepository( |
| 598 webkit_platform_support_.get()->sharedWorkerRepository()); | 593 webkit_platform_support_.get()->sharedWorkerRepository()); |
| 599 WebKit::setIDBFactory( | 594 WebKit::setIDBFactory( |
| 600 webkit_platform_support_.get()->idbFactory()); | 595 webkit_platform_support_.get()->idbFactory()); |
| 601 | 596 |
| 602 WebKit::WebCompositorSupport* compositor_support = | |
| 603 WebKit::Platform::current()->compositorSupport(); | |
| 604 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 597 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 605 | 598 |
| 606 bool enable = command_line.HasSwitch(switches::kEnableThreadedCompositing); | 599 bool enable = command_line.HasSwitch(switches::kEnableThreadedCompositing); |
| 607 if (enable) { | 600 if (enable) { |
| 608 compositor_thread_.reset(new CompositorThread(this)); | 601 compositor_thread_.reset(new CompositorThread(this)); |
| 609 AddFilter(compositor_thread_->GetMessageFilter()); | 602 AddFilter(compositor_thread_->GetMessageFilter()); |
| 610 compositor_support->initialize(compositor_thread_->GetWebThread()); | |
|
boliu
2013/03/04 05:59:26
WebCompositorSupport::initialize is no longer call
| |
| 611 } else { | |
| 612 compositor_support->initialize(NULL); | |
| 613 } | 603 } |
| 614 compositor_initialized_ = true; | |
| 615 | 604 |
| 616 MessageLoop* output_surface_loop = enable ? | 605 base::MessageLoopProxy* output_surface_loop; |
| 617 compositor_thread_->message_loop() : | 606 if (enable) |
| 618 MessageLoop::current(); | 607 output_surface_loop = compositor_thread_->message_loop_proxy(); |
| 608 else | |
| 609 output_surface_loop = base::MessageLoopProxy::current(); | |
| 619 | 610 |
| 620 compositor_output_surface_filter_ = CompositorOutputSurface::CreateFilter( | 611 compositor_output_surface_filter_ = |
| 621 output_surface_loop->message_loop_proxy()); | 612 CompositorOutputSurface::CreateFilter(output_surface_loop); |
| 622 AddFilter(compositor_output_surface_filter_.get()); | 613 AddFilter(compositor_output_surface_filter_.get()); |
| 623 | 614 |
| 624 WebScriptController::enableV8SingleThreadMode(); | 615 WebScriptController::enableV8SingleThreadMode(); |
| 625 | 616 |
| 626 RenderThreadImpl::RegisterSchemes(); | 617 RenderThreadImpl::RegisterSchemes(); |
| 627 | 618 |
| 628 webkit_glue::EnableWebCoreLogChannels( | 619 webkit_glue::EnableWebCoreLogChannels( |
| 629 command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels)); | 620 command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels)); |
| 630 | 621 |
| 631 web_database_observer_impl_.reset( | 622 web_database_observer_impl_.reset( |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 878 idle_notifications_to_skip_ = 2; | 869 idle_notifications_to_skip_ = 2; |
| 879 } | 870 } |
| 880 | 871 |
| 881 /* static */ | 872 /* static */ |
| 882 void RenderThreadImpl::OnGpuVDAContextLoss() { | 873 void RenderThreadImpl::OnGpuVDAContextLoss() { |
| 883 RenderThreadImpl* self = RenderThreadImpl::current(); | 874 RenderThreadImpl* self = RenderThreadImpl::current(); |
| 884 DCHECK(self); | 875 DCHECK(self); |
| 885 if (!self->gpu_vda_context3d_.get()) | 876 if (!self->gpu_vda_context3d_.get()) |
| 886 return; | 877 return; |
| 887 if (self->compositor_thread()) { | 878 if (self->compositor_thread()) { |
| 888 self->compositor_thread()->GetWebThread()->message_loop()->DeleteSoon( | 879 self->compositor_thread()->message_loop_proxy()->DeleteSoon( |
| 889 FROM_HERE, self->gpu_vda_context3d_.release()); | 880 FROM_HERE, self->gpu_vda_context3d_.release()); |
| 890 } else { | 881 } else { |
| 891 self->gpu_vda_context3d_.reset(); | 882 self->gpu_vda_context3d_.reset(); |
| 892 } | 883 } |
| 893 } | 884 } |
| 894 | 885 |
| 895 WebGraphicsContext3DCommandBufferImpl* | 886 WebGraphicsContext3DCommandBufferImpl* |
| 896 RenderThreadImpl::GetGpuVDAContext3D() { | 887 RenderThreadImpl::GetGpuVDAContext3D() { |
| 897 if (!gpu_vda_context3d_.get()) { | 888 if (!gpu_vda_context3d_.get()) { |
| 898 gpu_vda_context3d_.reset( | 889 gpu_vda_context3d_.reset( |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1201 | 1192 |
| 1202 void RenderThreadImpl::SetFlingCurveParameters( | 1193 void RenderThreadImpl::SetFlingCurveParameters( |
| 1203 const std::vector<float>& new_touchpad, | 1194 const std::vector<float>& new_touchpad, |
| 1204 const std::vector<float>& new_touchscreen) { | 1195 const std::vector<float>& new_touchscreen) { |
| 1205 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, | 1196 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, |
| 1206 new_touchscreen); | 1197 new_touchscreen); |
| 1207 | 1198 |
| 1208 } | 1199 } |
| 1209 | 1200 |
| 1210 } // namespace content | 1201 } // namespace content |
| OLD | NEW |