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/thread_task_runner_handle.h" | 26 #include "base/thread_task_runner_handle.h" |
27 #include "base/threading/platform_thread.h" | 27 #include "base/threading/platform_thread.h" |
28 #include "base/time/time.h" | 28 #include "base/time/time.h" |
29 #include "base/trace_event/memory_dump_manager.h" | 29 #include "base/trace_event/memory_dump_manager.h" |
30 #include "blink/public/resources/grit/blink_image_resources.h" | 30 #include "blink/public/resources/grit/blink_image_resources.h" |
31 #include "blink/public/resources/grit/blink_resources.h" | 31 #include "blink/public/resources/grit/blink_resources.h" |
32 #include "components/mime_util/mime_util.h" | 32 #include "components/mime_util/mime_util.h" |
33 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" | 33 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" |
34 #include "content/app/resources/grit/content_resources.h" | 34 #include "content/app/resources/grit/content_resources.h" |
35 #include "content/app/strings/grit/content_strings.h" | 35 #include "content/app/strings/grit/content_strings.h" |
| 36 #include "content/child/background_sync/background_sync_provider.h" |
| 37 #include "content/child/background_sync/background_sync_provider_thread_proxy.h" |
36 #include "content/child/bluetooth/web_bluetooth_impl.h" | 38 #include "content/child/bluetooth/web_bluetooth_impl.h" |
37 #include "content/child/child_thread_impl.h" | 39 #include "content/child/child_thread_impl.h" |
38 #include "content/child/content_child_helpers.h" | 40 #include "content/child/content_child_helpers.h" |
39 #include "content/child/geofencing/web_geofencing_provider_impl.h" | 41 #include "content/child/geofencing/web_geofencing_provider_impl.h" |
40 #include "content/child/navigator_connect/navigator_connect_provider.h" | 42 #include "content/child/navigator_connect/navigator_connect_provider.h" |
41 #include "content/child/notifications/notification_dispatcher.h" | 43 #include "content/child/notifications/notification_dispatcher.h" |
42 #include "content/child/notifications/notification_manager.h" | 44 #include "content/child/notifications/notification_manager.h" |
43 #include "content/child/permissions/permission_dispatcher.h" | 45 #include "content/child/permissions/permission_dispatcher.h" |
44 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" | 46 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" |
45 #include "content/child/push_messaging/push_dispatcher.h" | 47 #include "content/child/push_messaging/push_dispatcher.h" |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 geofencing_provider_.reset(new WebGeofencingProviderImpl( | 450 geofencing_provider_.reset(new WebGeofencingProviderImpl( |
449 ChildThreadImpl::current()->thread_safe_sender())); | 451 ChildThreadImpl::current()->thread_safe_sender())); |
450 bluetooth_.reset( | 452 bluetooth_.reset( |
451 new WebBluetoothImpl(ChildThreadImpl::current()->thread_safe_sender())); | 453 new WebBluetoothImpl(ChildThreadImpl::current()->thread_safe_sender())); |
452 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); | 454 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); |
453 notification_dispatcher_ = | 455 notification_dispatcher_ = |
454 ChildThreadImpl::current()->notification_dispatcher(); | 456 ChildThreadImpl::current()->notification_dispatcher(); |
455 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); | 457 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); |
456 permission_client_.reset(new PermissionDispatcher( | 458 permission_client_.reset(new PermissionDispatcher( |
457 ChildThreadImpl::current()->service_registry())); | 459 ChildThreadImpl::current()->service_registry())); |
| 460 sync_provider_.reset(new BackgroundSyncProvider( |
| 461 ChildThreadImpl::current()->service_registry())); |
458 } | 462 } |
459 | 463 |
460 if (main_thread_task_runner_.get()) { | 464 if (main_thread_task_runner_.get()) { |
461 shared_timer_.SetTaskRunner(main_thread_task_runner_); | 465 shared_timer_.SetTaskRunner(main_thread_task_runner_); |
462 } | 466 } |
463 } | 467 } |
464 | 468 |
465 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { | 469 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { |
466 DCHECK(!current_thread_slot_.Get()); | 470 DCHECK(!current_thread_slot_.Get()); |
467 current_thread_slot_.Set(thread); | 471 current_thread_slot_.Set(thread); |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 if (!permission_client_.get()) | 1197 if (!permission_client_.get()) |
1194 return nullptr; | 1198 return nullptr; |
1195 | 1199 |
1196 if (IsMainThread()) | 1200 if (IsMainThread()) |
1197 return permission_client_.get(); | 1201 return permission_client_.get(); |
1198 | 1202 |
1199 return PermissionDispatcherThreadProxy::GetThreadInstance( | 1203 return PermissionDispatcherThreadProxy::GetThreadInstance( |
1200 main_thread_task_runner_.get(), permission_client_.get()); | 1204 main_thread_task_runner_.get(), permission_client_.get()); |
1201 } | 1205 } |
1202 | 1206 |
| 1207 blink::WebSyncProvider* BlinkPlatformImpl::backgroundSyncProvider() { |
| 1208 if (!sync_provider_.get()) |
| 1209 return nullptr; |
| 1210 |
| 1211 if (IsMainThread()) |
| 1212 return sync_provider_.get(); |
| 1213 |
| 1214 return BackgroundSyncProviderThreadProxy::GetThreadInstance( |
| 1215 main_thread_task_runner_.get(), sync_provider_.get()); |
| 1216 } |
| 1217 |
1203 WebThemeEngine* BlinkPlatformImpl::themeEngine() { | 1218 WebThemeEngine* BlinkPlatformImpl::themeEngine() { |
1204 return &native_theme_engine_; | 1219 return &native_theme_engine_; |
1205 } | 1220 } |
1206 | 1221 |
1207 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { | 1222 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { |
1208 return &fallback_theme_engine_; | 1223 return &fallback_theme_engine_; |
1209 } | 1224 } |
1210 | 1225 |
1211 blink::Platform::FileHandle BlinkPlatformImpl::databaseOpenFile( | 1226 blink::Platform::FileHandle BlinkPlatformImpl::databaseOpenFile( |
1212 const blink::WebString& vfs_file_name, int desired_flags) { | 1227 const blink::WebString& vfs_file_name, int desired_flags) { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( | 1381 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( |
1367 static_cast<ui::DomCode>(dom_code))); | 1382 static_cast<ui::DomCode>(dom_code))); |
1368 } | 1383 } |
1369 | 1384 |
1370 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { | 1385 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { |
1371 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( | 1386 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( |
1372 code.utf8().data())); | 1387 code.utf8().data())); |
1373 } | 1388 } |
1374 | 1389 |
1375 } // namespace content | 1390 } // namespace content |
OLD | NEW |