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

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

Issue 281073002: NOT FOR REVIEW: Adding prioritized incoming task queue to renderers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Prioritize input events Created 6 years, 7 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
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/renderer_main.cc » ('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/shared_memory.h" 18 #include "base/memory/shared_memory.h"
19 #include "base/message_loop/high_priority_task_runner.h"
19 #include "base/metrics/field_trial.h" 20 #include "base/metrics/field_trial.h"
20 #include "base/metrics/histogram.h" 21 #include "base/metrics/histogram.h"
21 #include "base/metrics/stats_table.h" 22 #include "base/metrics/stats_table.h"
22 #include "base/path_service.h" 23 #include "base/path_service.h"
23 #include "base/strings/string16.h" 24 #include "base/strings/string16.h"
24 #include "base/strings/string_number_conversions.h" 25 #include "base/strings/string_number_conversions.h"
25 #include "base/strings/string_tokenizer.h" 26 #include "base/strings/string_tokenizer.h"
26 #include "base/strings/utf_string_conversions.h" 27 #include "base/strings/utf_string_conversions.h"
27 #include "base/threading/thread_local.h" 28 #include "base/threading/thread_local.h"
28 #include "base/threading/thread_restrictions.h" 29 #include "base/threading/thread_restrictions.h"
29 #include "base/values.h" 30 #include "base/values.h"
30 #include "cc/base/switches.h" 31 #include "cc/base/switches.h"
31 #include "cc/resources/raster_worker_pool.h" 32 #include "cc/resources/raster_worker_pool.h"
32 #include "content/child/appcache/appcache_dispatcher.h" 33 #include "content/child/appcache/appcache_dispatcher.h"
33 #include "content/child/appcache/appcache_frontend_impl.h" 34 #include "content/child/appcache/appcache_frontend_impl.h"
34 #include "content/child/child_histogram_message_filter.h" 35 #include "content/child/child_histogram_message_filter.h"
35 #include "content/child/db_message_filter.h" 36 #include "content/child/db_message_filter.h"
37 #include "content/child/high_priority_resource_filter.h"
36 #include "content/child/indexed_db/indexed_db_dispatcher.h" 38 #include "content/child/indexed_db/indexed_db_dispatcher.h"
37 #include "content/child/indexed_db/indexed_db_message_filter.h" 39 #include "content/child/indexed_db/indexed_db_message_filter.h"
38 #include "content/child/npapi/npobject_util.h" 40 #include "content/child/npapi/npobject_util.h"
39 #include "content/child/plugin_messages.h" 41 #include "content/child/plugin_messages.h"
40 #include "content/child/resource_dispatcher.h" 42 #include "content/child/resource_dispatcher.h"
41 #include "content/child/runtime_features.h" 43 #include "content/child/runtime_features.h"
42 #include "content/child/thread_safe_sender.h" 44 #include "content/child/thread_safe_sender.h"
43 #include "content/child/web_database_observer_impl.h" 45 #include "content/child/web_database_observer_impl.h"
44 #include "content/child/worker_task_runner.h" 46 #include "content/child/worker_task_runner.h"
45 #include "content/common/child_process_messages.h" 47 #include "content/common/child_process_messages.h"
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 } 556 }
555 557
556 media_thread_.reset(); 558 media_thread_.reset();
557 compositor_thread_.reset(); 559 compositor_thread_.reset();
558 input_handler_manager_.reset(); 560 input_handler_manager_.reset();
559 if (input_event_filter_.get()) { 561 if (input_event_filter_.get()) {
560 RemoveFilter(input_event_filter_.get()); 562 RemoveFilter(input_event_filter_.get());
561 input_event_filter_ = NULL; 563 input_event_filter_ = NULL;
562 } 564 }
563 565
566 if (high_priority_resource_filter_.get()) {
567 RemoveFilter(high_priority_resource_filter_.get());
568 high_priority_resource_filter_ = NULL;
569 }
570
564 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might 571 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might
565 // hold pointers to V8 objects (e.g., via pending requests). 572 // hold pointers to V8 objects (e.g., via pending requests).
566 main_thread_indexed_db_dispatcher_.reset(); 573 main_thread_indexed_db_dispatcher_.reset();
567 574
568 if (webkit_platform_support_) 575 if (webkit_platform_support_)
569 blink::shutdown(); 576 blink::shutdown();
570 577
571 lazy_tls.Pointer()->Set(NULL); 578 lazy_tls.Pointer()->Set(NULL);
572 579
573 // TODO(port) 580 // TODO(port)
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 InputHandlerManagerClient* input_handler_manager_client = NULL; 761 InputHandlerManagerClient* input_handler_manager_client = NULL;
755 #if defined(OS_ANDROID) 762 #if defined(OS_ANDROID)
756 if (SynchronousCompositorFactory* factory = 763 if (SynchronousCompositorFactory* factory =
757 SynchronousCompositorFactory::GetInstance()) { 764 SynchronousCompositorFactory::GetInstance()) {
758 input_handler_manager_client = factory->GetInputHandlerManagerClient(); 765 input_handler_manager_client = factory->GetInputHandlerManagerClient();
759 } 766 }
760 #endif 767 #endif
761 if (!input_handler_manager_client) { 768 if (!input_handler_manager_client) {
762 input_event_filter_ = 769 input_event_filter_ =
763 new InputEventFilter(this, compositor_message_loop_proxy_); 770 new InputEventFilter(this, compositor_message_loop_proxy_);
771 if (high_priority_task_runner_.get()) {
772 input_event_filter_->SetHighPriorityTaskRunner(
773 high_priority_task_runner_);
774 }
764 AddFilter(input_event_filter_.get()); 775 AddFilter(input_event_filter_.get());
765 input_handler_manager_client = input_event_filter_.get(); 776 input_handler_manager_client = input_event_filter_.get();
766 } 777 }
767 input_handler_manager_.reset( 778 input_handler_manager_.reset(
768 new InputHandlerManager(compositor_message_loop_proxy_, 779 new InputHandlerManager(compositor_message_loop_proxy_,
769 input_handler_manager_client)); 780 input_handler_manager_client));
770 } 781 }
771 782
772 scoped_refptr<base::MessageLoopProxy> output_surface_loop; 783 scoped_refptr<base::MessageLoopProxy> output_surface_loop;
773 if (enable) 784 if (enable)
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 &input_params, &output_params)); 1076 &input_params, &output_params));
1066 1077
1067 audio_hardware_config_.reset(new media::AudioHardwareConfig( 1078 audio_hardware_config_.reset(new media::AudioHardwareConfig(
1068 input_params, output_params)); 1079 input_params, output_params));
1069 audio_message_filter_->SetAudioHardwareConfig(audio_hardware_config_.get()); 1080 audio_message_filter_->SetAudioHardwareConfig(audio_hardware_config_.get());
1070 } 1081 }
1071 1082
1072 return audio_hardware_config_.get(); 1083 return audio_hardware_config_.get();
1073 } 1084 }
1074 1085
1086 void RenderThreadImpl::UseHighPriorityTaskRunner(
1087 scoped_refptr<base::HighPriorityTaskRunner> high_priority_task_runner) {
1088 DCHECK(!high_priority_resource_filter_.get());
1089 DCHECK(channel());
1090
1091 high_priority_task_runner_ = high_priority_task_runner;
1092 high_priority_resource_filter_ = new HighPriorityResourceFilter(
1093 resource_dispatcher(), high_priority_task_runner);
1094 resource_dispatcher()->set_high_priority_resource_filter(
1095 high_priority_resource_filter_.get());
1096
1097 channel()->AddFilter(high_priority_resource_filter_.get());
1098 }
1099
1075 base::WaitableEvent* RenderThreadImpl::GetShutdownEvent() { 1100 base::WaitableEvent* RenderThreadImpl::GetShutdownEvent() {
1076 return ChildProcess::current()->GetShutDownEvent(); 1101 return ChildProcess::current()->GetShutDownEvent();
1077 } 1102 }
1078 1103
1079 #if defined(OS_WIN) 1104 #if defined(OS_WIN)
1080 void RenderThreadImpl::PreCacheFontCharacters(const LOGFONT& log_font, 1105 void RenderThreadImpl::PreCacheFontCharacters(const LOGFONT& log_font,
1081 const base::string16& str) { 1106 const base::string16& str) {
1082 Send(new ViewHostMsg_PreCacheFontCharacters(log_font, str)); 1107 Send(new ViewHostMsg_PreCacheFontCharacters(log_font, str));
1083 } 1108 }
1084 1109
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 hidden_widget_count_--; 1527 hidden_widget_count_--;
1503 1528
1504 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { 1529 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) {
1505 return; 1530 return;
1506 } 1531 }
1507 1532
1508 ScheduleIdleHandler(kLongIdleHandlerDelayMs); 1533 ScheduleIdleHandler(kLongIdleHandlerDelayMs);
1509 } 1534 }
1510 1535
1511 } // namespace content 1536 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/renderer_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698