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 <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "blink/public/resources/grit/blink_image_resources.h" | 34 #include "blink/public/resources/grit/blink_image_resources.h" |
35 #include "blink/public/resources/grit/blink_resources.h" | 35 #include "blink/public/resources/grit/blink_resources.h" |
36 #include "build/build_config.h" | 36 #include "build/build_config.h" |
37 #include "components/mime_util/mime_util.h" | 37 #include "components/mime_util/mime_util.h" |
38 #include "content/app/resources/grit/content_resources.h" | 38 #include "content/app/resources/grit/content_resources.h" |
39 #include "content/app/strings/grit/content_strings.h" | 39 #include "content/app/strings/grit/content_strings.h" |
40 #include "content/child/child_thread_impl.h" | 40 #include "content/child/child_thread_impl.h" |
41 #include "content/child/content_child_helpers.h" | 41 #include "content/child/content_child_helpers.h" |
42 #include "content/child/notifications/notification_dispatcher.h" | 42 #include "content/child/notifications/notification_dispatcher.h" |
43 #include "content/child/notifications/notification_manager.h" | 43 #include "content/child/notifications/notification_manager.h" |
44 #include "content/child/push_messaging/push_dispatcher.h" | |
45 #include "content/child/push_messaging/push_provider.h" | 44 #include "content/child/push_messaging/push_provider.h" |
46 #include "content/child/thread_safe_sender.h" | 45 #include "content/child/thread_safe_sender.h" |
47 #include "content/child/web_url_loader_impl.h" | 46 #include "content/child/web_url_loader_impl.h" |
48 #include "content/child/web_url_request_util.h" | 47 #include "content/child/web_url_request_util.h" |
49 #include "content/child/worker_thread_registry.h" | 48 #include "content/child/worker_thread_registry.h" |
50 #include "content/public/common/content_client.h" | 49 #include "content/public/common/content_client.h" |
51 #include "content/public/common/service_manager_connection.h" | 50 #include "content/public/common/service_manager_connection.h" |
52 #include "net/base/net_errors.h" | 51 #include "net/base/net_errors.h" |
53 #include "services/service_manager/public/cpp/connector.h" | 52 #include "services/service_manager/public/cpp/connector.h" |
54 #include "services/service_manager/public/interfaces/connector.mojom.h" | 53 #include "services/service_manager/public/interfaces/connector.mojom.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 compositor_thread_(nullptr) { | 357 compositor_thread_(nullptr) { |
359 InternalInit(); | 358 InternalInit(); |
360 } | 359 } |
361 | 360 |
362 void BlinkPlatformImpl::InternalInit() { | 361 void BlinkPlatformImpl::InternalInit() { |
363 // ChildThread may not exist in some tests. | 362 // ChildThread may not exist in some tests. |
364 if (ChildThreadImpl::current()) { | 363 if (ChildThreadImpl::current()) { |
365 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); | 364 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); |
366 notification_dispatcher_ = | 365 notification_dispatcher_ = |
367 ChildThreadImpl::current()->notification_dispatcher(); | 366 ChildThreadImpl::current()->notification_dispatcher(); |
368 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); | |
369 } | 367 } |
370 } | 368 } |
371 | 369 |
372 void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate( | 370 void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate( |
373 blink::scheduler::WebThreadBase* thread) { | 371 blink::scheduler::WebThreadBase* thread) { |
374 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 372 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
375 base::WaitableEvent::InitialState::NOT_SIGNALED); | 373 base::WaitableEvent::InitialState::NOT_SIGNALED); |
376 thread->GetTaskRunner()->PostTask( | 374 thread->GetTaskRunner()->PostTask( |
377 FROM_HERE, | 375 FROM_HERE, |
378 base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, base::Unretained(this), | 376 base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, base::Unretained(this), |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 BlinkPlatformImpl::notificationManager() { | 726 BlinkPlatformImpl::notificationManager() { |
729 if (!thread_safe_sender_.get() || !notification_dispatcher_.get()) | 727 if (!thread_safe_sender_.get() || !notification_dispatcher_.get()) |
730 return nullptr; | 728 return nullptr; |
731 | 729 |
732 return NotificationManager::ThreadSpecificInstance( | 730 return NotificationManager::ThreadSpecificInstance( |
733 thread_safe_sender_.get(), | 731 thread_safe_sender_.get(), |
734 notification_dispatcher_.get()); | 732 notification_dispatcher_.get()); |
735 } | 733 } |
736 | 734 |
737 blink::WebPushProvider* BlinkPlatformImpl::pushProvider() { | 735 blink::WebPushProvider* BlinkPlatformImpl::pushProvider() { |
738 if (!thread_safe_sender_.get() || !push_dispatcher_.get()) | 736 return PushProvider::ThreadSpecificInstance(main_thread_task_runner_); |
739 return nullptr; | |
740 | |
741 return PushProvider::ThreadSpecificInstance(thread_safe_sender_.get(), | |
742 push_dispatcher_.get()); | |
743 } | 737 } |
744 | 738 |
745 WebThemeEngine* BlinkPlatformImpl::themeEngine() { | 739 WebThemeEngine* BlinkPlatformImpl::themeEngine() { |
746 return &native_theme_engine_; | 740 return &native_theme_engine_; |
747 } | 741 } |
748 | 742 |
749 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { | 743 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { |
750 return &fallback_theme_engine_; | 744 return &fallback_theme_engine_; |
751 } | 745 } |
752 | 746 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 844 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
851 static_cast<ui::DomKey>(dom_key))); | 845 static_cast<ui::DomKey>(dom_key))); |
852 } | 846 } |
853 | 847 |
854 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 848 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
855 return static_cast<int>( | 849 return static_cast<int>( |
856 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); | 850 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); |
857 } | 851 } |
858 | 852 |
859 } // namespace content | 853 } // namespace content |
OLD | NEW |