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