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

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

Issue 1614063002: [BackgroundSync Cleanup] Remove periodic sync code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@purge_power
Patch Set: Address comments from PS3 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 return ScriptPromise::rejectWithDOMException(scriptState, DOMExcepti on::create(InvalidStateError, "Document is detached from window.")); 51 return ScriptPromise::rejectWithDOMException(scriptState, DOMExcepti on::create(InvalidStateError, "Document is detached from window."));
52 if (!document->frame()->isMainFrame()) 52 if (!document->frame()->isMainFrame())
53 return ScriptPromise::rejectWithDOMException(scriptState, DOMExcepti on::create(AbortError, "Registration failed - not called from a main frame.")); 53 return ScriptPromise::rejectWithDOMException(scriptState, DOMExcepti on::create(AbortError, "Registration failed - not called from a main frame."));
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,
62 tag, 61 tag,
63 0 /* minPeriod */,
64 WebSyncRegistration::NetworkStateOnline /* networkState */ 62 WebSyncRegistration::NetworkStateOnline /* networkState */
65 ); 63 );
66 backgroundSyncProvider()->registerBackgroundSync(webSyncRegistration, m_regi stration->webRegistration(), context->isServiceWorkerGlobalScope(), new SyncRegi strationCallbacks(resolver, m_registration)); 64 backgroundSyncProvider()->registerBackgroundSync(webSyncRegistration, m_regi stration->webRegistration(), context->isServiceWorkerGlobalScope(), new SyncRegi strationCallbacks(resolver, m_registration));
67 65
68 return promise; 66 return promise;
69 } 67 }
70 68
71 ScriptPromise SyncManager::getTags(ScriptState* scriptState) 69 ScriptPromise SyncManager::getTags(ScriptState* scriptState)
72 { 70 {
73 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 71 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
74 ScriptPromise promise = resolver->promise(); 72 ScriptPromise promise = resolver->promise();
75 73
76 backgroundSyncProvider()->getRegistrations(WebSyncRegistration::PeriodicityO neShot, m_registration->webRegistration(), new SyncGetRegistrationsCallbacks(res olver, m_registration)); 74 backgroundSyncProvider()->getRegistrations(m_registration->webRegistration() , new SyncGetRegistrationsCallbacks(resolver, m_registration));
77 75
78 return promise; 76 return promise;
79 } 77 }
80 78
81 DEFINE_TRACE(SyncManager) 79 DEFINE_TRACE(SyncManager)
82 { 80 {
83 visitor->trace(m_registration); 81 visitor->trace(m_registration);
84 } 82 }
85 83
86 } // namespace blink 84 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698