| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/guid.h" | 11 #include "base/guid.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/memory/shared_memory.h" | 16 #include "base/memory/shared_memory.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "base/numerics/safe_conversions.h" | 18 #include "base/numerics/safe_conversions.h" |
| 19 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
| 20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/threading/thread_task_runner_handle.h" | 22 #include "base/threading/thread_task_runner_handle.h" |
| 23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 24 #include "components/scheduler/child/web_scheduler_impl.h" | |
| 25 #include "components/scheduler/child/web_task_runner_impl.h" | |
| 26 #include "components/scheduler/renderer/renderer_scheduler.h" | |
| 27 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" | |
| 28 #include "components/url_formatter/url_formatter.h" | 24 #include "components/url_formatter/url_formatter.h" |
| 29 #include "content/child/blob_storage/webblobregistry_impl.h" | 25 #include "content/child/blob_storage/webblobregistry_impl.h" |
| 30 #include "content/child/database_util.h" | 26 #include "content/child/database_util.h" |
| 31 #include "content/child/file_info_util.h" | 27 #include "content/child/file_info_util.h" |
| 32 #include "content/child/fileapi/webfilesystem_impl.h" | 28 #include "content/child/fileapi/webfilesystem_impl.h" |
| 33 #include "content/child/indexed_db/webidbfactory_impl.h" | 29 #include "content/child/indexed_db/webidbfactory_impl.h" |
| 34 #include "content/child/quota_dispatcher.h" | 30 #include "content/child/quota_dispatcher.h" |
| 35 #include "content/child/quota_message_filter.h" | 31 #include "content/child/quota_message_filter.h" |
| 36 #include "content/child/simple_webmimeregistry_impl.h" | 32 #include "content/child/simple_webmimeregistry_impl.h" |
| 37 #include "content/child/storage_util.h" | 33 #include "content/child/storage_util.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 #include "third_party/WebKit/public/platform/WebGamepads.h" | 91 #include "third_party/WebKit/public/platform/WebGamepads.h" |
| 96 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 92 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
| 97 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" | 93 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" |
| 98 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" | 94 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" |
| 99 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 95 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 100 #include "third_party/WebKit/public/platform/WebURL.h" | 96 #include "third_party/WebKit/public/platform/WebURL.h" |
| 101 #include "third_party/WebKit/public/platform/WebVector.h" | 97 #include "third_party/WebKit/public/platform/WebVector.h" |
| 102 #include "third_party/WebKit/public/platform/mime_registry.mojom.h" | 98 #include "third_party/WebKit/public/platform/mime_registry.mojom.h" |
| 103 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eMotionListener.h" | 99 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eMotionListener.h" |
| 104 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eOrientationListener.h" | 100 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eOrientationListener.h" |
| 101 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
| 105 #include "url/gurl.h" | 102 #include "url/gurl.h" |
| 106 | 103 |
| 107 #if defined(OS_MACOSX) | 104 #if defined(OS_MACOSX) |
| 108 #include "content/common/mac/font_descriptor.h" | 105 #include "content/common/mac/font_descriptor.h" |
| 109 #include "content/common/mac/font_loader.h" | 106 #include "content/common/mac/font_loader.h" |
| 110 #include "content/renderer/webscrollbarbehavior_impl_mac.h" | 107 #include "content/renderer/webscrollbarbehavior_impl_mac.h" |
| 111 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" | 108 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" |
| 112 #endif | 109 #endif |
| 113 | 110 |
| 114 #if defined(OS_POSIX) | 111 #if defined(OS_POSIX) |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // here. | 230 // here. |
| 234 base::Lock unicode_font_families_mutex_; | 231 base::Lock unicode_font_families_mutex_; |
| 235 std::map<int32_t, blink::WebFallbackFont> unicode_font_families_; | 232 std::map<int32_t, blink::WebFallbackFont> unicode_font_families_; |
| 236 #endif | 233 #endif |
| 237 }; | 234 }; |
| 238 #endif // !defined(OS_ANDROID) && !defined(OS_WIN) | 235 #endif // !defined(OS_ANDROID) && !defined(OS_WIN) |
| 239 | 236 |
| 240 //------------------------------------------------------------------------------ | 237 //------------------------------------------------------------------------------ |
| 241 | 238 |
| 242 RendererBlinkPlatformImpl::RendererBlinkPlatformImpl( | 239 RendererBlinkPlatformImpl::RendererBlinkPlatformImpl( |
| 243 scheduler::RendererScheduler* renderer_scheduler, | 240 blink::scheduler::RendererScheduler* renderer_scheduler, |
| 244 base::WeakPtr<shell::InterfaceProvider> remote_interfaces) | 241 base::WeakPtr<shell::InterfaceProvider> remote_interfaces) |
| 245 : BlinkPlatformImpl(renderer_scheduler->DefaultTaskRunner()), | 242 : BlinkPlatformImpl(renderer_scheduler->DefaultTaskRunner()), |
| 246 main_thread_(renderer_scheduler->CreateMainThread()), | 243 main_thread_(renderer_scheduler->CreateMainThread()), |
| 247 clipboard_delegate_(new RendererClipboardDelegate), | 244 clipboard_delegate_(new RendererClipboardDelegate), |
| 248 clipboard_(new WebClipboardImpl(clipboard_delegate_.get())), | 245 clipboard_(new WebClipboardImpl(clipboard_delegate_.get())), |
| 249 mime_registry_(new RendererBlinkPlatformImpl::MimeRegistry), | 246 mime_registry_(new RendererBlinkPlatformImpl::MimeRegistry), |
| 250 sudden_termination_disables_(0), | 247 sudden_termination_disables_(0), |
| 251 plugin_refresh_allowed_(true), | 248 plugin_refresh_allowed_(true), |
| 252 default_task_runner_(renderer_scheduler->DefaultTaskRunner()), | 249 default_task_runner_(renderer_scheduler->DefaultTaskRunner()), |
| 253 loading_task_runner_(renderer_scheduler->LoadingTaskRunner()), | 250 loading_task_runner_(renderer_scheduler->LoadingTaskRunner()), |
| 254 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl), | 251 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl), |
| 255 renderer_scheduler_(renderer_scheduler), | 252 renderer_scheduler_(renderer_scheduler), |
| 256 blink_service_registry_( | 253 blink_service_registry_(new BlinkServiceRegistryImpl(remote_interfaces)) { |
| 257 new BlinkServiceRegistryImpl(remote_interfaces)) { | |
| 258 #if !defined(OS_ANDROID) && !defined(OS_WIN) | 254 #if !defined(OS_ANDROID) && !defined(OS_WIN) |
| 259 if (g_sandbox_enabled && sandboxEnabled()) { | 255 if (g_sandbox_enabled && sandboxEnabled()) { |
| 260 sandbox_support_.reset(new RendererBlinkPlatformImpl::SandboxSupport); | 256 sandbox_support_.reset(new RendererBlinkPlatformImpl::SandboxSupport); |
| 261 } else { | 257 } else { |
| 262 DVLOG(1) << "Disabling sandbox support for testing."; | 258 DVLOG(1) << "Disabling sandbox support for testing."; |
| 263 } | 259 } |
| 264 #endif | 260 #endif |
| 265 | 261 |
| 266 // ChildThread may not exist in some tests. | 262 // ChildThread may not exist in some tests. |
| 267 if (ChildThreadImpl::current()) { | 263 if (ChildThreadImpl::current()) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 294 #endif | 290 #endif |
| 295 } | 291 } |
| 296 | 292 |
| 297 //------------------------------------------------------------------------------ | 293 //------------------------------------------------------------------------------ |
| 298 | 294 |
| 299 blink::WebURLLoader* RendererBlinkPlatformImpl::createURLLoader() { | 295 blink::WebURLLoader* RendererBlinkPlatformImpl::createURLLoader() { |
| 300 ChildThreadImpl* child_thread = ChildThreadImpl::current(); | 296 ChildThreadImpl* child_thread = ChildThreadImpl::current(); |
| 301 // There may be no child thread in RenderViewTests. These tests can still use | 297 // There may be no child thread in RenderViewTests. These tests can still use |
| 302 // data URLs to bypass the ResourceDispatcher. | 298 // data URLs to bypass the ResourceDispatcher. |
| 303 return new content::WebURLLoaderImpl( | 299 return new content::WebURLLoaderImpl( |
| 304 child_thread ? child_thread->resource_dispatcher() : NULL, | 300 child_thread ? child_thread->resource_dispatcher() : NULL); |
| 305 base::WrapUnique(currentThread()->getWebTaskRunner()->clone())); | |
| 306 } | 301 } |
| 307 | 302 |
| 308 blink::WebThread* RendererBlinkPlatformImpl::currentThread() { | 303 blink::WebThread* RendererBlinkPlatformImpl::currentThread() { |
| 309 if (main_thread_->isCurrentThread()) | 304 if (main_thread_->isCurrentThread()) |
| 310 return main_thread_.get(); | 305 return main_thread_.get(); |
| 311 return BlinkPlatformImpl::currentThread(); | 306 return BlinkPlatformImpl::currentThread(); |
| 312 } | 307 } |
| 313 | 308 |
| 314 blink::BlameContext* RendererBlinkPlatformImpl::topLevelBlameContext() { | 309 blink::BlameContext* RendererBlinkPlatformImpl::topLevelBlameContext() { |
| 315 return &top_level_blame_context_; | 310 return &top_level_blame_context_; |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 return &trial_token_validator_; | 1302 return &trial_token_validator_; |
| 1308 } | 1303 } |
| 1309 | 1304 |
| 1310 void RendererBlinkPlatformImpl::workerContextCreated( | 1305 void RendererBlinkPlatformImpl::workerContextCreated( |
| 1311 const v8::Local<v8::Context>& worker) { | 1306 const v8::Local<v8::Context>& worker) { |
| 1312 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( | 1307 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( |
| 1313 worker); | 1308 worker); |
| 1314 } | 1309 } |
| 1315 | 1310 |
| 1316 } // namespace content | 1311 } // namespace content |
| OLD | NEW |