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

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

Issue 1358063004: Use mojo to connect to BackgroundSyncManager object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make platform impl control cleanup of main thread provider Created 5 years, 2 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 20 matching lines...) Expand all
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
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( 461 main_thread_sync_provider_.reset(
463 ChildThreadImpl::current()->service_registry())); 462 BackgroundSyncProvider::GetOrCreateThreadSpecificInstance(
463 main_thread_task_runner_.get()));
464 } 464 }
465 } 465 }
466 466
467 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { 467 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) {
468 DCHECK(!current_thread_slot_.Get()); 468 DCHECK(!current_thread_slot_.Get());
469 current_thread_slot_.Set(thread); 469 current_thread_slot_.Set(thread);
470 } 470 }
471 471
472 BlinkPlatformImpl::~BlinkPlatformImpl() { 472 BlinkPlatformImpl::~BlinkPlatformImpl() {
473 } 473 }
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 return nullptr; 1206 return nullptr;
1207 1207
1208 if (IsMainThread()) 1208 if (IsMainThread())
1209 return permission_client_.get(); 1209 return permission_client_.get();
1210 1210
1211 return PermissionDispatcherThreadProxy::GetThreadInstance( 1211 return PermissionDispatcherThreadProxy::GetThreadInstance(
1212 main_thread_task_runner_.get(), permission_client_.get()); 1212 main_thread_task_runner_.get(), permission_client_.get());
1213 } 1213 }
1214 1214
1215 blink::WebSyncProvider* BlinkPlatformImpl::backgroundSyncProvider() { 1215 blink::WebSyncProvider* BlinkPlatformImpl::backgroundSyncProvider() {
1216 if (!sync_provider_.get()) 1216 return BackgroundSyncProvider::GetOrCreateThreadSpecificInstance(
1217 return nullptr; 1217 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 } 1218 }
1225 1219
1226 WebThemeEngine* BlinkPlatformImpl::themeEngine() { 1220 WebThemeEngine* BlinkPlatformImpl::themeEngine() {
1227 return &native_theme_engine_; 1221 return &native_theme_engine_;
1228 } 1222 }
1229 1223
1230 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { 1224 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() {
1231 return &fallback_theme_engine_; 1225 return &fallback_theme_engine_;
1232 } 1226 }
1233 1227
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( 1386 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString(
1393 static_cast<ui::DomKey>(dom_key))); 1387 static_cast<ui::DomKey>(dom_key)));
1394 } 1388 }
1395 1389
1396 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { 1390 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) {
1397 return static_cast<int>( 1391 return static_cast<int>(
1398 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8().data())); 1392 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8().data()));
1399 } 1393 }
1400 1394
1401 } // namespace content 1395 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698