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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h

Issue 1805843002: [v8 gc] Introduce a base class for all objects that can have pending activity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 4 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 ServiceWorkerRegistration_h 5 #ifndef ServiceWorkerRegistration_h
6 #define ServiceWorkerRegistration_h 6 #define ServiceWorkerRegistration_h
7 7
8 #include "bindings/core/v8/ActiveScriptWrappable.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/ActiveDOMObject.h" 10 #include "core/dom/ActiveDOMObject.h"
10 #include "core/events/EventTarget.h" 11 #include "core/events/EventTarget.h"
11 #include "modules/serviceworkers/ServiceWorker.h" 12 #include "modules/serviceworkers/ServiceWorker.h"
12 #include "modules/serviceworkers/ServiceWorkerRegistration.h" 13 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
13 #include "platform/Supplementable.h" 14 #include "platform/Supplementable.h"
14 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" 15 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h"
15 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistrationProx y.h" 16 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistrationProx y.h"
16 #include "wtf/OwnPtr.h" 17 #include "wtf/OwnPtr.h"
17 #include "wtf/PassOwnPtr.h" 18 #include "wtf/PassOwnPtr.h"
18 #include "wtf/PassRefPtr.h" 19 #include "wtf/PassRefPtr.h"
19 #include "wtf/RefCounted.h" 20 #include "wtf/RefCounted.h"
20 21
21 namespace blink { 22 namespace blink {
22 23
23 class ScriptPromise; 24 class ScriptPromise;
24 class ScriptState; 25 class ScriptState;
25 class WebServiceWorkerProvider; 26 class WebServiceWorkerProvider;
26 27
27 // The implementation of a service worker registration object in Blink. Actual 28 // The implementation of a service worker registration object in Blink. Actual
28 // registration representation is in the embedder and this class accesses it 29 // registration representation is in the embedder and this class accesses it
29 // via WebServiceWorkerRegistration::Handle object. 30 // via WebServiceWorkerRegistration::Handle object.
30 class ServiceWorkerRegistration final 31 class ServiceWorkerRegistration final
31 : public RefCountedGarbageCollectedEventTargetWithInlineData<ServiceWorkerRe gistration> 32 : public RefCountedGarbageCollectedEventTargetWithInlineData<ServiceWorkerRe gistration>
33 , public ActiveScriptWrappable
32 , public ActiveDOMObject 34 , public ActiveDOMObject
33 , public WebServiceWorkerRegistrationProxy 35 , public WebServiceWorkerRegistrationProxy
34 , public HeapSupplementable<ServiceWorkerRegistration> { 36 , public HeapSupplementable<ServiceWorkerRegistration> {
35 DEFINE_WRAPPERTYPEINFO(); 37 DEFINE_WRAPPERTYPEINFO();
36 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(ServiceWorkerRegistration); 38 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(ServiceWorkerRegistration);
37 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerRegistration); 39 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerRegistration);
38 public: 40 public:
39 // EventTarget overrides. 41 // EventTarget overrides.
40 const AtomicString& interfaceName() const override; 42 const AtomicString& interfaceName() const override;
41 ExecutionContext* getExecutionContext() const override { return ActiveDOMObj ect::getExecutionContext(); } 43 ExecutionContext* getExecutionContext() const override { return ActiveDOMObj ect::getExecutionContext(); }
(...skipping 23 matching lines...) Expand all
65 67
66 ~ServiceWorkerRegistration() override; 68 ~ServiceWorkerRegistration() override;
67 69
68 // Eager finalization needed to promptly release owned WebServiceWorkerRegis tration. 70 // Eager finalization needed to promptly release owned WebServiceWorkerRegis tration.
69 EAGERLY_FINALIZE(); 71 EAGERLY_FINALIZE();
70 DECLARE_VIRTUAL_TRACE(); 72 DECLARE_VIRTUAL_TRACE();
71 73
72 private: 74 private:
73 ServiceWorkerRegistration(ExecutionContext*, PassOwnPtr<WebServiceWorkerRegi stration::Handle>); 75 ServiceWorkerRegistration(ExecutionContext*, PassOwnPtr<WebServiceWorkerRegi stration::Handle>);
74 76
77 // ActiveScriptWrappable overrides.
78 bool hasPendingActivity() const final;
79
75 // ActiveDOMObject overrides. 80 // ActiveDOMObject overrides.
76 bool hasPendingActivity() const override;
77 void stop() override; 81 void stop() override;
78 82
79 // A handle to the registration representation in the embedder. 83 // A handle to the registration representation in the embedder.
80 OwnPtr<WebServiceWorkerRegistration::Handle> m_handle; 84 OwnPtr<WebServiceWorkerRegistration::Handle> m_handle;
81 85
82 WebServiceWorkerProvider* m_provider; 86 WebServiceWorkerProvider* m_provider;
83 Member<ServiceWorker> m_installing; 87 Member<ServiceWorker> m_installing;
84 Member<ServiceWorker> m_waiting; 88 Member<ServiceWorker> m_waiting;
85 Member<ServiceWorker> m_active; 89 Member<ServiceWorker> m_active;
86 90
87 bool m_stopped; 91 bool m_stopped;
88 }; 92 };
89 93
90 class ServiceWorkerRegistrationArray { 94 class ServiceWorkerRegistrationArray {
91 STATIC_ONLY(ServiceWorkerRegistrationArray); 95 STATIC_ONLY(ServiceWorkerRegistrationArray);
92 public: 96 public:
93 static HeapVector<Member<ServiceWorkerRegistration>> take(ScriptPromiseResol ver* resolver, Vector<OwnPtr<WebServiceWorkerRegistration::Handle>>* webServiceW orkerRegistrations) 97 static HeapVector<Member<ServiceWorkerRegistration>> take(ScriptPromiseResol ver* resolver, Vector<OwnPtr<WebServiceWorkerRegistration::Handle>>* webServiceW orkerRegistrations)
94 { 98 {
95 HeapVector<Member<ServiceWorkerRegistration>> registrations; 99 HeapVector<Member<ServiceWorkerRegistration>> registrations;
96 for (auto& registration : *webServiceWorkerRegistrations) 100 for (auto& registration : *webServiceWorkerRegistrations)
97 registrations.append(ServiceWorkerRegistration::getOrCreate(resolver ->getExecutionContext(), registration.release())); 101 registrations.append(ServiceWorkerRegistration::getOrCreate(resolver ->getExecutionContext(), registration.release()));
98 return registrations; 102 return registrations;
99 } 103 }
100 }; 104 };
101 105
102 } // namespace blink 106 } // namespace blink
103 107
104 #endif // ServiceWorkerRegistration_h 108 #endif // ServiceWorkerRegistration_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698