| 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 12 matching lines...) Expand all Loading... |
| 23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 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/child_thread.h" | 34 #include "content/child/child_thread.h" |
| 34 #include "content/child/content_child_helpers.h" | 35 #include "content/child/content_child_helpers.h" |
| 35 #include "content/child/geofencing/web_geofencing_provider_impl.h" | 36 #include "content/child/geofencing/web_geofencing_provider_impl.h" |
| 36 #include "content/child/notifications/notification_dispatcher.h" | 37 #include "content/child/notifications/notification_dispatcher.h" |
| 37 #include "content/child/notifications/notification_manager.h" | 38 #include "content/child/notifications/notification_manager.h" |
| 38 #include "content/child/thread_safe_sender.h" | 39 #include "content/child/thread_safe_sender.h" |
| 39 #include "content/child/web_discardable_memory_impl.h" | 40 #include "content/child/web_discardable_memory_impl.h" |
| 40 #include "content/child/web_gesture_curve_impl.h" | 41 #include "content/child/web_gesture_curve_impl.h" |
| 41 #include "content/child/web_url_loader_impl.h" | 42 #include "content/child/web_url_loader_impl.h" |
| 42 #include "content/child/websocket_bridge.h" | 43 #include "content/child/websocket_bridge.h" |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 current_thread_slot_(&DestroyCurrentThread) { | 434 current_thread_slot_(&DestroyCurrentThread) { |
| 434 // TODO(alexclarke): Use c++11 delegated constructors when allowed. | 435 // TODO(alexclarke): Use c++11 delegated constructors when allowed. |
| 435 InternalInit(); | 436 InternalInit(); |
| 436 } | 437 } |
| 437 | 438 |
| 438 void BlinkPlatformImpl::InternalInit() { | 439 void BlinkPlatformImpl::InternalInit() { |
| 439 // ChildThread may not exist in some tests. | 440 // ChildThread may not exist in some tests. |
| 440 if (ChildThread::current()) { | 441 if (ChildThread::current()) { |
| 441 geofencing_provider_.reset(new WebGeofencingProviderImpl( | 442 geofencing_provider_.reset(new WebGeofencingProviderImpl( |
| 442 ChildThread::current()->thread_safe_sender())); | 443 ChildThread::current()->thread_safe_sender())); |
| 444 bluetooth_.reset( |
| 445 new WebBluetoothImpl(ChildThread::current()->thread_safe_sender())); |
| 443 thread_safe_sender_ = ChildThread::current()->thread_safe_sender(); | 446 thread_safe_sender_ = ChildThread::current()->thread_safe_sender(); |
| 444 notification_dispatcher_ = | 447 notification_dispatcher_ = |
| 445 ChildThread::current()->notification_dispatcher(); | 448 ChildThread::current()->notification_dispatcher(); |
| 446 } | 449 } |
| 447 | 450 |
| 448 if (main_thread_task_runner_.get()) { | 451 if (main_thread_task_runner_.get()) { |
| 449 shared_timer_.SetTaskRunner(main_thread_task_runner_); | 452 shared_timer_.SetTaskRunner(main_thread_task_runner_); |
| 450 } | 453 } |
| 451 } | 454 } |
| 452 | 455 |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 } | 1040 } |
| 1038 | 1041 |
| 1039 blink::WebCrypto* BlinkPlatformImpl::crypto() { | 1042 blink::WebCrypto* BlinkPlatformImpl::crypto() { |
| 1040 return &web_crypto_; | 1043 return &web_crypto_; |
| 1041 } | 1044 } |
| 1042 | 1045 |
| 1043 blink::WebGeofencingProvider* BlinkPlatformImpl::geofencingProvider() { | 1046 blink::WebGeofencingProvider* BlinkPlatformImpl::geofencingProvider() { |
| 1044 return geofencing_provider_.get(); | 1047 return geofencing_provider_.get(); |
| 1045 } | 1048 } |
| 1046 | 1049 |
| 1050 blink::WebBluetooth* BlinkPlatformImpl::bluetooth() { |
| 1051 return bluetooth_.get(); |
| 1052 } |
| 1053 |
| 1047 blink::WebNotificationManager* | 1054 blink::WebNotificationManager* |
| 1048 BlinkPlatformImpl::notificationManager() { | 1055 BlinkPlatformImpl::notificationManager() { |
| 1049 if (!thread_safe_sender_.get() || !notification_dispatcher_.get()) | 1056 if (!thread_safe_sender_.get() || !notification_dispatcher_.get()) |
| 1050 return nullptr; | 1057 return nullptr; |
| 1051 | 1058 |
| 1052 return NotificationManager::ThreadSpecificInstance( | 1059 return NotificationManager::ThreadSpecificInstance( |
| 1053 thread_safe_sender_.get(), | 1060 thread_safe_sender_.get(), |
| 1054 main_thread_task_runner_.get(), | 1061 main_thread_task_runner_.get(), |
| 1055 notification_dispatcher_.get()); | 1062 notification_dispatcher_.get()); |
| 1056 } | 1063 } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 } | 1219 } |
| 1213 | 1220 |
| 1214 // static | 1221 // static |
| 1215 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 1222 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
| 1216 WebThreadImplForMessageLoop* impl = | 1223 WebThreadImplForMessageLoop* impl = |
| 1217 static_cast<WebThreadImplForMessageLoop*>(thread); | 1224 static_cast<WebThreadImplForMessageLoop*>(thread); |
| 1218 delete impl; | 1225 delete impl; |
| 1219 } | 1226 } |
| 1220 | 1227 |
| 1221 } // namespace content | 1228 } // namespace content |
| OLD | NEW |