| 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 26 matching lines...) Expand all Loading... |
| 37 #include "components/mime_util/mime_util.h" | 37 #include "components/mime_util/mime_util.h" |
| 38 #include "components/scheduler/child/web_task_runner_impl.h" | 38 #include "components/scheduler/child/web_task_runner_impl.h" |
| 39 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" | 39 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" |
| 40 #include "content/app/resources/grit/content_resources.h" | 40 #include "content/app/resources/grit/content_resources.h" |
| 41 #include "content/app/strings/grit/content_strings.h" | 41 #include "content/app/strings/grit/content_strings.h" |
| 42 #include "content/child/background_sync/background_sync_provider.h" | 42 #include "content/child/background_sync/background_sync_provider.h" |
| 43 #include "content/child/child_thread_impl.h" | 43 #include "content/child/child_thread_impl.h" |
| 44 #include "content/child/content_child_helpers.h" | 44 #include "content/child/content_child_helpers.h" |
| 45 #include "content/child/notifications/notification_dispatcher.h" | 45 #include "content/child/notifications/notification_dispatcher.h" |
| 46 #include "content/child/notifications/notification_manager.h" | 46 #include "content/child/notifications/notification_manager.h" |
| 47 #include "content/child/permissions/permission_dispatcher.h" | |
| 48 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" | |
| 49 #include "content/child/push_messaging/push_dispatcher.h" | 47 #include "content/child/push_messaging/push_dispatcher.h" |
| 50 #include "content/child/push_messaging/push_provider.h" | 48 #include "content/child/push_messaging/push_provider.h" |
| 51 #include "content/child/thread_safe_sender.h" | 49 #include "content/child/thread_safe_sender.h" |
| 52 #include "content/child/web_url_loader_impl.h" | 50 #include "content/child/web_url_loader_impl.h" |
| 53 #include "content/child/web_url_request_util.h" | 51 #include "content/child/web_url_request_util.h" |
| 54 #include "content/child/websocket_bridge.h" | 52 #include "content/child/websocket_bridge.h" |
| 55 #include "content/child/worker_thread_registry.h" | 53 #include "content/child/worker_thread_registry.h" |
| 56 #include "content/public/common/content_client.h" | 54 #include "content/public/common/content_client.h" |
| 57 #include "net/base/data_url.h" | 55 #include "net/base/data_url.h" |
| 58 #include "net/base/net_errors.h" | 56 #include "net/base/net_errors.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 InternalInit(); | 377 InternalInit(); |
| 380 } | 378 } |
| 381 | 379 |
| 382 void BlinkPlatformImpl::InternalInit() { | 380 void BlinkPlatformImpl::InternalInit() { |
| 383 // ChildThread may not exist in some tests. | 381 // ChildThread may not exist in some tests. |
| 384 if (ChildThreadImpl::current()) { | 382 if (ChildThreadImpl::current()) { |
| 385 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); | 383 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); |
| 386 notification_dispatcher_ = | 384 notification_dispatcher_ = |
| 387 ChildThreadImpl::current()->notification_dispatcher(); | 385 ChildThreadImpl::current()->notification_dispatcher(); |
| 388 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); | 386 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); |
| 389 permission_client_.reset(new PermissionDispatcher( | |
| 390 ChildThreadImpl::current()->GetRemoteInterfaces())); | |
| 391 main_thread_sync_provider_.reset( | 387 main_thread_sync_provider_.reset( |
| 392 new BackgroundSyncProvider(main_thread_task_runner_.get())); | 388 new BackgroundSyncProvider(main_thread_task_runner_.get())); |
| 393 } | 389 } |
| 394 } | 390 } |
| 395 | 391 |
| 396 void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate( | 392 void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate( |
| 397 scheduler::WebThreadBase* thread) { | 393 scheduler::WebThreadBase* thread) { |
| 398 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 394 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 399 base::WaitableEvent::InitialState::NOT_SIGNALED); | 395 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 400 thread->GetTaskRunner()->PostTask( | 396 thread->GetTaskRunner()->PostTask( |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 } | 870 } |
| 875 | 871 |
| 876 blink::WebPushProvider* BlinkPlatformImpl::pushProvider() { | 872 blink::WebPushProvider* BlinkPlatformImpl::pushProvider() { |
| 877 if (!thread_safe_sender_.get() || !push_dispatcher_.get()) | 873 if (!thread_safe_sender_.get() || !push_dispatcher_.get()) |
| 878 return nullptr; | 874 return nullptr; |
| 879 | 875 |
| 880 return PushProvider::ThreadSpecificInstance(thread_safe_sender_.get(), | 876 return PushProvider::ThreadSpecificInstance(thread_safe_sender_.get(), |
| 881 push_dispatcher_.get()); | 877 push_dispatcher_.get()); |
| 882 } | 878 } |
| 883 | 879 |
| 884 blink::WebPermissionClient* BlinkPlatformImpl::permissionClient() { | |
| 885 if (!permission_client_.get()) | |
| 886 return nullptr; | |
| 887 | |
| 888 if (IsMainThread()) | |
| 889 return permission_client_.get(); | |
| 890 | |
| 891 return PermissionDispatcherThreadProxy::GetThreadInstance( | |
| 892 main_thread_task_runner_.get(), permission_client_.get()); | |
| 893 } | |
| 894 | |
| 895 blink::WebSyncProvider* BlinkPlatformImpl::backgroundSyncProvider() { | 880 blink::WebSyncProvider* BlinkPlatformImpl::backgroundSyncProvider() { |
| 896 if (IsMainThread()) | 881 if (IsMainThread()) |
| 897 return main_thread_sync_provider_.get(); | 882 return main_thread_sync_provider_.get(); |
| 898 | 883 |
| 899 return BackgroundSyncProvider::GetOrCreateThreadSpecificInstance( | 884 return BackgroundSyncProvider::GetOrCreateThreadSpecificInstance( |
| 900 main_thread_task_runner_.get()); | 885 main_thread_task_runner_.get()); |
| 901 } | 886 } |
| 902 | 887 |
| 903 WebThemeEngine* BlinkPlatformImpl::themeEngine() { | 888 WebThemeEngine* BlinkPlatformImpl::themeEngine() { |
| 904 return &native_theme_engine_; | 889 return &native_theme_engine_; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 988 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
| 1004 static_cast<ui::DomKey>(dom_key))); | 989 static_cast<ui::DomKey>(dom_key))); |
| 1005 } | 990 } |
| 1006 | 991 |
| 1007 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 992 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
| 1008 return static_cast<int>( | 993 return static_cast<int>( |
| 1009 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); | 994 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); |
| 1010 } | 995 } |
| 1011 | 996 |
| 1012 } // namespace content | 997 } // namespace content |
| OLD | NEW |