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

Side by Side Diff: Source/modules/background_sync/SyncRegistration.cpp

Issue 1220223003: [Background Sync] Add sync registration details to onsync event (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix: Missing words in comment Created 5 years, 5 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 "config.h" 5 #include "config.h"
6 #include "modules/background_sync/SyncRegistration.h" 6 #include "modules/background_sync/SyncRegistration.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
11 #include "core/dom/ExceptionCode.h" 11 #include "core/dom/ExceptionCode.h"
12 #include "modules/background_sync/SyncCallbacks.h" 12 #include "modules/background_sync/SyncCallbacks.h"
13 #include "modules/background_sync/SyncError.h" 13 #include "modules/background_sync/SyncError.h"
14 #include "modules/background_sync/SyncRegistrationOptions.h" 14 #include "modules/background_sync/SyncRegistrationOptions.h"
15 #include "modules/serviceworkers/ServiceWorkerRegistration.h" 15 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
16 #include "public/platform/Platform.h" 16 #include "public/platform/Platform.h"
17 #include "public/platform/modules/background_sync/WebSyncProvider.h" 17 #include "public/platform/modules/background_sync/WebSyncProvider.h"
18 #include "public/platform/modules/background_sync/WebSyncRegistration.h" 18 #include "public/platform/modules/background_sync/WebSyncRegistration.h"
19 #include "wtf/OwnPtr.h" 19 #include "wtf/OwnPtr.h"
20 20
21 namespace blink { 21 namespace blink {
22 22
23 SyncRegistration* SyncRegistration::create(const WebSyncRegistration& syncRegist ration, ServiceWorkerRegistration* serviceWorkerRegistration)
24 {
25 SyncRegistrationOptions options = SyncRegistrationOptions();
26 options.setTag(syncRegistration.tag);
27 return new SyncRegistration(syncRegistration.id, options, serviceWorkerRegis tration);
28 }
29
23 SyncRegistration* SyncRegistration::take(ScriptPromiseResolver*, WebSyncRegistra tion* syncRegistration, ServiceWorkerRegistration* serviceWorkerRegistration) 30 SyncRegistration* SyncRegistration::take(ScriptPromiseResolver*, WebSyncRegistra tion* syncRegistration, ServiceWorkerRegistration* serviceWorkerRegistration)
24 { 31 {
25 OwnPtr<WebSyncRegistration> registration = adoptPtr(syncRegistration); 32 OwnPtr<WebSyncRegistration> registration = adoptPtr(syncRegistration);
26 SyncRegistrationOptions options = SyncRegistrationOptions(); 33 return create(*syncRegistration, serviceWorkerRegistration);
27 options.setTag(syncRegistration->tag);
28 return new SyncRegistration(syncRegistration->id, options, serviceWorkerRegi stration);
29 } 34 }
30 35
31 void SyncRegistration::dispose(WebSyncRegistration* syncRegistration) 36 void SyncRegistration::dispose(WebSyncRegistration* syncRegistration)
32 { 37 {
33 if (syncRegistration) 38 if (syncRegistration)
34 delete syncRegistration; 39 delete syncRegistration;
35 } 40 }
36 41
37 SyncRegistration::SyncRegistration(int64_t id, const SyncRegistrationOptions& op tions, ServiceWorkerRegistration* serviceWorkerRegistration) 42 SyncRegistration::SyncRegistration(int64_t id, const SyncRegistrationOptions& op tions, ServiceWorkerRegistration* serviceWorkerRegistration)
38 : m_id(id) 43 : m_id(id)
(...skipping 21 matching lines...) Expand all
60 65
61 return promise; 66 return promise;
62 } 67 }
63 68
64 DEFINE_TRACE(SyncRegistration) 69 DEFINE_TRACE(SyncRegistration)
65 { 70 {
66 visitor->trace(m_serviceWorkerRegistration); 71 visitor->trace(m_serviceWorkerRegistration);
67 } 72 }
68 73
69 } // namespace blink 74 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/background_sync/SyncRegistration.h ('k') | Source/web/ServiceWorkerGlobalScopeProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698