Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: content/child/blink_platform_impl.cc

Issue 1104283002: [Background Sync] Add renderer code to interface between JS API and back-end service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bgsync-mojo
Patch Set: Add comment re: BackgroundSyncProvider lifetime Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
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/mime_util/mime_util.h" 30 #include "components/mime_util/mime_util.h"
31 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" 31 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h"
32 #include "content/app/resources/grit/content_resources.h" 32 #include "content/app/resources/grit/content_resources.h"
33 #include "content/app/strings/grit/content_strings.h" 33 #include "content/app/strings/grit/content_strings.h"
34 #include "content/child/background_sync/background_sync_provider.h"
35 #include "content/child/background_sync/background_sync_provider_thread_proxy.h"
34 #include "content/child/bluetooth/web_bluetooth_impl.h" 36 #include "content/child/bluetooth/web_bluetooth_impl.h"
35 #include "content/child/child_thread_impl.h" 37 #include "content/child/child_thread_impl.h"
36 #include "content/child/content_child_helpers.h" 38 #include "content/child/content_child_helpers.h"
37 #include "content/child/geofencing/web_geofencing_provider_impl.h" 39 #include "content/child/geofencing/web_geofencing_provider_impl.h"
38 #include "content/child/navigator_connect/navigator_connect_provider.h" 40 #include "content/child/navigator_connect/navigator_connect_provider.h"
39 #include "content/child/notifications/notification_dispatcher.h" 41 #include "content/child/notifications/notification_dispatcher.h"
40 #include "content/child/notifications/notification_manager.h" 42 #include "content/child/notifications/notification_manager.h"
41 #include "content/child/permissions/permission_dispatcher.h" 43 #include "content/child/permissions/permission_dispatcher.h"
42 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" 44 #include "content/child/permissions/permission_dispatcher_thread_proxy.h"
43 #include "content/child/push_messaging/push_dispatcher.h" 45 #include "content/child/push_messaging/push_dispatcher.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 geofencing_provider_.reset(new WebGeofencingProviderImpl( 446 geofencing_provider_.reset(new WebGeofencingProviderImpl(
445 ChildThreadImpl::current()->thread_safe_sender())); 447 ChildThreadImpl::current()->thread_safe_sender()));
446 bluetooth_.reset( 448 bluetooth_.reset(
447 new WebBluetoothImpl(ChildThreadImpl::current()->thread_safe_sender())); 449 new WebBluetoothImpl(ChildThreadImpl::current()->thread_safe_sender()));
448 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); 450 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender();
449 notification_dispatcher_ = 451 notification_dispatcher_ =
450 ChildThreadImpl::current()->notification_dispatcher(); 452 ChildThreadImpl::current()->notification_dispatcher();
451 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); 453 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher();
452 permission_client_.reset(new PermissionDispatcher( 454 permission_client_.reset(new PermissionDispatcher(
453 ChildThreadImpl::current()->service_registry())); 455 ChildThreadImpl::current()->service_registry()));
456 sync_provider_.reset(new BackgroundSyncProvider(
457 ChildThreadImpl::current()->service_registry()));
454 } 458 }
455 459
456 if (main_thread_task_runner_.get()) { 460 if (main_thread_task_runner_.get()) {
457 shared_timer_.SetTaskRunner(main_thread_task_runner_); 461 shared_timer_.SetTaskRunner(main_thread_task_runner_);
458 } 462 }
459 } 463 }
460 464
461 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { 465 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) {
462 DCHECK(!current_thread_slot_.Get()); 466 DCHECK(!current_thread_slot_.Get());
463 current_thread_slot_.Set(thread); 467 current_thread_slot_.Set(thread);
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 if (!permission_client_.get()) 1174 if (!permission_client_.get())
1171 return nullptr; 1175 return nullptr;
1172 1176
1173 if (IsMainThread()) 1177 if (IsMainThread())
1174 return permission_client_.get(); 1178 return permission_client_.get();
1175 1179
1176 return PermissionDispatcherThreadProxy::GetThreadInstance( 1180 return PermissionDispatcherThreadProxy::GetThreadInstance(
1177 main_thread_task_runner_.get(), permission_client_.get()); 1181 main_thread_task_runner_.get(), permission_client_.get());
1178 } 1182 }
1179 1183
1184 blink::WebSyncProvider* BlinkPlatformImpl::backgroundSyncProvider() {
1185 if (!sync_provider_.get())
1186 return nullptr;
1187
1188 if (IsMainThread())
1189 return sync_provider_.get();
1190
1191 return BackgroundSyncProviderThreadProxy::GetThreadInstance(
1192 main_thread_task_runner_.get(), sync_provider_.get());
1193 }
1194
1180 WebThemeEngine* BlinkPlatformImpl::themeEngine() { 1195 WebThemeEngine* BlinkPlatformImpl::themeEngine() {
1181 return &native_theme_engine_; 1196 return &native_theme_engine_;
1182 } 1197 }
1183 1198
1184 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { 1199 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() {
1185 return &fallback_theme_engine_; 1200 return &fallback_theme_engine_;
1186 } 1201 }
1187 1202
1188 blink::Platform::FileHandle BlinkPlatformImpl::databaseOpenFile( 1203 blink::Platform::FileHandle BlinkPlatformImpl::databaseOpenFile(
1189 const blink::WebString& vfs_file_name, int desired_flags) { 1204 const blink::WebString& vfs_file_name, int desired_flags) {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( 1358 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString(
1344 static_cast<ui::DomCode>(dom_code))); 1359 static_cast<ui::DomCode>(dom_code)));
1345 } 1360 }
1346 1361
1347 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { 1362 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) {
1348 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( 1363 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode(
1349 code.utf8().data())); 1364 code.utf8().data()));
1350 } 1365 }
1351 1366
1352 } // namespace content 1367 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698