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_socket_stream_handle_impl.h" | 41 #include "content/child/web_socket_stream_handle_impl.h" |
39 #include "content/child/web_url_loader_impl.h" | 42 #include "content/child/web_url_loader_impl.h" |
40 #include "content/child/websocket_bridge.h" | 43 #include "content/child/websocket_bridge.h" |
41 #include "content/child/webthread_impl.h" | 44 #include "content/child/webthread_impl.h" |
42 #include "content/child/worker_task_runner.h" | 45 #include "content/child/worker_task_runner.h" |
43 #include "content/public/common/content_client.h" | 46 #include "content/public/common/content_client.h" |
44 #include "net/base/data_url.h" | 47 #include "net/base/data_url.h" |
45 #include "net/base/mime_util.h" | 48 #include "net/base/mime_util.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
420 : main_loop_(base::MessageLoop::current()), | 423 : main_loop_(base::MessageLoop::current()), |
421 shared_timer_func_(NULL), | 424 shared_timer_func_(NULL), |
422 shared_timer_fire_time_(0.0), | 425 shared_timer_fire_time_(0.0), |
423 shared_timer_fire_time_was_set_while_suspended_(false), | 426 shared_timer_fire_time_was_set_while_suspended_(false), |
424 shared_timer_suspended_(0), | 427 shared_timer_suspended_(0), |
425 current_thread_slot_(&DestroyCurrentThread) { | 428 current_thread_slot_(&DestroyCurrentThread) { |
426 // ChildThread may not exist in some tests. | 429 // ChildThread may not exist in some tests. |
427 if (ChildThread::current()) { | 430 if (ChildThread::current()) { |
428 geofencing_provider_.reset(new WebGeofencingProviderImpl( | 431 geofencing_provider_.reset(new WebGeofencingProviderImpl( |
429 ChildThread::current()->thread_safe_sender())); | 432 ChildThread::current()->thread_safe_sender())); |
433 thread_safe_sender_ = ChildThread::current()->thread_safe_sender(); | |
434 notification_dispatcher_ = | |
435 ChildThread::current()->notification_dispatcher(); | |
430 } | 436 } |
431 } | 437 } |
432 | 438 |
433 BlinkPlatformImpl::~BlinkPlatformImpl() { | 439 BlinkPlatformImpl::~BlinkPlatformImpl() { |
434 } | 440 } |
435 | 441 |
436 WebURLLoader* BlinkPlatformImpl::createURLLoader() { | 442 WebURLLoader* BlinkPlatformImpl::createURLLoader() { |
437 ChildThread* child_thread = ChildThread::current(); | 443 ChildThread* child_thread = ChildThread::current(); |
438 // There may be no child thread in RenderViewTests. These tests can still use | 444 // There may be no child thread in RenderViewTests. These tests can still use |
439 // data URLs to bypass the ResourceDispatcher. | 445 // data URLs to bypass the ResourceDispatcher. |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1018 } | 1024 } |
1019 | 1025 |
1020 blink::WebCrypto* BlinkPlatformImpl::crypto() { | 1026 blink::WebCrypto* BlinkPlatformImpl::crypto() { |
1021 return &web_crypto_; | 1027 return &web_crypto_; |
1022 } | 1028 } |
1023 | 1029 |
1024 blink::WebGeofencingProvider* BlinkPlatformImpl::geofencingProvider() { | 1030 blink::WebGeofencingProvider* BlinkPlatformImpl::geofencingProvider() { |
1025 return geofencing_provider_.get(); | 1031 return geofencing_provider_.get(); |
1026 } | 1032 } |
1027 | 1033 |
1034 blink::WebNotificationManager* | |
1035 BlinkPlatformImpl::notificationManager() { | |
1036 if (!thread_safe_sender_.get() || !notification_dispatcher_.get()) | |
1037 return nullptr; | |
1038 | |
1039 return NotificationManager::ThreadSpecificInstance( | |
1040 thread_safe_sender_.get(), | |
Mike West
2014/10/24 13:20:18
Do you need to store the ThreadSafeSender and Noti
Peter Beverloo
2014/10/24 13:57:35
ChildThread::current() is stored in a TLS and is n
| |
1041 notification_dispatcher_.get()); | |
1042 } | |
1043 | |
1028 WebThemeEngine* BlinkPlatformImpl::themeEngine() { | 1044 WebThemeEngine* BlinkPlatformImpl::themeEngine() { |
1029 return &native_theme_engine_; | 1045 return &native_theme_engine_; |
1030 } | 1046 } |
1031 | 1047 |
1032 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { | 1048 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { |
1033 return &fallback_theme_engine_; | 1049 return &fallback_theme_engine_; |
1034 } | 1050 } |
1035 | 1051 |
1036 blink::Platform::FileHandle BlinkPlatformImpl::databaseOpenFile( | 1052 blink::Platform::FileHandle BlinkPlatformImpl::databaseOpenFile( |
1037 const blink::WebString& vfs_file_name, int desired_flags) { | 1053 const blink::WebString& vfs_file_name, int desired_flags) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1204 } | 1220 } |
1205 | 1221 |
1206 // static | 1222 // static |
1207 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 1223 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
1208 WebThreadImplForMessageLoop* impl = | 1224 WebThreadImplForMessageLoop* impl = |
1209 static_cast<WebThreadImplForMessageLoop*>(thread); | 1225 static_cast<WebThreadImplForMessageLoop*>(thread); |
1210 delete impl; | 1226 delete impl; |
1211 } | 1227 } |
1212 | 1228 |
1213 } // namespace content | 1229 } // namespace content |
OLD | NEW |