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 #ifndef SyncRegistration_h | 5 #ifndef SyncRegistration_h |
6 #define SyncRegistration_h | 6 #define SyncRegistration_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "modules/background_sync/SyncRegistrationOptions.h" | 10 #include "modules/background_sync/SyncRegistrationOptions.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class ServiceWorkerRegistration; | 16 class ServiceWorkerRegistration; |
17 class ScriptPromiseResolver; | 17 class ScriptPromiseResolver; |
18 class ScriptState; | 18 class ScriptState; |
19 struct WebSyncRegistration; | 19 struct WebSyncRegistration; |
20 | 20 |
21 class MODULES_EXPORT SyncRegistration final : public GarbageCollectedFinalized<S
yncRegistration>, public ScriptWrappable { | 21 class MODULES_EXPORT SyncRegistration final : public GarbageCollectedFinalized<S
yncRegistration>, public ScriptWrappable { |
22 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
23 public: | 23 public: |
24 static SyncRegistration* create(const WebSyncRegistration&, ServiceWorkerReg
istration*); | 24 static SyncRegistration* create(const WebSyncRegistration&, ServiceWorkerReg
istration*); |
25 static SyncRegistration* take(ScriptPromiseResolver*, WebSyncRegistration*,
ServiceWorkerRegistration*); | 25 static SyncRegistration* take(ScriptPromiseResolver*, PassOwnPtr<WebSyncRegi
stration>, ServiceWorkerRegistration*); |
26 static void dispose(WebSyncRegistration* registrationRaw); | |
27 | 26 |
28 virtual ~SyncRegistration(); | 27 virtual ~SyncRegistration(); |
29 | 28 |
30 bool hasTag() const { return !m_tag.isNull(); } | 29 bool hasTag() const { return !m_tag.isNull(); } |
31 String tag() const { return m_tag; } | 30 String tag() const { return m_tag; } |
32 void setTag(String value) { m_tag = value; } | 31 void setTag(String value) { m_tag = value; } |
33 | 32 |
34 ScriptPromise done(ScriptState*); | 33 ScriptPromise done(ScriptState*); |
35 ScriptPromise unregister(ScriptState*); | 34 ScriptPromise unregister(ScriptState*); |
36 | 35 |
37 DECLARE_TRACE(); | 36 DECLARE_TRACE(); |
38 | 37 |
39 private: | 38 private: |
40 SyncRegistration(int64_t id, const SyncRegistrationOptions&, ServiceWorkerRe
gistration*); | 39 SyncRegistration(int64_t id, const SyncRegistrationOptions&, ServiceWorkerRe
gistration*); |
41 | 40 |
42 int64_t m_id; | 41 int64_t m_id; |
43 String m_tag; | 42 String m_tag; |
44 | 43 |
45 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; | 44 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; |
46 }; | 45 }; |
47 | 46 |
48 } // namespace blink | 47 } // namespace blink |
49 | 48 |
50 #endif // SyncRegistration_h | 49 #endif // SyncRegistration_h |
OLD | NEW |