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

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

Issue 2473483012: Move content/child/background_sync to Blink. (Closed)
Patch Set: Fix nits Created 4 years, 1 month 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 <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 19 matching lines...) Expand all
30 #include "base/time/time.h" 30 #include "base/time/time.h"
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 "build/build_config.h" 36 #include "build/build_config.h"
37 #include "components/mime_util/mime_util.h" 37 #include "components/mime_util/mime_util.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"
41 #include "content/child/child_thread_impl.h" 40 #include "content/child/child_thread_impl.h"
42 #include "content/child/content_child_helpers.h" 41 #include "content/child/content_child_helpers.h"
43 #include "content/child/notifications/notification_dispatcher.h" 42 #include "content/child/notifications/notification_dispatcher.h"
44 #include "content/child/notifications/notification_manager.h" 43 #include "content/child/notifications/notification_manager.h"
45 #include "content/child/push_messaging/push_dispatcher.h" 44 #include "content/child/push_messaging/push_dispatcher.h"
46 #include "content/child/push_messaging/push_provider.h" 45 #include "content/child/push_messaging/push_provider.h"
47 #include "content/child/thread_safe_sender.h" 46 #include "content/child/thread_safe_sender.h"
48 #include "content/child/web_url_loader_impl.h" 47 #include "content/child/web_url_loader_impl.h"
49 #include "content/child/web_url_request_util.h" 48 #include "content/child/web_url_request_util.h"
50 #include "content/child/worker_thread_registry.h" 49 #include "content/child/worker_thread_registry.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 InternalInit(); 381 InternalInit();
383 } 382 }
384 383
385 void BlinkPlatformImpl::InternalInit() { 384 void BlinkPlatformImpl::InternalInit() {
386 // ChildThread may not exist in some tests. 385 // ChildThread may not exist in some tests.
387 if (ChildThreadImpl::current()) { 386 if (ChildThreadImpl::current()) {
388 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); 387 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender();
389 notification_dispatcher_ = 388 notification_dispatcher_ =
390 ChildThreadImpl::current()->notification_dispatcher(); 389 ChildThreadImpl::current()->notification_dispatcher();
391 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); 390 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher();
392 main_thread_sync_provider_.reset(
393 new BackgroundSyncProvider(main_thread_task_runner_.get()));
394 } 391 }
395 } 392 }
396 393
397 void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate( 394 void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate(
398 blink::scheduler::WebThreadBase* thread) { 395 blink::scheduler::WebThreadBase* thread) {
399 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, 396 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
400 base::WaitableEvent::InitialState::NOT_SIGNALED); 397 base::WaitableEvent::InitialState::NOT_SIGNALED);
401 thread->GetTaskRunner()->PostTask( 398 thread->GetTaskRunner()->PostTask(
402 FROM_HERE, 399 FROM_HERE,
403 base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, base::Unretained(this), 400 base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, base::Unretained(this),
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 } 764 }
768 765
769 blink::WebPushProvider* BlinkPlatformImpl::pushProvider() { 766 blink::WebPushProvider* BlinkPlatformImpl::pushProvider() {
770 if (!thread_safe_sender_.get() || !push_dispatcher_.get()) 767 if (!thread_safe_sender_.get() || !push_dispatcher_.get())
771 return nullptr; 768 return nullptr;
772 769
773 return PushProvider::ThreadSpecificInstance(thread_safe_sender_.get(), 770 return PushProvider::ThreadSpecificInstance(thread_safe_sender_.get(),
774 push_dispatcher_.get()); 771 push_dispatcher_.get());
775 } 772 }
776 773
777 blink::WebSyncProvider* BlinkPlatformImpl::backgroundSyncProvider() {
778 if (IsMainThread())
779 return main_thread_sync_provider_.get();
780
781 return BackgroundSyncProvider::GetOrCreateThreadSpecificInstance(
782 main_thread_task_runner_.get());
783 }
784
785 WebThemeEngine* BlinkPlatformImpl::themeEngine() { 774 WebThemeEngine* BlinkPlatformImpl::themeEngine() {
786 return &native_theme_engine_; 775 return &native_theme_engine_;
787 } 776 }
788 777
789 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { 778 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() {
790 return &fallback_theme_engine_; 779 return &fallback_theme_engine_;
791 } 780 }
792 781
793 blink::Platform::FileHandle BlinkPlatformImpl::databaseOpenFile( 782 blink::Platform::FileHandle BlinkPlatformImpl::databaseOpenFile(
794 const blink::WebString& vfs_file_name, int desired_flags) { 783 const blink::WebString& vfs_file_name, int desired_flags) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( 874 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString(
886 static_cast<ui::DomKey>(dom_key))); 875 static_cast<ui::DomKey>(dom_key)));
887 } 876 }
888 877
889 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { 878 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) {
890 return static_cast<int>( 879 return static_cast<int>(
891 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); 880 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8()));
892 } 881 }
893 882
894 } // namespace content 883 } // namespace content
OLDNEW
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | content/child/service_worker/web_service_worker_registration_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698