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> |
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/metrics/field_trial.h" | 19 #include "base/metrics/field_trial.h" |
20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
21 #include "base/metrics/stats_table.h" | 21 #include "base/metrics/stats_table.h" |
22 #include "base/path_service.h" | 22 #include "base/path_service.h" |
23 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
| 24 #include "base/strings/string_number_conversions.h" |
24 #include "base/strings/string_tokenizer.h" | 25 #include "base/strings/string_tokenizer.h" |
25 #include "base/strings/string_number_conversions.h" | |
26 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
27 #include "base/threading/thread_local.h" | 27 #include "base/threading/thread_local.h" |
28 #include "base/threading/thread_restrictions.h" | 28 #include "base/threading/thread_restrictions.h" |
29 #include "base/values.h" | 29 #include "base/values.h" |
30 #include "cc/base/switches.h" | 30 #include "cc/base/switches.h" |
31 #include "cc/resources/raster_worker_pool.h" | 31 #include "cc/resources/raster_worker_pool.h" |
32 #include "content/child/appcache/appcache_dispatcher.h" | 32 #include "content/child/appcache/appcache_dispatcher.h" |
33 #include "content/child/appcache/appcache_frontend_impl.h" | 33 #include "content/child/appcache/appcache_frontend_impl.h" |
34 #include "content/child/child_histogram_message_filter.h" | 34 #include "content/child/child_histogram_message_filter.h" |
35 #include "content/child/db_message_filter.h" | 35 #include "content/child/db_message_filter.h" |
36 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 36 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
37 #include "content/child/indexed_db/indexed_db_message_filter.h" | 37 #include "content/child/indexed_db/indexed_db_message_filter.h" |
38 #include "content/child/npapi/npobject_util.h" | 38 #include "content/child/npapi/npobject_util.h" |
39 #include "content/child/plugin_messages.h" | 39 #include "content/child/plugin_messages.h" |
40 #include "content/child/resource_dispatcher.h" | 40 #include "content/child/resource_dispatcher.h" |
41 #include "content/child/runtime_features.h" | 41 #include "content/child/runtime_features.h" |
42 #include "content/child/thread_safe_sender.h" | 42 #include "content/child/thread_safe_sender.h" |
43 #include "content/child/web_database_observer_impl.h" | 43 #include "content/child/web_database_observer_impl.h" |
| 44 #include "content/child/worker_task_runner.h" |
44 #include "content/common/child_process_messages.h" | 45 #include "content/common/child_process_messages.h" |
45 #include "content/common/content_constants_internal.h" | 46 #include "content/common/content_constants_internal.h" |
46 #include "content/common/database_messages.h" | 47 #include "content/common/database_messages.h" |
47 #include "content/common/dom_storage/dom_storage_messages.h" | 48 #include "content/common/dom_storage/dom_storage_messages.h" |
48 #include "content/common/gpu/client/context_provider_command_buffer.h" | 49 #include "content/common/gpu/client/context_provider_command_buffer.h" |
49 #include "content/common/gpu/client/gpu_channel_host.h" | 50 #include "content/common/gpu/client/gpu_channel_host.h" |
50 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 51 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
51 #include "content/common/gpu/gpu_messages.h" | 52 #include "content/common/gpu/gpu_messages.h" |
52 #include "content/common/gpu/gpu_process_launch_causes.h" | 53 #include "content/common/gpu/gpu_process_launch_causes.h" |
53 #include "content/common/resource_messages.h" | 54 #include "content/common/resource_messages.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h" | 106 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h" |
106 #include "third_party/WebKit/public/web/WebPopupMenu.h" | 107 #include "third_party/WebKit/public/web/WebPopupMenu.h" |
107 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 108 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
108 #include "third_party/WebKit/public/web/WebScriptController.h" | 109 #include "third_party/WebKit/public/web/WebScriptController.h" |
109 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 110 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
110 #include "third_party/WebKit/public/web/WebView.h" | 111 #include "third_party/WebKit/public/web/WebView.h" |
111 #include "third_party/skia/include/core/SkGraphics.h" | 112 #include "third_party/skia/include/core/SkGraphics.h" |
112 #include "ui/base/layout.h" | 113 #include "ui/base/layout.h" |
113 #include "ui/base/ui_base_switches.h" | 114 #include "ui/base/ui_base_switches.h" |
114 #include "v8/include/v8.h" | 115 #include "v8/include/v8.h" |
115 #include "webkit/child/worker_task_runner.h" | |
116 #include "webkit/renderer/compositor_bindings/web_external_bitmap_impl.h" | 116 #include "webkit/renderer/compositor_bindings/web_external_bitmap_impl.h" |
117 | 117 |
118 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
119 #include <windows.h> | 119 #include <windows.h> |
120 #include <objbase.h> | 120 #include <objbase.h> |
121 #else | 121 #else |
122 // TODO(port) | 122 // TODO(port) |
123 #include "base/memory/scoped_handle.h" | 123 #include "base/memory/scoped_handle.h" |
124 #include "content/child/npapi/np_channel_base.h" | 124 #include "content/child/npapi/np_channel_base.h" |
125 #endif | 125 #endif |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 void RenderThreadImpl::SetIdleNotificationDelayInMs( | 870 void RenderThreadImpl::SetIdleNotificationDelayInMs( |
871 int64 idle_notification_delay_in_ms) { | 871 int64 idle_notification_delay_in_ms) { |
872 idle_notification_delay_in_ms_ = idle_notification_delay_in_ms; | 872 idle_notification_delay_in_ms_ = idle_notification_delay_in_ms; |
873 } | 873 } |
874 | 874 |
875 void RenderThreadImpl::UpdateHistograms(int sequence_number) { | 875 void RenderThreadImpl::UpdateHistograms(int sequence_number) { |
876 child_histogram_message_filter()->SendHistograms(sequence_number); | 876 child_histogram_message_filter()->SendHistograms(sequence_number); |
877 } | 877 } |
878 | 878 |
879 int RenderThreadImpl::PostTaskToAllWebWorkers(const base::Closure& closure) { | 879 int RenderThreadImpl::PostTaskToAllWebWorkers(const base::Closure& closure) { |
880 return webkit_glue::WorkerTaskRunner::Instance()->PostTaskToAllThreads( | 880 return WorkerTaskRunner::Instance()->PostTaskToAllThreads(closure); |
881 closure); | |
882 } | 881 } |
883 | 882 |
884 bool RenderThreadImpl::ResolveProxy(const GURL& url, std::string* proxy_list) { | 883 bool RenderThreadImpl::ResolveProxy(const GURL& url, std::string* proxy_list) { |
885 bool result = false; | 884 bool result = false; |
886 Send(new ViewHostMsg_ResolveProxy(url, &result, proxy_list)); | 885 Send(new ViewHostMsg_ResolveProxy(url, &result, proxy_list)); |
887 return result; | 886 return result; |
888 } | 887 } |
889 | 888 |
890 void RenderThreadImpl::PostponeIdleNotification() { | 889 void RenderThreadImpl::PostponeIdleNotification() { |
891 idle_notifications_to_skip_ = 2; | 890 idle_notifications_to_skip_ = 2; |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1420 hidden_widget_count_--; | 1419 hidden_widget_count_--; |
1421 | 1420 |
1422 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1421 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
1423 return; | 1422 return; |
1424 } | 1423 } |
1425 | 1424 |
1426 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1425 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
1427 } | 1426 } |
1428 | 1427 |
1429 } // namespace content | 1428 } // namespace content |
OLD | NEW |