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 SyncRegistration final : public GarbageCollectedFinalized<SyncRegistration
>, 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* take(ScriptPromiseResolver*, WebSyncRegistration*,
ServiceWorkerRegistration*); | 25 static SyncRegistration* take(ScriptPromiseResolver*, WebSyncRegistration*,
ServiceWorkerRegistration*); |
25 static void dispose(WebSyncRegistration* registrationRaw); | 26 static void dispose(WebSyncRegistration* registrationRaw); |
26 | 27 |
27 virtual ~SyncRegistration(); | 28 virtual ~SyncRegistration(); |
28 | 29 |
29 bool hasTag() const { return !m_tag.isNull(); } | 30 bool hasTag() const { return !m_tag.isNull(); } |
30 String tag() const { return m_tag; } | 31 String tag() const { return m_tag; } |
31 void setTag(String value) { m_tag = value; } | 32 void setTag(String value) { m_tag = value; } |
32 | 33 |
33 ScriptPromise unregister(ScriptState*); | 34 ScriptPromise unregister(ScriptState*); |
34 | 35 |
35 DECLARE_TRACE(); | 36 DECLARE_TRACE(); |
36 | 37 |
37 private: | 38 private: |
38 SyncRegistration(int64_t id, const SyncRegistrationOptions&, ServiceWorkerRe
gistration*); | 39 SyncRegistration(int64_t id, const SyncRegistrationOptions&, ServiceWorkerRe
gistration*); |
39 | 40 |
40 int64_t m_id; | 41 int64_t m_id; |
41 String m_tag; | 42 String m_tag; |
42 | 43 |
43 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; | 44 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; |
44 }; | 45 }; |
45 | 46 |
46 } // namespace blink | 47 } // namespace blink |
47 | 48 |
48 #endif // SyncRegistration_h | 49 #endif // SyncRegistration_h |
OLD | NEW |