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 15 matching lines...) Expand all Loading... |
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/child_thread.h" | 33 #include "content/child/child_thread.h" |
34 #include "content/child/content_child_helpers.h" | 34 #include "content/child/content_child_helpers.h" |
35 #include "content/child/geofencing/web_geofencing_provider_impl.h" | 35 #include "content/child/geofencing/web_geofencing_provider_impl.h" |
| 36 #include "content/child/notifications/notification_dispatcher.h" |
| 37 #include "content/child/notifications/notification_manager.h" |
| 38 #include "content/child/thread_safe_sender.h" |
36 #include "content/child/web_discardable_memory_impl.h" | 39 #include "content/child/web_discardable_memory_impl.h" |
37 #include "content/child/web_gesture_curve_impl.h" | 40 #include "content/child/web_gesture_curve_impl.h" |
38 #include "content/child/web_url_loader_impl.h" | 41 #include "content/child/web_url_loader_impl.h" |
39 #include "content/child/websocket_bridge.h" | 42 #include "content/child/websocket_bridge.h" |
40 #include "content/child/webthread_impl.h" | 43 #include "content/child/webthread_impl.h" |
41 #include "content/child/worker_task_runner.h" | 44 #include "content/child/worker_task_runner.h" |
42 #include "content/public/common/content_client.h" | 45 #include "content/public/common/content_client.h" |
43 #include "net/base/data_url.h" | 46 #include "net/base/data_url.h" |
44 #include "net/base/mime_util.h" | 47 #include "net/base/mime_util.h" |
45 #include "net/base/net_errors.h" | 48 #include "net/base/net_errors.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 : main_loop_(base::MessageLoop::current()), | 421 : main_loop_(base::MessageLoop::current()), |
419 shared_timer_func_(NULL), | 422 shared_timer_func_(NULL), |
420 shared_timer_fire_time_(0.0), | 423 shared_timer_fire_time_(0.0), |
421 shared_timer_fire_time_was_set_while_suspended_(false), | 424 shared_timer_fire_time_was_set_while_suspended_(false), |
422 shared_timer_suspended_(0), | 425 shared_timer_suspended_(0), |
423 current_thread_slot_(&DestroyCurrentThread) { | 426 current_thread_slot_(&DestroyCurrentThread) { |
424 // ChildThread may not exist in some tests. | 427 // ChildThread may not exist in some tests. |
425 if (ChildThread::current()) { | 428 if (ChildThread::current()) { |
426 geofencing_provider_.reset(new WebGeofencingProviderImpl( | 429 geofencing_provider_.reset(new WebGeofencingProviderImpl( |
427 ChildThread::current()->thread_safe_sender())); | 430 ChildThread::current()->thread_safe_sender())); |
| 431 thread_safe_sender_ = ChildThread::current()->thread_safe_sender(); |
| 432 notification_dispatcher_ = |
| 433 ChildThread::current()->notification_dispatcher(); |
428 } | 434 } |
429 } | 435 } |
430 | 436 |
431 BlinkPlatformImpl::~BlinkPlatformImpl() { | 437 BlinkPlatformImpl::~BlinkPlatformImpl() { |
432 } | 438 } |
433 | 439 |
434 WebURLLoader* BlinkPlatformImpl::createURLLoader() { | 440 WebURLLoader* BlinkPlatformImpl::createURLLoader() { |
435 ChildThread* child_thread = ChildThread::current(); | 441 ChildThread* child_thread = ChildThread::current(); |
436 // There may be no child thread in RenderViewTests. These tests can still use | 442 // There may be no child thread in RenderViewTests. These tests can still use |
437 // data URLs to bypass the ResourceDispatcher. | 443 // data URLs to bypass the ResourceDispatcher. |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 } | 1018 } |
1013 | 1019 |
1014 blink::WebCrypto* BlinkPlatformImpl::crypto() { | 1020 blink::WebCrypto* BlinkPlatformImpl::crypto() { |
1015 return &web_crypto_; | 1021 return &web_crypto_; |
1016 } | 1022 } |
1017 | 1023 |
1018 blink::WebGeofencingProvider* BlinkPlatformImpl::geofencingProvider() { | 1024 blink::WebGeofencingProvider* BlinkPlatformImpl::geofencingProvider() { |
1019 return geofencing_provider_.get(); | 1025 return geofencing_provider_.get(); |
1020 } | 1026 } |
1021 | 1027 |
| 1028 blink::WebNotificationManager* |
| 1029 BlinkPlatformImpl::notificationManager() { |
| 1030 if (!thread_safe_sender_.get() || !notification_dispatcher_.get()) |
| 1031 return nullptr; |
| 1032 |
| 1033 return NotificationManager::ThreadSpecificInstance( |
| 1034 thread_safe_sender_.get(), |
| 1035 notification_dispatcher_.get()); |
| 1036 } |
| 1037 |
1022 WebThemeEngine* BlinkPlatformImpl::themeEngine() { | 1038 WebThemeEngine* BlinkPlatformImpl::themeEngine() { |
1023 return &native_theme_engine_; | 1039 return &native_theme_engine_; |
1024 } | 1040 } |
1025 | 1041 |
1026 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { | 1042 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { |
1027 return &fallback_theme_engine_; | 1043 return &fallback_theme_engine_; |
1028 } | 1044 } |
1029 | 1045 |
1030 blink::Platform::FileHandle BlinkPlatformImpl::databaseOpenFile( | 1046 blink::Platform::FileHandle BlinkPlatformImpl::databaseOpenFile( |
1031 const blink::WebString& vfs_file_name, int desired_flags) { | 1047 const blink::WebString& vfs_file_name, int desired_flags) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 } | 1214 } |
1199 | 1215 |
1200 // static | 1216 // static |
1201 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 1217 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
1202 WebThreadImplForMessageLoop* impl = | 1218 WebThreadImplForMessageLoop* impl = |
1203 static_cast<WebThreadImplForMessageLoop*>(thread); | 1219 static_cast<WebThreadImplForMessageLoop*>(thread); |
1204 delete impl; | 1220 delete impl; |
1205 } | 1221 } |
1206 | 1222 |
1207 } // namespace content | 1223 } // namespace content |
OLD | NEW |