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

Side by Side Diff: third_party/WebKit/Source/modules/background_sync/SyncManager.cpp

Issue 1617063002: [BackgroundSync Cleanup] Remove power observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Found more Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "modules/background_sync/SyncManager.h" 5 #include "modules/background_sync/SyncManager.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 55
56 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 56 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
57 ScriptPromise promise = resolver->promise(); 57 ScriptPromise promise = resolver->promise();
58 58
59 WebSyncRegistration* webSyncRegistration = new WebSyncRegistration( 59 WebSyncRegistration* webSyncRegistration = new WebSyncRegistration(
60 WebSyncRegistration::UNREGISTERED_SYNC_ID /* id */, 60 WebSyncRegistration::UNREGISTERED_SYNC_ID /* id */,
61 WebSyncRegistration::PeriodicityOneShot, 61 WebSyncRegistration::PeriodicityOneShot,
62 tag, 62 tag,
63 0 /* minPeriod */, 63 0 /* minPeriod */,
64 WebSyncRegistration::NetworkStateOnline /* networkState */, 64 WebSyncRegistration::NetworkStateOnline /* networkState */
65 WebSyncRegistration::PowerStateAuto /* powerState */
66 ); 65 );
67 backgroundSyncProvider()->registerBackgroundSync(webSyncRegistration, m_regi stration->webRegistration(), context->isServiceWorkerGlobalScope(), new SyncRegi strationCallbacks(resolver, m_registration)); 66 backgroundSyncProvider()->registerBackgroundSync(webSyncRegistration, m_regi stration->webRegistration(), context->isServiceWorkerGlobalScope(), new SyncRegi strationCallbacks(resolver, m_registration));
68 67
69 return promise; 68 return promise;
70 } 69 }
71 70
72 ScriptPromise SyncManager::getTags(ScriptState* scriptState) 71 ScriptPromise SyncManager::getTags(ScriptState* scriptState)
73 { 72 {
74 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 73 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
75 ScriptPromise promise = resolver->promise(); 74 ScriptPromise promise = resolver->promise();
76 75
77 backgroundSyncProvider()->getRegistrations(WebSyncRegistration::PeriodicityO neShot, m_registration->webRegistration(), new SyncGetRegistrationsCallbacks(res olver, m_registration)); 76 backgroundSyncProvider()->getRegistrations(WebSyncRegistration::PeriodicityO neShot, m_registration->webRegistration(), new SyncGetRegistrationsCallbacks(res olver, m_registration));
78 77
79 return promise; 78 return promise;
80 } 79 }
81 80
82 DEFINE_TRACE(SyncManager) 81 DEFINE_TRACE(SyncManager)
83 { 82 {
84 visitor->trace(m_registration); 83 visitor->trace(m_registration);
85 } 84 }
86 85
87 } // namespace blink 86 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698