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

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

Issue 1876703002: Oilpan: Replace EAGERLY_FINALIZE in EventTarget's hierarchy with pre-finalizers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/ActiveScriptWrappable.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "core/dom/ActiveDOMObject.h" 10 #include "core/dom/ActiveDOMObject.h"
(...skipping 19 matching lines...) Expand all
30 // via WebServiceWorkerRegistration::Handle object. 30 // via WebServiceWorkerRegistration::Handle object.
31 class ServiceWorkerRegistration final 31 class ServiceWorkerRegistration final
32 : public RefCountedGarbageCollectedEventTargetWithInlineData<ServiceWorkerRe gistration> 32 : public RefCountedGarbageCollectedEventTargetWithInlineData<ServiceWorkerRe gistration>
33 , public ActiveScriptWrappable 33 , public ActiveScriptWrappable
34 , public ActiveDOMObject 34 , public ActiveDOMObject
35 , public WebServiceWorkerRegistrationProxy 35 , public WebServiceWorkerRegistrationProxy
36 , public Supplementable<ServiceWorkerRegistration> { 36 , public Supplementable<ServiceWorkerRegistration> {
37 DEFINE_WRAPPERTYPEINFO(); 37 DEFINE_WRAPPERTYPEINFO();
38 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(ServiceWorkerRegistration); 38 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(ServiceWorkerRegistration);
39 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerRegistration); 39 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerRegistration);
40 USING_PRE_FINALIZER(ServiceWorkerRegistration, dispose);
40 public: 41 public:
41 // EventTarget overrides. 42 // EventTarget overrides.
42 const AtomicString& interfaceName() const override; 43 const AtomicString& interfaceName() const override;
43 ExecutionContext* getExecutionContext() const override { return ActiveDOMObj ect::getExecutionContext(); } 44 ExecutionContext* getExecutionContext() const override { return ActiveDOMObj ect::getExecutionContext(); }
44 45
45 // WebServiceWorkerRegistrationProxy overrides. 46 // WebServiceWorkerRegistrationProxy overrides.
46 void dispatchUpdateFoundEvent() override; 47 void dispatchUpdateFoundEvent() override;
47 void setInstalling(std::unique_ptr<WebServiceWorker::Handle>) override; 48 void setInstalling(std::unique_ptr<WebServiceWorker::Handle>) override;
48 void setWaiting(std::unique_ptr<WebServiceWorker::Handle>) override; 49 void setWaiting(std::unique_ptr<WebServiceWorker::Handle>) override;
49 void setActive(std::unique_ptr<WebServiceWorker::Handle>) override; 50 void setActive(std::unique_ptr<WebServiceWorker::Handle>) override;
(...skipping 10 matching lines...) Expand all
60 61
61 WebServiceWorkerRegistration* webRegistration() { return m_handle->registrat ion(); } 62 WebServiceWorkerRegistration* webRegistration() { return m_handle->registrat ion(); }
62 63
63 ScriptPromise update(ScriptState*); 64 ScriptPromise update(ScriptState*);
64 ScriptPromise unregister(ScriptState*); 65 ScriptPromise unregister(ScriptState*);
65 66
66 DEFINE_ATTRIBUTE_EVENT_LISTENER(updatefound); 67 DEFINE_ATTRIBUTE_EVENT_LISTENER(updatefound);
67 68
68 ~ServiceWorkerRegistration() override; 69 ~ServiceWorkerRegistration() override;
69 70
70 // Eager finalization needed to promptly release owned WebServiceWorkerRegis tration.
71 EAGERLY_FINALIZE();
72 DECLARE_VIRTUAL_TRACE(); 71 DECLARE_VIRTUAL_TRACE();
73 72
74 private: 73 private:
75 ServiceWorkerRegistration(ExecutionContext*, PassOwnPtr<WebServiceWorkerRegi stration::Handle>); 74 ServiceWorkerRegistration(ExecutionContext*, PassOwnPtr<WebServiceWorkerRegi stration::Handle>);
75 void dispose();
76 76
77 // ActiveScriptWrappable overrides. 77 // ActiveScriptWrappable overrides.
78 bool hasPendingActivity() const final; 78 bool hasPendingActivity() const final;
79 79
80 // ActiveDOMObject overrides. 80 // ActiveDOMObject overrides.
81 void stop() override; 81 void stop() override;
82 82
83 // A handle to the registration representation in the embedder. 83 // A handle to the registration representation in the embedder.
84 OwnPtr<WebServiceWorkerRegistration::Handle> m_handle; 84 OwnPtr<WebServiceWorkerRegistration::Handle> m_handle;
85 85
(...skipping 13 matching lines...) Expand all
99 HeapVector<Member<ServiceWorkerRegistration>> registrations; 99 HeapVector<Member<ServiceWorkerRegistration>> registrations;
100 for (auto& registration : *webServiceWorkerRegistrations) 100 for (auto& registration : *webServiceWorkerRegistrations)
101 registrations.append(ServiceWorkerRegistration::getOrCreate(resolver ->getExecutionContext(), registration.release())); 101 registrations.append(ServiceWorkerRegistration::getOrCreate(resolver ->getExecutionContext(), registration.release()));
102 return registrations; 102 return registrations;
103 } 103 }
104 }; 104 };
105 105
106 } // namespace blink 106 } // namespace blink
107 107
108 #endif // ServiceWorkerRegistration_h 108 #endif // ServiceWorkerRegistration_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698