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

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

Issue 2481393002: [background-sync] Remove WebSyncError and SyncCallbacks (Closed)
Patch Set: Code review changes 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 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"
11 #include "core/dom/DOMException.h" 11 #include "core/dom/DOMException.h"
12 #include "core/dom/ExceptionCode.h" 12 #include "core/dom/ExceptionCode.h"
13 #include "core/dom/ExecutionContext.h" 13 #include "core/dom/ExecutionContext.h"
14 #include "modules/background_sync/BackgroundSyncProvider.h" 14 #include "modules/background_sync/BackgroundSyncProvider.h"
15 #include "modules/background_sync/SyncCallbacks.h"
16 #include "modules/serviceworkers/ServiceWorkerRegistration.h" 15 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
17 #include "public/platform/Platform.h" 16 #include "public/platform/Platform.h"
18 #include "wtf/PtrUtil.h" 17 #include "wtf/PtrUtil.h"
19 #include "wtf/ThreadSpecific.h" 18 #include "wtf/ThreadSpecific.h"
20 19
21 namespace blink { 20 namespace blink {
22 21
23 // static 22 // static
24 BackgroundSyncProvider* SyncManager::backgroundSyncProvider() { 23 BackgroundSyncProvider* SyncManager::backgroundSyncProvider() {
25 DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<BackgroundSyncProvider>, 24 DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<BackgroundSyncProvider>,
(...skipping 22 matching lines...) Expand all
48 ScriptPromise promise = resolver->promise(); 47 ScriptPromise promise = resolver->promise();
49 48
50 mojom::blink::SyncRegistrationPtr syncRegistration = 49 mojom::blink::SyncRegistrationPtr syncRegistration =
51 mojom::blink::SyncRegistration::New(); 50 mojom::blink::SyncRegistration::New();
52 syncRegistration->id = SyncManager::kUnregisteredSyncID; 51 syncRegistration->id = SyncManager::kUnregisteredSyncID;
53 syncRegistration->tag = tag; 52 syncRegistration->tag = tag;
54 syncRegistration->network_state = 53 syncRegistration->network_state =
55 blink::mojom::BackgroundSyncNetworkState::ONLINE; 54 blink::mojom::BackgroundSyncNetworkState::ONLINE;
56 55
57 backgroundSyncProvider()->registerBackgroundSync( 56 backgroundSyncProvider()->registerBackgroundSync(
58 std::move(syncRegistration), m_registration->webRegistration(), 57 std::move(syncRegistration), m_registration->webRegistration(), resolver);
iclelland 2016/11/18 20:53:46 The old SyncRegistrationCallbacks object held a re
iclelland 2016/11/18 21:22:36 Tracing through the git history, and the evolution
59 makeUnique<SyncRegistrationCallbacks>(resolver, m_registration));
60 58
61 return promise; 59 return promise;
62 } 60 }
63 61
64 ScriptPromise SyncManager::getTags(ScriptState* scriptState) { 62 ScriptPromise SyncManager::getTags(ScriptState* scriptState) {
65 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); 63 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
66 ScriptPromise promise = resolver->promise(); 64 ScriptPromise promise = resolver->promise();
67 65
68 backgroundSyncProvider()->getRegistrations( 66 backgroundSyncProvider()->getRegistrations(m_registration->webRegistration(),
69 m_registration->webRegistration(), 67 resolver);
70 makeUnique<SyncGetRegistrationsCallbacks>(resolver, m_registration));
71 68
72 return promise; 69 return promise;
73 } 70 }
74 71
75 DEFINE_TRACE(SyncManager) { 72 DEFINE_TRACE(SyncManager) {
76 visitor->trace(m_registration); 73 visitor->trace(m_registration);
77 } 74 }
78 75
79 } // namespace blink 76 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698