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

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

Issue 548333002: Revert of Revert of Forward input and compositing tasks to the Blink scheduler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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/render_thread_impl.h ('k') | content/renderer/scheduler_proxy_task_runner.h » ('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>
11 11
12 #include "base/allocator/allocator_extension.h" 12 #include "base/allocator/allocator_extension.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/debug/trace_event.h" 14 #include "base/debug/trace_event.h"
15 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/memory/discardable_memory.h" 17 #include "base/memory/discardable_memory.h"
18 #include "base/memory/discardable_memory_emulated.h" 18 #include "base/memory/discardable_memory_emulated.h"
19 #include "base/memory/shared_memory.h" 19 #include "base/memory/shared_memory.h"
20 #include "base/metrics/field_trial.h" 20 #include "base/metrics/field_trial.h"
21 #include "base/metrics/histogram.h" 21 #include "base/metrics/histogram.h"
22 #include "base/metrics/stats_table.h" 22 #include "base/metrics/stats_table.h"
23 #include "base/path_service.h" 23 #include "base/path_service.h"
24 #include "base/single_thread_task_runner.h"
24 #include "base/strings/string16.h" 25 #include "base/strings/string16.h"
25 #include "base/strings/string_number_conversions.h" 26 #include "base/strings/string_number_conversions.h"
26 #include "base/strings/string_tokenizer.h" 27 #include "base/strings/string_tokenizer.h"
27 #include "base/strings/utf_string_conversions.h" 28 #include "base/strings/utf_string_conversions.h"
28 #include "base/threading/thread_local.h" 29 #include "base/threading/thread_local.h"
29 #include "base/threading/thread_restrictions.h" 30 #include "base/threading/thread_restrictions.h"
30 #include "base/values.h" 31 #include "base/values.h"
31 #include "cc/base/switches.h" 32 #include "cc/base/switches.h"
32 #include "cc/blink/web_external_bitmap_impl.h" 33 #include "cc/blink/web_external_bitmap_impl.h"
33 #include "cc/blink/web_layer_impl.h" 34 #include "cc/blink/web_layer_impl.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #include "content/renderer/media/midi_message_filter.h" 85 #include "content/renderer/media/midi_message_filter.h"
85 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h" 86 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h"
86 #include "content/renderer/media/video_capture_impl_manager.h" 87 #include "content/renderer/media/video_capture_impl_manager.h"
87 #include "content/renderer/media/video_capture_message_filter.h" 88 #include "content/renderer/media/video_capture_message_filter.h"
88 #include "content/renderer/net_info_helper.h" 89 #include "content/renderer/net_info_helper.h"
89 #include "content/renderer/p2p/socket_dispatcher.h" 90 #include "content/renderer/p2p/socket_dispatcher.h"
90 #include "content/renderer/render_frame_proxy.h" 91 #include "content/renderer/render_frame_proxy.h"
91 #include "content/renderer/render_process_impl.h" 92 #include "content/renderer/render_process_impl.h"
92 #include "content/renderer/render_view_impl.h" 93 #include "content/renderer/render_view_impl.h"
93 #include "content/renderer/renderer_webkitplatformsupport_impl.h" 94 #include "content/renderer/renderer_webkitplatformsupport_impl.h"
95 #include "content/renderer/scheduler_proxy_task_runner.h"
94 #include "content/renderer/service_worker/embedded_worker_context_message_filter .h" 96 #include "content/renderer/service_worker/embedded_worker_context_message_filter .h"
95 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" 97 #include "content/renderer/service_worker/embedded_worker_dispatcher.h"
96 #include "content/renderer/shared_worker/embedded_shared_worker_stub.h" 98 #include "content/renderer/shared_worker/embedded_shared_worker_stub.h"
97 #include "ipc/ipc_channel_handle.h" 99 #include "ipc/ipc_channel_handle.h"
98 #include "ipc/ipc_forwarding_message_filter.h" 100 #include "ipc/ipc_forwarding_message_filter.h"
99 #include "ipc/ipc_platform_file.h" 101 #include "ipc/ipc_platform_file.h"
100 #include "media/base/audio_hardware_config.h" 102 #include "media/base/audio_hardware_config.h"
101 #include "media/base/media.h" 103 #include "media/base/media.h"
102 #include "media/filters/gpu_video_accelerator_factories.h" 104 #include "media/filters/gpu_video_accelerator_factories.h"
103 #include "mojo/common/common_type_converters.h" 105 #include "mojo/common/common_type_converters.h"
104 #include "net/base/net_errors.h" 106 #include "net/base/net_errors.h"
105 #include "net/base/net_util.h" 107 #include "net/base/net_util.h"
106 #include "skia/ext/event_tracer_impl.h" 108 #include "skia/ext/event_tracer_impl.h"
107 #include "third_party/WebKit/public/platform/WebString.h" 109 #include "third_party/WebKit/public/platform/WebString.h"
110 #include "third_party/WebKit/public/platform/WebThread.h"
108 #include "third_party/WebKit/public/web/WebColorName.h" 111 #include "third_party/WebKit/public/web/WebColorName.h"
109 #include "third_party/WebKit/public/web/WebDatabase.h" 112 #include "third_party/WebKit/public/web/WebDatabase.h"
110 #include "third_party/WebKit/public/web/WebDocument.h" 113 #include "third_party/WebKit/public/web/WebDocument.h"
111 #include "third_party/WebKit/public/web/WebFrame.h" 114 #include "third_party/WebKit/public/web/WebFrame.h"
112 #include "third_party/WebKit/public/web/WebImageCache.h" 115 #include "third_party/WebKit/public/web/WebImageCache.h"
113 #include "third_party/WebKit/public/web/WebKit.h" 116 #include "third_party/WebKit/public/web/WebKit.h"
114 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h" 117 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h"
115 #include "third_party/WebKit/public/web/WebPopupMenu.h" 118 #include "third_party/WebKit/public/web/WebPopupMenu.h"
116 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 119 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
117 #include "third_party/WebKit/public/web/WebScriptController.h" 120 #include "third_party/WebKit/public/web/WebScriptController.h"
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 647
645 // RemoveEmbeddedWorkerRoute may be called while deleting 648 // RemoveEmbeddedWorkerRoute may be called while deleting
646 // EmbeddedWorkerDispatcher. So it must be deleted before deleting 649 // EmbeddedWorkerDispatcher. So it must be deleted before deleting
647 // RenderThreadImpl. 650 // RenderThreadImpl.
648 embedded_worker_dispatcher_.reset(); 651 embedded_worker_dispatcher_.reset();
649 652
650 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might 653 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might
651 // hold pointers to V8 objects (e.g., via pending requests). 654 // hold pointers to V8 objects (e.g., via pending requests).
652 main_thread_indexed_db_dispatcher_.reset(); 655 main_thread_indexed_db_dispatcher_.reset();
653 656
657 main_thread_compositor_task_runner_ = NULL;
658 main_thread_input_task_runner_ = NULL;
659
654 if (webkit_platform_support_) 660 if (webkit_platform_support_)
655 blink::shutdown(); 661 blink::shutdown();
656 662
657 lazy_tls.Pointer()->Set(NULL); 663 lazy_tls.Pointer()->Set(NULL);
658 664
659 // TODO(port) 665 // TODO(port)
660 #if defined(OS_WIN) 666 #if defined(OS_WIN)
661 // Clean up plugin channels before this thread goes away. 667 // Clean up plugin channels before this thread goes away.
662 NPChannelBase::CleanupChannels(); 668 NPChannelBase::CleanupChannels();
663 #endif 669 #endif
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 ResourceDispatcherDelegate* delegate) { 832 ResourceDispatcherDelegate* delegate) {
827 resource_dispatcher()->set_delegate(delegate); 833 resource_dispatcher()->set_delegate(delegate);
828 } 834 }
829 835
830 void RenderThreadImpl::EnsureWebKitInitialized() { 836 void RenderThreadImpl::EnsureWebKitInitialized() {
831 if (webkit_platform_support_) 837 if (webkit_platform_support_)
832 return; 838 return;
833 839
834 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl); 840 webkit_platform_support_.reset(new RendererWebKitPlatformSupportImpl);
835 blink::initialize(webkit_platform_support_.get()); 841 blink::initialize(webkit_platform_support_.get());
842 main_thread_compositor_task_runner_ =
843 make_scoped_refptr(new SchedulerProxyTaskRunner<
844 &blink::WebSchedulerProxy::postCompositorTask>());
845 main_thread_input_task_runner_ = make_scoped_refptr(
846 new SchedulerProxyTaskRunner<&blink::WebSchedulerProxy::postInputTask>());
836 847
837 v8::Isolate* isolate = blink::mainThreadIsolate(); 848 v8::Isolate* isolate = blink::mainThreadIsolate();
838 849
839 isolate->SetCounterFunction(base::StatsTable::FindLocation); 850 isolate->SetCounterFunction(base::StatsTable::FindLocation);
840 isolate->SetCreateHistogramFunction(CreateHistogram); 851 isolate->SetCreateHistogramFunction(CreateHistogram);
841 isolate->SetAddHistogramSampleFunction(AddHistogramSample); 852 isolate->SetAddHistogramSampleFunction(AddHistogramSample);
842 853
843 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 854 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
844 855
845 bool enable = !command_line.HasSwitch(switches::kDisableThreadedCompositing); 856 bool enable = !command_line.HasSwitch(switches::kDisableThreadedCompositing);
(...skipping 19 matching lines...) Expand all
865 } 876 }
866 877
867 InputHandlerManagerClient* input_handler_manager_client = NULL; 878 InputHandlerManagerClient* input_handler_manager_client = NULL;
868 #if defined(OS_ANDROID) 879 #if defined(OS_ANDROID)
869 if (SynchronousCompositorFactory* factory = 880 if (SynchronousCompositorFactory* factory =
870 SynchronousCompositorFactory::GetInstance()) { 881 SynchronousCompositorFactory::GetInstance()) {
871 input_handler_manager_client = factory->GetInputHandlerManagerClient(); 882 input_handler_manager_client = factory->GetInputHandlerManagerClient();
872 } 883 }
873 #endif 884 #endif
874 if (!input_handler_manager_client) { 885 if (!input_handler_manager_client) {
875 input_event_filter_ = 886 input_event_filter_ = new InputEventFilter(
876 new InputEventFilter(this, compositor_message_loop_proxy_); 887 this, main_thread_input_task_runner_, compositor_message_loop_proxy_);
877 AddFilter(input_event_filter_.get()); 888 AddFilter(input_event_filter_.get());
878 input_handler_manager_client = input_event_filter_.get(); 889 input_handler_manager_client = input_event_filter_.get();
879 } 890 }
880 input_handler_manager_.reset( 891 input_handler_manager_.reset(
881 new InputHandlerManager(compositor_message_loop_proxy_, 892 new InputHandlerManager(compositor_message_loop_proxy_,
882 input_handler_manager_client)); 893 input_handler_manager_client));
883 } 894 }
884 895
885 scoped_refptr<base::MessageLoopProxy> output_surface_loop; 896 scoped_refptr<base::MessageLoopProxy> output_surface_loop;
886 if (enable) 897 if (enable)
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 hidden_widget_count_--; 1650 hidden_widget_count_--;
1640 1651
1641 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { 1652 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) {
1642 return; 1653 return;
1643 } 1654 }
1644 1655
1645 ScheduleIdleHandler(kLongIdleHandlerDelayMs); 1656 ScheduleIdleHandler(kLongIdleHandlerDelayMs);
1646 } 1657 }
1647 1658
1648 } // namespace content 1659 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/scheduler_proxy_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698