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

Side by Side Diff: Source/modules/background_sync/SyncCallbacks.h

Issue 1315743003: [part 1] Make classes and structures in modules/ fast-allocated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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 #ifndef SyncCallbacks_h 5 #ifndef SyncCallbacks_h
6 #define SyncCallbacks_h 6 #define SyncCallbacks_h
7 7
8 #include "platform/heap/Handle.h" 8 #include "platform/heap/Handle.h"
9 #include "public/platform/WebCallbacks.h" 9 #include "public/platform/WebCallbacks.h"
10 #include "public/platform/modules/background_sync/WebSyncProvider.h" 10 #include "public/platform/modules/background_sync/WebSyncProvider.h"
11 #include "public/platform/modules/background_sync/WebSyncRegistration.h" 11 #include "public/platform/modules/background_sync/WebSyncRegistration.h"
12 #include "wtf/Noncopyable.h" 12 #include "wtf/Noncopyable.h"
13 #include "wtf/PassRefPtr.h" 13 #include "wtf/PassRefPtr.h"
14 #include "wtf/RefPtr.h" 14 #include "wtf/RefPtr.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class ServiceWorkerRegistration; 18 class ServiceWorkerRegistration;
19 class ScriptPromiseResolver; 19 class ScriptPromiseResolver;
20 struct WebSyncError; 20 struct WebSyncError;
21 struct WebSyncRegistration; 21 struct WebSyncRegistration;
22 class WebString; 22 class WebString;
23 23
24 // SyncRegistrationCallbacks is an implementation of WebSyncRegistrationCallback s 24 // SyncRegistrationCallbacks is an implementation of WebSyncRegistrationCallback s
25 // that will resolve the underlying promise depending on the result passed to 25 // that will resolve the underlying promise depending on the result passed to
26 // the callback. It takes a ServiceWorkerRegistration in its constructor and 26 // the callback. It takes a ServiceWorkerRegistration in its constructor and
27 // will pass it to the SyncRegistration. 27 // will pass it to the SyncRegistration.
28 class SyncRegistrationCallbacks final : public WebSyncRegistrationCallbacks { 28 class SyncRegistrationCallbacks final : public WebSyncRegistrationCallbacks {
29 WTF_MAKE_NONCOPYABLE(SyncRegistrationCallbacks); 29 WTF_MAKE_NONCOPYABLE(SyncRegistrationCallbacks);
30 // FIXME(tasak): when making public/platform classes to use PartitionAlloc,
31 // the following macro should be moved to WebCallbacks defined in public/pla tformWebCallbacks.h.
32 WTF_MAKE_FAST_ALLOCATED(SyncRegistrationCallbacks);
30 public: 33 public:
31 SyncRegistrationCallbacks(ScriptPromiseResolver*, ServiceWorkerRegistration* ); 34 SyncRegistrationCallbacks(ScriptPromiseResolver*, ServiceWorkerRegistration* );
32 ~SyncRegistrationCallbacks() override; 35 ~SyncRegistrationCallbacks() override;
33 36
34 void onSuccess(WebPassOwnPtr<WebSyncRegistration>) override; 37 void onSuccess(WebPassOwnPtr<WebSyncRegistration>) override;
35 void onError(const WebSyncError&) override; 38 void onError(const WebSyncError&) override;
36 39
37 private: 40 private:
38 Persistent<ScriptPromiseResolver> m_resolver; 41 Persistent<ScriptPromiseResolver> m_resolver;
39 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; 42 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration;
40 }; 43 };
41 44
42 // SyncNotifyWhenDoneCallbacks is an implementation of 45 // SyncNotifyWhenDoneCallbacks is an implementation of
43 // WebSyncNotifyWhenDoneCallbacks that will resolve the underlying promise 46 // WebSyncNotifyWhenDoneCallbacks that will resolve the underlying promise
44 // depending on the result passed to the callback. It takes a 47 // depending on the result passed to the callback. It takes a
45 // ServiceWorkerRegistration in its constructor and will pass it to the 48 // ServiceWorkerRegistration in its constructor and will pass it to the
46 // SyncProvider. 49 // SyncProvider.
47 class SyncNotifyWhenDoneCallbacks final : public WebSyncNotifyWhenDoneCallbacks { 50 class SyncNotifyWhenDoneCallbacks final : public WebSyncNotifyWhenDoneCallbacks {
48 WTF_MAKE_NONCOPYABLE(SyncNotifyWhenDoneCallbacks); 51 WTF_MAKE_NONCOPYABLE(SyncNotifyWhenDoneCallbacks);
52 // FIXME(tasak): when making public/platform classes to use PartitionAlloc,
53 // the following macro should be moved to WebCallbacks defined in public/pla tformWebCallbacks.h.
54 WTF_MAKE_FAST_ALLOCATED(SyncNotifyWhenDoneCallbacks);
49 public: 55 public:
50 SyncNotifyWhenDoneCallbacks(ScriptPromiseResolver*, ServiceWorkerRegistratio n*); 56 SyncNotifyWhenDoneCallbacks(ScriptPromiseResolver*, ServiceWorkerRegistratio n*);
51 ~SyncNotifyWhenDoneCallbacks() override; 57 ~SyncNotifyWhenDoneCallbacks() override;
52 58
53 void onSuccess(bool) override; 59 void onSuccess(bool) override;
54 void onError(const WebSyncError&) override; 60 void onError(const WebSyncError&) override;
55 61
56 private: 62 private:
57 Persistent<ScriptPromiseResolver> m_resolver; 63 Persistent<ScriptPromiseResolver> m_resolver;
58 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; 64 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration;
59 }; 65 };
60 66
61 // SyncUnregistrationCallbacks is an implementation of 67 // SyncUnregistrationCallbacks is an implementation of
62 // WebSyncUnregistrationCallbacks that will resolve the underlying promise 68 // WebSyncUnregistrationCallbacks that will resolve the underlying promise
63 // depending on the result passed to the callback. It takes a 69 // depending on the result passed to the callback. It takes a
64 // ServiceWorkerRegistration in its constructor and will pass it to the 70 // ServiceWorkerRegistration in its constructor and will pass it to the
65 // SyncProvider. 71 // SyncProvider.
66 class SyncUnregistrationCallbacks final : public WebSyncUnregistrationCallbacks { 72 class SyncUnregistrationCallbacks final : public WebSyncUnregistrationCallbacks {
67 WTF_MAKE_NONCOPYABLE(SyncUnregistrationCallbacks); 73 WTF_MAKE_NONCOPYABLE(SyncUnregistrationCallbacks);
74 // FIXME(tasak): when making public/platform classes to use PartitionAlloc,
75 // the following macro should be moved to WebCallbacks defined in public/pla tformWebCallbacks.h.
76 WTF_MAKE_FAST_ALLOCATED(SyncUnregistrationCallbacks);
68 public: 77 public:
69 SyncUnregistrationCallbacks(ScriptPromiseResolver*, ServiceWorkerRegistratio n*); 78 SyncUnregistrationCallbacks(ScriptPromiseResolver*, ServiceWorkerRegistratio n*);
70 ~SyncUnregistrationCallbacks() override; 79 ~SyncUnregistrationCallbacks() override;
71 80
72 void onSuccess(bool) override; 81 void onSuccess(bool) override;
73 void onError(const WebSyncError&) override; 82 void onError(const WebSyncError&) override;
74 83
75 private: 84 private:
76 Persistent<ScriptPromiseResolver> m_resolver; 85 Persistent<ScriptPromiseResolver> m_resolver;
77 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; 86 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration;
78 }; 87 };
79 88
80 // SyncGetRegistrationsCallbacks is an implementation of WebSyncGetRegistrations Callbacks 89 // SyncGetRegistrationsCallbacks is an implementation of WebSyncGetRegistrations Callbacks
81 // that will resolve the underlying promise depending on the result passed to 90 // that will resolve the underlying promise depending on the result passed to
82 // the callback. It takes a ServiceWorkerRegistration in its constructor and 91 // the callback. It takes a ServiceWorkerRegistration in its constructor and
83 // will pass it to the SyncRegistration. 92 // will pass it to the SyncRegistration.
84 class SyncGetRegistrationsCallbacks final : public WebSyncGetRegistrationsCallba cks { 93 class SyncGetRegistrationsCallbacks final : public WebSyncGetRegistrationsCallba cks {
85 WTF_MAKE_NONCOPYABLE(SyncGetRegistrationsCallbacks); 94 WTF_MAKE_NONCOPYABLE(SyncGetRegistrationsCallbacks);
95 // FIXME(tasak): when making public/platform classes to use PartitionAlloc,
96 // the following macro should be moved to WebCallbacks defined in public/pla tformWebCallbacks.h.
97 WTF_MAKE_FAST_ALLOCATED(SyncGetRegistrationsCallbacks);
86 public: 98 public:
87 SyncGetRegistrationsCallbacks(ScriptPromiseResolver*, ServiceWorkerRegistrat ion*); 99 SyncGetRegistrationsCallbacks(ScriptPromiseResolver*, ServiceWorkerRegistrat ion*);
88 ~SyncGetRegistrationsCallbacks() override; 100 ~SyncGetRegistrationsCallbacks() override;
89 101
90 void onSuccess(const WebVector<WebSyncRegistration*>&) override; 102 void onSuccess(const WebVector<WebSyncRegistration*>&) override;
91 void onError(const WebSyncError&) override; 103 void onError(const WebSyncError&) override;
92 104
93 private: 105 private:
94 Persistent<ScriptPromiseResolver> m_resolver; 106 Persistent<ScriptPromiseResolver> m_resolver;
95 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; 107 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration;
96 }; 108 };
97 109
98 // SyncGetPermissionStatusCallbacks is an implementation of 110 // SyncGetPermissionStatusCallbacks is an implementation of
99 // WebSyncGetPermissionStatusCallbacks that will resolve the underlying promise 111 // WebSyncGetPermissionStatusCallbacks that will resolve the underlying promise
100 // depending on the permission status passed to the callback. 112 // depending on the permission status passed to the callback.
101 class SyncGetPermissionStatusCallbacks final : public WebSyncGetPermissionStatus Callbacks { 113 class SyncGetPermissionStatusCallbacks final : public WebSyncGetPermissionStatus Callbacks {
102 WTF_MAKE_NONCOPYABLE(SyncGetPermissionStatusCallbacks); 114 WTF_MAKE_NONCOPYABLE(SyncGetPermissionStatusCallbacks);
115 WTF_MAKE_FAST_ALLOCATED(SyncGetPermissionStatusCallbacks);
103 public: 116 public:
104 SyncGetPermissionStatusCallbacks(ScriptPromiseResolver*, ServiceWorkerRegist ration*); 117 SyncGetPermissionStatusCallbacks(ScriptPromiseResolver*, ServiceWorkerRegist ration*);
105 ~SyncGetPermissionStatusCallbacks() override; 118 ~SyncGetPermissionStatusCallbacks() override;
106 119
107 void onSuccess(WebSyncPermissionStatus) override; 120 void onSuccess(WebSyncPermissionStatus) override;
108 void onError(const WebSyncError&) override; 121 void onError(const WebSyncError&) override;
109 122
110 private: 123 private:
111 static String permissionString(WebSyncPermissionStatus); 124 static String permissionString(WebSyncPermissionStatus);
112 125
113 Persistent<ScriptPromiseResolver> m_resolver; 126 Persistent<ScriptPromiseResolver> m_resolver;
114 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration; 127 Persistent<ServiceWorkerRegistration> m_serviceWorkerRegistration;
115 }; 128 };
116 129
117 } // namespace blink 130 } // namespace blink
118 131
119 #endif // SyncCallbacks_h 132 #endif // SyncCallbacks_h
OLDNEW
« no previous file with comments | « Source/modules/audio_output_devices/SetSinkIdCallbacks.h ('k') | Source/modules/background_sync/SyncError.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698