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/synchronization/lock.h" | 23 #include "base/synchronization/lock.h" |
24 #include "base/synchronization/waitable_event.h" | 24 #include "base/synchronization/waitable_event.h" |
25 #include "base/sys_info.h" | 25 #include "base/sys_info.h" |
26 #include "base/threading/platform_thread.h" | 26 #include "base/threading/platform_thread.h" |
27 #include "base/time/time.h" | 27 #include "base/time/time.h" |
28 #include "blink/public/resources/grit/blink_image_resources.h" | 28 #include "blink/public/resources/grit/blink_image_resources.h" |
29 #include "blink/public/resources/grit/blink_resources.h" | 29 #include "blink/public/resources/grit/blink_resources.h" |
30 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" | 30 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.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/background_sync/background_sync_provider.h" |
| 34 #include "content/child/background_sync/background_sync_provider_thread_proxy.h" |
33 #include "content/child/bluetooth/web_bluetooth_impl.h" | 35 #include "content/child/bluetooth/web_bluetooth_impl.h" |
34 #include "content/child/child_thread_impl.h" | 36 #include "content/child/child_thread_impl.h" |
35 #include "content/child/content_child_helpers.h" | 37 #include "content/child/content_child_helpers.h" |
36 #include "content/child/geofencing/web_geofencing_provider_impl.h" | 38 #include "content/child/geofencing/web_geofencing_provider_impl.h" |
37 #include "content/child/navigator_connect/navigator_connect_provider.h" | 39 #include "content/child/navigator_connect/navigator_connect_provider.h" |
38 #include "content/child/notifications/notification_dispatcher.h" | 40 #include "content/child/notifications/notification_dispatcher.h" |
39 #include "content/child/notifications/notification_manager.h" | 41 #include "content/child/notifications/notification_manager.h" |
40 #include "content/child/permissions/permission_dispatcher.h" | 42 #include "content/child/permissions/permission_dispatcher.h" |
41 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" | 43 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" |
42 #include "content/child/push_messaging/push_dispatcher.h" | 44 #include "content/child/push_messaging/push_dispatcher.h" |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 geofencing_provider_.reset(new WebGeofencingProviderImpl( | 443 geofencing_provider_.reset(new WebGeofencingProviderImpl( |
442 ChildThreadImpl::current()->thread_safe_sender())); | 444 ChildThreadImpl::current()->thread_safe_sender())); |
443 bluetooth_.reset( | 445 bluetooth_.reset( |
444 new WebBluetoothImpl(ChildThreadImpl::current()->thread_safe_sender())); | 446 new WebBluetoothImpl(ChildThreadImpl::current()->thread_safe_sender())); |
445 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); | 447 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); |
446 notification_dispatcher_ = | 448 notification_dispatcher_ = |
447 ChildThreadImpl::current()->notification_dispatcher(); | 449 ChildThreadImpl::current()->notification_dispatcher(); |
448 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); | 450 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); |
449 permission_client_.reset(new PermissionDispatcher( | 451 permission_client_.reset(new PermissionDispatcher( |
450 ChildThreadImpl::current()->service_registry())); | 452 ChildThreadImpl::current()->service_registry())); |
| 453 sync_provider_.reset(new BackgroundSyncProvider( |
| 454 ChildThreadImpl::current()->service_registry())); |
451 } | 455 } |
452 | 456 |
453 if (main_thread_task_runner_.get()) { | 457 if (main_thread_task_runner_.get()) { |
454 shared_timer_.SetTaskRunner(main_thread_task_runner_); | 458 shared_timer_.SetTaskRunner(main_thread_task_runner_); |
455 } | 459 } |
456 } | 460 } |
457 | 461 |
458 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { | 462 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { |
459 DCHECK(!current_thread_slot_.Get()); | 463 DCHECK(!current_thread_slot_.Get()); |
460 current_thread_slot_.Set(thread); | 464 current_thread_slot_.Set(thread); |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 if (!permission_client_.get()) | 1161 if (!permission_client_.get()) |
1158 return nullptr; | 1162 return nullptr; |
1159 | 1163 |
1160 if (IsMainThread()) | 1164 if (IsMainThread()) |
1161 return permission_client_.get(); | 1165 return permission_client_.get(); |
1162 | 1166 |
1163 return PermissionDispatcherThreadProxy::GetThreadInstance( | 1167 return PermissionDispatcherThreadProxy::GetThreadInstance( |
1164 main_thread_task_runner_.get(), permission_client_.get()); | 1168 main_thread_task_runner_.get(), permission_client_.get()); |
1165 } | 1169 } |
1166 | 1170 |
| 1171 blink::WebSyncProvider* BlinkPlatformImpl::backgroundSyncProvider() { |
| 1172 if (!sync_provider_.get()) |
| 1173 return nullptr; |
| 1174 |
| 1175 if (IsMainThread()) |
| 1176 return sync_provider_.get(); |
| 1177 |
| 1178 return BackgroundSyncProviderThreadProxy::GetThreadInstance( |
| 1179 main_thread_task_runner_.get(), sync_provider_.get()); |
| 1180 } |
| 1181 |
1167 WebThemeEngine* BlinkPlatformImpl::themeEngine() { | 1182 WebThemeEngine* BlinkPlatformImpl::themeEngine() { |
1168 return &native_theme_engine_; | 1183 return &native_theme_engine_; |
1169 } | 1184 } |
1170 | 1185 |
1171 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { | 1186 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { |
1172 return &fallback_theme_engine_; | 1187 return &fallback_theme_engine_; |
1173 } | 1188 } |
1174 | 1189 |
1175 blink::Platform::FileHandle BlinkPlatformImpl::databaseOpenFile( | 1190 blink::Platform::FileHandle BlinkPlatformImpl::databaseOpenFile( |
1176 const blink::WebString& vfs_file_name, int desired_flags) { | 1191 const blink::WebString& vfs_file_name, int desired_flags) { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( | 1345 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( |
1331 static_cast<ui::DomCode>(dom_code))); | 1346 static_cast<ui::DomCode>(dom_code))); |
1332 } | 1347 } |
1333 | 1348 |
1334 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { | 1349 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { |
1335 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( | 1350 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( |
1336 code.utf8().data())); | 1351 code.utf8().data())); |
1337 } | 1352 } |
1338 | 1353 |
1339 } // namespace content | 1354 } // namespace content |
OLD | NEW |