| 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 vibration_manager_(6) { | 244 vibration_manager_(6) { |
| 242 #if !defined(OS_ANDROID) && !defined(OS_WIN) | 245 #if !defined(OS_ANDROID) && !defined(OS_WIN) |
| 243 if (g_sandbox_enabled && sandboxEnabled()) { | 246 if (g_sandbox_enabled && sandboxEnabled()) { |
| 244 sandbox_support_.reset(new RendererBlinkPlatformImpl::SandboxSupport); | 247 sandbox_support_.reset(new RendererBlinkPlatformImpl::SandboxSupport); |
| 245 } else { | 248 } else { |
| 246 DVLOG(1) << "Disabling sandbox support for testing."; | 249 DVLOG(1) << "Disabling sandbox support for testing."; |
| 247 } | 250 } |
| 248 #endif | 251 #endif |
| 249 | 252 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 267 #if !defined(OS_ANDROID) && !defined(OS_WIN) | 270 #if !defined(OS_ANDROID) && !defined(OS_WIN) |
| 268 // SandboxSupport contains a map of WebFontFamily objects, which hold | 271 // SandboxSupport contains a map of WebFontFamily objects, which hold |
| 269 // WebCStrings, which become invalidated when blink is shut down. Hence, we | 272 // WebCStrings, which become invalidated when blink is shut down. Hence, we |
| 270 // need to clear that map now, just before blink::shutdown() is called. | 273 // need to clear that map now, just before blink::shutdown() is called. |
| 271 sandbox_support_.reset(); | 274 sandbox_support_.reset(); |
| 272 #endif | 275 #endif |
| 273 } | 276 } |
| 274 | 277 |
| 275 //------------------------------------------------------------------------------ | 278 //------------------------------------------------------------------------------ |
| 276 | 279 |
| 280 blink::WebURLLoader* RendererBlinkPlatformImpl::createURLLoader() { |
| 281 ChildThreadImpl* child_thread = ChildThreadImpl::current(); |
| 282 // There may be no child thread in RenderViewTests. These tests can still use |
| 283 // data URLs to bypass the ResourceDispatcher. |
| 284 scoped_ptr<scheduler::WebTaskRunnerImpl> task_runner( |
| 285 new scheduler::WebTaskRunnerImpl( |
| 286 loading_task_runner_->BelongsToCurrentThread() |
| 287 ? loading_task_runner_ : base::ThreadTaskRunnerHandle::Get())); |
| 288 return new content::WebURLLoaderImpl( |
| 289 child_thread ? child_thread->resource_dispatcher() : NULL, |
| 290 task_runner.Pass()); |
| 291 } |
| 292 |
| 277 blink::WebThread* RendererBlinkPlatformImpl::currentThread() { | 293 blink::WebThread* RendererBlinkPlatformImpl::currentThread() { |
| 278 if (main_thread_->isCurrentThread()) | 294 if (main_thread_->isCurrentThread()) |
| 279 return main_thread_.get(); | 295 return main_thread_.get(); |
| 280 return BlinkPlatformImpl::currentThread(); | 296 return BlinkPlatformImpl::currentThread(); |
| 281 } | 297 } |
| 282 | 298 |
| 283 blink::WebClipboard* RendererBlinkPlatformImpl::clipboard() { | 299 blink::WebClipboard* RendererBlinkPlatformImpl::clipboard() { |
| 284 blink::WebClipboard* clipboard = | 300 blink::WebClipboard* clipboard = |
| 285 GetContentClient()->renderer()->OverrideWebClipboard(); | 301 GetContentClient()->renderer()->OverrideWebClipboard(); |
| 286 if (clipboard) | 302 if (clipboard) |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 //------------------------------------------------------------------------------ | 1262 //------------------------------------------------------------------------------ |
| 1247 | 1263 |
| 1248 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( | 1264 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( |
| 1249 const blink::WebBatteryStatus& status) { | 1265 const blink::WebBatteryStatus& status) { |
| 1250 if (!g_test_battery_status_listener) | 1266 if (!g_test_battery_status_listener) |
| 1251 return; | 1267 return; |
| 1252 g_test_battery_status_listener->updateBatteryStatus(status); | 1268 g_test_battery_status_listener->updateBatteryStatus(status); |
| 1253 } | 1269 } |
| 1254 | 1270 |
| 1255 } // namespace content | 1271 } // namespace content |
| OLD | NEW |