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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 // RemoveEmbeddedWorkerRoute may be called while deleting | 644 // RemoveEmbeddedWorkerRoute may be called while deleting |
645 // EmbeddedWorkerDispatcher. So it must be deleted before deleting | 645 // EmbeddedWorkerDispatcher. So it must be deleted before deleting |
646 // RenderThreadImpl. | 646 // RenderThreadImpl. |
647 embedded_worker_dispatcher_.reset(); | 647 embedded_worker_dispatcher_.reset(); |
648 | 648 |
649 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might | 649 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might |
650 // hold pointers to V8 objects (e.g., via pending requests). | 650 // hold pointers to V8 objects (e.g., via pending requests). |
651 main_thread_indexed_db_dispatcher_.reset(); | 651 main_thread_indexed_db_dispatcher_.reset(); |
652 | 652 |
653 main_thread_compositor_task_runner_ = NULL; | 653 main_thread_compositor_task_runner_ = NULL; |
654 main_thread_input_task_runner_ = NULL; | |
655 | 654 |
656 if (webkit_platform_support_) | 655 if (webkit_platform_support_) |
657 blink::shutdown(); | 656 blink::shutdown(); |
658 | 657 |
659 lazy_tls.Pointer()->Set(NULL); | 658 lazy_tls.Pointer()->Set(NULL); |
660 | 659 |
661 // TODO(port) | 660 // TODO(port) |
662 #if defined(OS_WIN) | 661 #if defined(OS_WIN) |
663 // Clean up plugin channels before this thread goes away. | 662 // Clean up plugin channels before this thread goes away. |
664 NPChannelBase::CleanupChannels(); | 663 NPChannelBase::CleanupChannels(); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 ResourceDispatcherDelegate* delegate) { | 827 ResourceDispatcherDelegate* delegate) { |
829 resource_dispatcher()->set_delegate(delegate); | 828 resource_dispatcher()->set_delegate(delegate); |
830 } | 829 } |
831 | 830 |
832 void RenderThreadImpl::EnsureWebKitInitialized() { | 831 void RenderThreadImpl::EnsureWebKitInitialized() { |
833 if (webkit_platform_support_) | 832 if (webkit_platform_support_) |
834 return; | 833 return; |
835 | 834 |
836 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); | 835 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); |
837 blink::initialize(webkit_platform_support_.get()); | 836 blink::initialize(webkit_platform_support_.get()); |
838 // TODO(skyostil): Forward compositor tasks to the Blink scheduler. | 837 main_thread_compositor_task_runner_ = |
839 main_thread_compositor_task_runner_ = base::MessageLoopProxy::current(); | 838 make_scoped_refptr(new SchedulerProxyTaskRunner< |
840 main_thread_input_task_runner_ = make_scoped_refptr( | 839 &blink::WebSchedulerProxy::postCompositorTask>()); |
841 new SchedulerProxyTaskRunner<&blink::WebSchedulerProxy::postInputTask>()); | |
842 | 840 |
843 v8::Isolate* isolate = blink::mainThreadIsolate(); | 841 v8::Isolate* isolate = blink::mainThreadIsolate(); |
844 | 842 |
845 isolate->SetCounterFunction(base::StatsTable::FindLocation); | 843 isolate->SetCounterFunction(base::StatsTable::FindLocation); |
846 isolate->SetCreateHistogramFunction(CreateHistogram); | 844 isolate->SetCreateHistogramFunction(CreateHistogram); |
847 isolate->SetAddHistogramSampleFunction(AddHistogramSample); | 845 isolate->SetAddHistogramSampleFunction(AddHistogramSample); |
848 | 846 |
849 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 847 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
850 | 848 |
851 bool enable = !command_line.HasSwitch(switches::kDisableThreadedCompositing); | 849 bool enable = !command_line.HasSwitch(switches::kDisableThreadedCompositing); |
(...skipping 19 matching lines...) Expand all Loading... |
871 } | 869 } |
872 | 870 |
873 InputHandlerManagerClient* input_handler_manager_client = NULL; | 871 InputHandlerManagerClient* input_handler_manager_client = NULL; |
874 #if defined(OS_ANDROID) | 872 #if defined(OS_ANDROID) |
875 if (SynchronousCompositorFactory* factory = | 873 if (SynchronousCompositorFactory* factory = |
876 SynchronousCompositorFactory::GetInstance()) { | 874 SynchronousCompositorFactory::GetInstance()) { |
877 input_handler_manager_client = factory->GetInputHandlerManagerClient(); | 875 input_handler_manager_client = factory->GetInputHandlerManagerClient(); |
878 } | 876 } |
879 #endif | 877 #endif |
880 if (!input_handler_manager_client) { | 878 if (!input_handler_manager_client) { |
881 input_event_filter_ = new InputEventFilter( | 879 input_event_filter_ = |
882 this, main_thread_input_task_runner_, compositor_message_loop_proxy_); | 880 new InputEventFilter(this, |
| 881 main_thread_compositor_task_runner_, |
| 882 compositor_message_loop_proxy_); |
883 AddFilter(input_event_filter_.get()); | 883 AddFilter(input_event_filter_.get()); |
884 input_handler_manager_client = input_event_filter_.get(); | 884 input_handler_manager_client = input_event_filter_.get(); |
885 } | 885 } |
886 input_handler_manager_.reset( | 886 input_handler_manager_.reset( |
887 new InputHandlerManager(compositor_message_loop_proxy_, | 887 new InputHandlerManager(compositor_message_loop_proxy_, |
888 input_handler_manager_client)); | 888 input_handler_manager_client)); |
889 } | 889 } |
890 | 890 |
891 scoped_refptr<base::MessageLoopProxy> output_surface_loop; | 891 scoped_refptr<base::MessageLoopProxy> output_surface_loop; |
892 if (enable) | 892 if (enable) |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 hidden_widget_count_--; | 1648 hidden_widget_count_--; |
1649 | 1649 |
1650 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1650 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
1651 return; | 1651 return; |
1652 } | 1652 } |
1653 | 1653 |
1654 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1654 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
1655 } | 1655 } |
1656 | 1656 |
1657 } // namespace content | 1657 } // namespace content |
OLD | NEW |