| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/child/blink_platform_impl.h" | 5 #include "content/child/blink_platform_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/synchronization/lock.h" | 25 #include "base/synchronization/lock.h" |
| 26 #include "base/synchronization/waitable_event.h" | 26 #include "base/synchronization/waitable_event.h" |
| 27 #include "base/sys_info.h" | 27 #include "base/sys_info.h" |
| 28 #include "base/threading/platform_thread.h" | 28 #include "base/threading/platform_thread.h" |
| 29 #include "base/time/time.h" | 29 #include "base/time/time.h" |
| 30 #include "blink/public/resources/grit/blink_resources.h" | 30 #include "blink/public/resources/grit/blink_resources.h" |
| 31 #include "content/app/resources/grit/content_resources.h" | 31 #include "content/app/resources/grit/content_resources.h" |
| 32 #include "content/app/strings/grit/content_strings.h" | 32 #include "content/app/strings/grit/content_strings.h" |
| 33 #include "content/child/bluetooth/web_bluetooth_impl.h" | 33 #include "content/child/bluetooth/web_bluetooth_impl.h" |
| 34 #include "content/child/child_thread.h" | 34 #include "content/child/child_thread_impl.h" |
| 35 #include "content/child/content_child_helpers.h" | 35 #include "content/child/content_child_helpers.h" |
| 36 #include "content/child/geofencing/web_geofencing_provider_impl.h" | 36 #include "content/child/geofencing/web_geofencing_provider_impl.h" |
| 37 #include "content/child/navigator_connect/navigator_connect_provider.h" | 37 #include "content/child/navigator_connect/navigator_connect_provider.h" |
| 38 #include "content/child/notifications/notification_dispatcher.h" | 38 #include "content/child/notifications/notification_dispatcher.h" |
| 39 #include "content/child/notifications/notification_manager.h" | 39 #include "content/child/notifications/notification_manager.h" |
| 40 #include "content/child/push_messaging/push_dispatcher.h" | 40 #include "content/child/push_messaging/push_dispatcher.h" |
| 41 #include "content/child/push_messaging/push_provider.h" | 41 #include "content/child/push_messaging/push_provider.h" |
| 42 #include "content/child/thread_safe_sender.h" | 42 #include "content/child/thread_safe_sender.h" |
| 43 #include "content/child/web_discardable_memory_impl.h" | 43 #include "content/child/web_discardable_memory_impl.h" |
| 44 #include "content/child/web_gesture_curve_impl.h" | 44 #include "content/child/web_gesture_curve_impl.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 shared_timer_fire_time_(0.0), | 429 shared_timer_fire_time_(0.0), |
| 430 shared_timer_fire_time_was_set_while_suspended_(false), | 430 shared_timer_fire_time_was_set_while_suspended_(false), |
| 431 shared_timer_suspended_(0), | 431 shared_timer_suspended_(0), |
| 432 current_thread_slot_(&DestroyCurrentThread) { | 432 current_thread_slot_(&DestroyCurrentThread) { |
| 433 // TODO(alexclarke): Use c++11 delegated constructors when allowed. | 433 // TODO(alexclarke): Use c++11 delegated constructors when allowed. |
| 434 InternalInit(); | 434 InternalInit(); |
| 435 } | 435 } |
| 436 | 436 |
| 437 void BlinkPlatformImpl::InternalInit() { | 437 void BlinkPlatformImpl::InternalInit() { |
| 438 // ChildThread may not exist in some tests. | 438 // ChildThread may not exist in some tests. |
| 439 if (ChildThread::current()) { | 439 if (ChildThreadImpl::current()) { |
| 440 geofencing_provider_.reset(new WebGeofencingProviderImpl( | 440 geofencing_provider_.reset(new WebGeofencingProviderImpl( |
| 441 ChildThread::current()->thread_safe_sender())); | 441 ChildThreadImpl::current()->thread_safe_sender())); |
| 442 bluetooth_.reset( | 442 bluetooth_.reset( |
| 443 new WebBluetoothImpl(ChildThread::current()->thread_safe_sender())); | 443 new WebBluetoothImpl(ChildThreadImpl::current()->thread_safe_sender())); |
| 444 thread_safe_sender_ = ChildThread::current()->thread_safe_sender(); | 444 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); |
| 445 notification_dispatcher_ = | 445 notification_dispatcher_ = |
| 446 ChildThread::current()->notification_dispatcher(); | 446 ChildThreadImpl::current()->notification_dispatcher(); |
| 447 push_dispatcher_ = ChildThread::current()->push_dispatcher(); | 447 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); |
| 448 } | 448 } |
| 449 | 449 |
| 450 if (main_thread_task_runner_.get()) { | 450 if (main_thread_task_runner_.get()) { |
| 451 shared_timer_.SetTaskRunner(main_thread_task_runner_); | 451 shared_timer_.SetTaskRunner(main_thread_task_runner_); |
| 452 } | 452 } |
| 453 } | 453 } |
| 454 | 454 |
| 455 BlinkPlatformImpl::~BlinkPlatformImpl() { | 455 BlinkPlatformImpl::~BlinkPlatformImpl() { |
| 456 } | 456 } |
| 457 | 457 |
| 458 WebURLLoader* BlinkPlatformImpl::createURLLoader() { | 458 WebURLLoader* BlinkPlatformImpl::createURLLoader() { |
| 459 ChildThread* child_thread = ChildThread::current(); | 459 ChildThreadImpl* child_thread = ChildThreadImpl::current(); |
| 460 // There may be no child thread in RenderViewTests. These tests can still use | 460 // There may be no child thread in RenderViewTests. These tests can still use |
| 461 // data URLs to bypass the ResourceDispatcher. | 461 // data URLs to bypass the ResourceDispatcher. |
| 462 return new WebURLLoaderImpl( | 462 return new WebURLLoaderImpl( |
| 463 child_thread ? child_thread->resource_dispatcher() : NULL, | 463 child_thread ? child_thread->resource_dispatcher() : NULL, |
| 464 MainTaskRunnerForCurrentThread()); | 464 MainTaskRunnerForCurrentThread()); |
| 465 } | 465 } |
| 466 | 466 |
| 467 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() { | 467 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() { |
| 468 return new WebSocketBridge; | 468 return new WebSocketBridge; |
| 469 } | 469 } |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 } | 1280 } |
| 1281 | 1281 |
| 1282 // static | 1282 // static |
| 1283 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 1283 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
| 1284 WebThreadImplForMessageLoop* impl = | 1284 WebThreadImplForMessageLoop* impl = |
| 1285 static_cast<WebThreadImplForMessageLoop*>(thread); | 1285 static_cast<WebThreadImplForMessageLoop*>(thread); |
| 1286 delete impl; | 1286 delete impl; |
| 1287 } | 1287 } |
| 1288 | 1288 |
| 1289 } // namespace content | 1289 } // namespace content |
| OLD | NEW |