OLD | NEW |
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) | 23 SyncRegistration* SyncRegistration::create(const WebSyncRegistration& syncRegist
ration, ServiceWorkerRegistration* serviceWorkerRegistration) |
24 { | 24 { |
25 SyncRegistrationOptions options = SyncRegistrationOptions(); | 25 SyncRegistrationOptions options = SyncRegistrationOptions(); |
26 options.setTag(syncRegistration.tag); | 26 options.setTag(syncRegistration.tag); |
27 return new SyncRegistration(syncRegistration.id, options, serviceWorkerRegis
tration); | 27 return new SyncRegistration(syncRegistration.id, options, serviceWorkerRegis
tration); |
28 } | 28 } |
29 | 29 |
30 SyncRegistration* SyncRegistration::take(ScriptPromiseResolver*, WebSyncRegistra
tion* syncRegistration, ServiceWorkerRegistration* serviceWorkerRegistration) | 30 SyncRegistration* SyncRegistration::take(ScriptPromiseResolver*, PassOwnPtr<WebS
yncRegistration> registration, ServiceWorkerRegistration* serviceWorkerRegistrat
ion) |
31 { | 31 { |
32 OwnPtr<WebSyncRegistration> registration = adoptPtr(syncRegistration); | 32 return create(*registration, serviceWorkerRegistration); |
33 return create(*syncRegistration, serviceWorkerRegistration); | |
34 } | |
35 | |
36 void SyncRegistration::dispose(WebSyncRegistration* syncRegistration) | |
37 { | |
38 if (syncRegistration) | |
39 delete syncRegistration; | |
40 } | 33 } |
41 | 34 |
42 SyncRegistration::SyncRegistration(int64_t id, const SyncRegistrationOptions& op
tions, ServiceWorkerRegistration* serviceWorkerRegistration) | 35 SyncRegistration::SyncRegistration(int64_t id, const SyncRegistrationOptions& op
tions, ServiceWorkerRegistration* serviceWorkerRegistration) |
43 : m_id(id) | 36 : m_id(id) |
44 , m_tag(options.tag()) | 37 , m_tag(options.tag()) |
45 , m_serviceWorkerRegistration(serviceWorkerRegistration) | 38 , m_serviceWorkerRegistration(serviceWorkerRegistration) |
46 { | 39 { |
47 } | 40 } |
48 | 41 |
49 SyncRegistration::~SyncRegistration() | 42 SyncRegistration::~SyncRegistration() |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 81 |
89 return promise; | 82 return promise; |
90 } | 83 } |
91 | 84 |
92 DEFINE_TRACE(SyncRegistration) | 85 DEFINE_TRACE(SyncRegistration) |
93 { | 86 { |
94 visitor->trace(m_serviceWorkerRegistration); | 87 visitor->trace(m_serviceWorkerRegistration); |
95 } | 88 } |
96 | 89 |
97 } // namespace blink | 90 } // namespace blink |
OLD | NEW |