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 20 matching lines...) Expand all Loading... |
31 #include "base/trace_event/memory_allocator_dump_guid.h" | 31 #include "base/trace_event/memory_allocator_dump_guid.h" |
32 #include "base/trace_event/memory_dump_manager.h" | 32 #include "base/trace_event/memory_dump_manager.h" |
33 #include "base/trace_event/trace_event.h" | 33 #include "base/trace_event/trace_event.h" |
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 "components/mime_util/mime_util.h" | 36 #include "components/mime_util/mime_util.h" |
37 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" | 37 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.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/background_sync/background_sync_provider.h" | 40 #include "content/child/background_sync/background_sync_provider.h" |
41 #include "content/child/background_sync/background_sync_provider_thread_proxy.h" | |
42 #include "content/child/child_thread_impl.h" | 41 #include "content/child/child_thread_impl.h" |
43 #include "content/child/content_child_helpers.h" | 42 #include "content/child/content_child_helpers.h" |
44 #include "content/child/geofencing/web_geofencing_provider_impl.h" | 43 #include "content/child/geofencing/web_geofencing_provider_impl.h" |
45 #include "content/child/navigator_connect/service_port_provider.h" | 44 #include "content/child/navigator_connect/service_port_provider.h" |
46 #include "content/child/notifications/notification_dispatcher.h" | 45 #include "content/child/notifications/notification_dispatcher.h" |
47 #include "content/child/notifications/notification_manager.h" | 46 #include "content/child/notifications/notification_manager.h" |
48 #include "content/child/permissions/permission_dispatcher.h" | 47 #include "content/child/permissions/permission_dispatcher.h" |
49 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" | 48 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" |
50 #include "content/child/push_messaging/push_dispatcher.h" | 49 #include "content/child/push_messaging/push_dispatcher.h" |
51 #include "content/child/push_messaging/push_provider.h" | 50 #include "content/child/push_messaging/push_provider.h" |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 // ChildThread may not exist in some tests. | 451 // ChildThread may not exist in some tests. |
453 if (ChildThreadImpl::current()) { | 452 if (ChildThreadImpl::current()) { |
454 geofencing_provider_.reset(new WebGeofencingProviderImpl( | 453 geofencing_provider_.reset(new WebGeofencingProviderImpl( |
455 ChildThreadImpl::current()->thread_safe_sender())); | 454 ChildThreadImpl::current()->thread_safe_sender())); |
456 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); | 455 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); |
457 notification_dispatcher_ = | 456 notification_dispatcher_ = |
458 ChildThreadImpl::current()->notification_dispatcher(); | 457 ChildThreadImpl::current()->notification_dispatcher(); |
459 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); | 458 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); |
460 permission_client_.reset(new PermissionDispatcher( | 459 permission_client_.reset(new PermissionDispatcher( |
461 ChildThreadImpl::current()->service_registry())); | 460 ChildThreadImpl::current()->service_registry())); |
462 sync_provider_.reset(new BackgroundSyncProvider( | |
463 ChildThreadImpl::current()->service_registry())); | |
464 } | 461 } |
465 } | 462 } |
466 | 463 |
467 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { | 464 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { |
468 DCHECK(!current_thread_slot_.Get()); | 465 DCHECK(!current_thread_slot_.Get()); |
469 current_thread_slot_.Set(thread); | 466 current_thread_slot_.Set(thread); |
470 } | 467 } |
471 | 468 |
472 BlinkPlatformImpl::~BlinkPlatformImpl() { | 469 BlinkPlatformImpl::~BlinkPlatformImpl() { |
473 } | 470 } |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 return nullptr; | 1203 return nullptr; |
1207 | 1204 |
1208 if (IsMainThread()) | 1205 if (IsMainThread()) |
1209 return permission_client_.get(); | 1206 return permission_client_.get(); |
1210 | 1207 |
1211 return PermissionDispatcherThreadProxy::GetThreadInstance( | 1208 return PermissionDispatcherThreadProxy::GetThreadInstance( |
1212 main_thread_task_runner_.get(), permission_client_.get()); | 1209 main_thread_task_runner_.get(), permission_client_.get()); |
1213 } | 1210 } |
1214 | 1211 |
1215 blink::WebSyncProvider* BlinkPlatformImpl::backgroundSyncProvider() { | 1212 blink::WebSyncProvider* BlinkPlatformImpl::backgroundSyncProvider() { |
1216 if (!sync_provider_.get()) | 1213 return BackgroundSyncProvider::GetThreadInstance( |
1217 return nullptr; | 1214 main_thread_task_runner_.get()); |
1218 | |
1219 if (IsMainThread()) | |
1220 return sync_provider_.get(); | |
1221 | |
1222 return BackgroundSyncProviderThreadProxy::GetThreadInstance( | |
1223 main_thread_task_runner_.get(), sync_provider_.get()); | |
1224 } | 1215 } |
1225 | 1216 |
1226 WebThemeEngine* BlinkPlatformImpl::themeEngine() { | 1217 WebThemeEngine* BlinkPlatformImpl::themeEngine() { |
1227 return &native_theme_engine_; | 1218 return &native_theme_engine_; |
1228 } | 1219 } |
1229 | 1220 |
1230 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { | 1221 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { |
1231 return &fallback_theme_engine_; | 1222 return &fallback_theme_engine_; |
1232 } | 1223 } |
1233 | 1224 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 1383 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
1393 static_cast<ui::DomKey>(dom_key))); | 1384 static_cast<ui::DomKey>(dom_key))); |
1394 } | 1385 } |
1395 | 1386 |
1396 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 1387 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
1397 return static_cast<int>( | 1388 return static_cast<int>( |
1398 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8().data())); | 1389 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8().data())); |
1399 } | 1390 } |
1400 | 1391 |
1401 } // namespace content | 1392 } // namespace content |
OLD | NEW |