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/renderer_blink_platform_impl.h" | 5 #include "content/renderer/renderer_blink_platform_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/numerics/safe_conversions.h" | 14 #include "base/numerics/safe_conversions.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 #include "cc/blink/context_provider_web_context.h" | 20 #include "cc/blink/context_provider_web_context.h" |
21 #include "components/scheduler/child/web_scheduler_impl.h" | 21 #include "components/scheduler/child/web_scheduler_impl.h" |
| 22 #include "components/scheduler/child/web_task_runner_impl.h" |
22 #include "components/scheduler/renderer/renderer_scheduler.h" | 23 #include "components/scheduler/renderer/renderer_scheduler.h" |
23 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" | 24 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" |
24 #include "components/url_formatter/url_formatter.h" | 25 #include "components/url_formatter/url_formatter.h" |
25 #include "content/child/database_util.h" | 26 #include "content/child/database_util.h" |
26 #include "content/child/file_info_util.h" | 27 #include "content/child/file_info_util.h" |
27 #include "content/child/fileapi/webfilesystem_impl.h" | 28 #include "content/child/fileapi/webfilesystem_impl.h" |
28 #include "content/child/indexed_db/webidbfactory_impl.h" | 29 #include "content/child/indexed_db/webidbfactory_impl.h" |
29 #include "content/child/npapi/npobject_util.h" | 30 #include "content/child/npapi/npobject_util.h" |
30 #include "content/child/quota_dispatcher.h" | 31 #include "content/child/quota_dispatcher.h" |
31 #include "content/child/quota_message_filter.h" | 32 #include "content/child/quota_message_filter.h" |
32 #include "content/child/simple_webmimeregistry_impl.h" | 33 #include "content/child/simple_webmimeregistry_impl.h" |
33 #include "content/child/thread_safe_sender.h" | 34 #include "content/child/thread_safe_sender.h" |
34 #include "content/child/web_database_observer_impl.h" | 35 #include "content/child/web_database_observer_impl.h" |
| 36 #include "content/child/web_url_loader_impl.h" |
35 #include "content/child/webblobregistry_impl.h" | 37 #include "content/child/webblobregistry_impl.h" |
36 #include "content/child/webfileutilities_impl.h" | 38 #include "content/child/webfileutilities_impl.h" |
37 #include "content/child/webmessageportchannel_impl.h" | 39 #include "content/child/webmessageportchannel_impl.h" |
38 #include "content/common/file_utilities_messages.h" | 40 #include "content/common/file_utilities_messages.h" |
39 #include "content/common/frame_messages.h" | 41 #include "content/common/frame_messages.h" |
40 #include "content/common/gpu/client/context_provider_command_buffer.h" | 42 #include "content/common/gpu/client/context_provider_command_buffer.h" |
41 #include "content/common/gpu/client/gpu_channel_host.h" | 43 #include "content/common/gpu/client/gpu_channel_host.h" |
42 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 44 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
43 #include "content/common/gpu/gpu_process_launch_causes.h" | 45 #include "content/common/gpu/gpu_process_launch_causes.h" |
44 #include "content/common/mime_registry_messages.h" | 46 #include "content/common/mime_registry_messages.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 scheduler::RendererScheduler* renderer_scheduler) | 232 scheduler::RendererScheduler* renderer_scheduler) |
231 : BlinkPlatformImpl(renderer_scheduler->DefaultTaskRunner()), | 233 : BlinkPlatformImpl(renderer_scheduler->DefaultTaskRunner()), |
232 main_thread_( | 234 main_thread_( |
233 new scheduler::WebThreadImplForRendererScheduler(renderer_scheduler)), | 235 new scheduler::WebThreadImplForRendererScheduler(renderer_scheduler)), |
234 clipboard_delegate_(new RendererClipboardDelegate), | 236 clipboard_delegate_(new RendererClipboardDelegate), |
235 clipboard_(new WebClipboardImpl(clipboard_delegate_.get())), | 237 clipboard_(new WebClipboardImpl(clipboard_delegate_.get())), |
236 mime_registry_(new RendererBlinkPlatformImpl::MimeRegistry), | 238 mime_registry_(new RendererBlinkPlatformImpl::MimeRegistry), |
237 sudden_termination_disables_(0), | 239 sudden_termination_disables_(0), |
238 plugin_refresh_allowed_(true), | 240 plugin_refresh_allowed_(true), |
239 default_task_runner_(renderer_scheduler->DefaultTaskRunner()), | 241 default_task_runner_(renderer_scheduler->DefaultTaskRunner()), |
| 242 loading_task_runner_(renderer_scheduler->LoadingTaskRunner()), |
240 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl) { | 243 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl) { |
241 #if !defined(OS_ANDROID) && !defined(OS_WIN) | 244 #if !defined(OS_ANDROID) && !defined(OS_WIN) |
242 if (g_sandbox_enabled && sandboxEnabled()) { | 245 if (g_sandbox_enabled && sandboxEnabled()) { |
243 sandbox_support_.reset(new RendererBlinkPlatformImpl::SandboxSupport); | 246 sandbox_support_.reset(new RendererBlinkPlatformImpl::SandboxSupport); |
244 } else { | 247 } else { |
245 DVLOG(1) << "Disabling sandbox support for testing."; | 248 DVLOG(1) << "Disabling sandbox support for testing."; |
246 } | 249 } |
247 #endif | 250 #endif |
248 | 251 |
249 // ChildThread may not exist in some tests. | 252 // ChildThread may not exist in some tests. |
(...skipping 16 matching lines...) Expand all Loading... |
266 #if !defined(OS_ANDROID) && !defined(OS_WIN) | 269 #if !defined(OS_ANDROID) && !defined(OS_WIN) |
267 // SandboxSupport contains a map of WebFontFamily objects, which hold | 270 // SandboxSupport contains a map of WebFontFamily objects, which hold |
268 // WebCStrings, which become invalidated when blink is shut down. Hence, we | 271 // WebCStrings, which become invalidated when blink is shut down. Hence, we |
269 // need to clear that map now, just before blink::shutdown() is called. | 272 // need to clear that map now, just before blink::shutdown() is called. |
270 sandbox_support_.reset(); | 273 sandbox_support_.reset(); |
271 #endif | 274 #endif |
272 } | 275 } |
273 | 276 |
274 //------------------------------------------------------------------------------ | 277 //------------------------------------------------------------------------------ |
275 | 278 |
| 279 blink::WebURLLoader* RendererBlinkPlatformImpl::createURLLoader() { |
| 280 ChildThreadImpl* child_thread = ChildThreadImpl::current(); |
| 281 // There may be no child thread in RenderViewTests. These tests can still use |
| 282 // data URLs to bypass the ResourceDispatcher. |
| 283 scoped_ptr<scheduler::WebTaskRunnerImpl> task_runner( |
| 284 new scheduler::WebTaskRunnerImpl( |
| 285 loading_task_runner_->BelongsToCurrentThread() |
| 286 ? loading_task_runner_ : base::ThreadTaskRunnerHandle::Get())); |
| 287 return new content::WebURLLoaderImpl( |
| 288 child_thread ? child_thread->resource_dispatcher() : NULL, |
| 289 task_runner.Pass()); |
| 290 } |
| 291 |
276 blink::WebThread* RendererBlinkPlatformImpl::currentThread() { | 292 blink::WebThread* RendererBlinkPlatformImpl::currentThread() { |
277 if (main_thread_->isCurrentThread()) | 293 if (main_thread_->isCurrentThread()) |
278 return main_thread_.get(); | 294 return main_thread_.get(); |
279 return BlinkPlatformImpl::currentThread(); | 295 return BlinkPlatformImpl::currentThread(); |
280 } | 296 } |
281 | 297 |
282 blink::WebClipboard* RendererBlinkPlatformImpl::clipboard() { | 298 blink::WebClipboard* RendererBlinkPlatformImpl::clipboard() { |
283 blink::WebClipboard* clipboard = | 299 blink::WebClipboard* clipboard = |
284 GetContentClient()->renderer()->OverrideWebClipboard(); | 300 GetContentClient()->renderer()->OverrideWebClipboard(); |
285 if (clipboard) | 301 if (clipboard) |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 //------------------------------------------------------------------------------ | 1261 //------------------------------------------------------------------------------ |
1246 | 1262 |
1247 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( | 1263 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( |
1248 const blink::WebBatteryStatus& status) { | 1264 const blink::WebBatteryStatus& status) { |
1249 if (!g_test_battery_status_listener) | 1265 if (!g_test_battery_status_listener) |
1250 return; | 1266 return; |
1251 g_test_battery_status_listener->updateBatteryStatus(status); | 1267 g_test_battery_status_listener->updateBatteryStatus(status); |
1252 } | 1268 } |
1253 | 1269 |
1254 } // namespace content | 1270 } // namespace content |
OLD | NEW |