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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyBase.h

Issue 2557793004: Revert of Remove ContextLifecycleObserver from ScriptPromisePropertyBase (Closed)
Patch Set: Created 4 years 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 ScriptPromisePropertyBase_h 5 #ifndef ScriptPromisePropertyBase_h
6 #define ScriptPromisePropertyBase_h 6 #define ScriptPromisePropertyBase_h
7 7
8 #include "bindings/core/v8/ScopedPersistent.h" 8 #include "bindings/core/v8/ScopedPersistent.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseProperties.h" 10 #include "bindings/core/v8/ScriptPromiseProperties.h"
11 #include "core/CoreExport.h" 11 #include "core/CoreExport.h"
12 #include "core/dom/ContextLifecycleObserver.h"
12 #include "wtf/Compiler.h" 13 #include "wtf/Compiler.h"
13 #include "wtf/RefCounted.h" 14 #include "wtf/RefCounted.h"
14 #include "wtf/Vector.h" 15 #include "wtf/Vector.h"
15 #include <memory> 16 #include <memory>
16 #include <v8.h> 17 #include <v8.h>
17 18
18 namespace blink { 19 namespace blink {
19 20
20 class DOMWrapperWorld; 21 class DOMWrapperWorld;
21 class ExecutionContext; 22 class ExecutionContext;
22 class ScriptState; 23 class ScriptState;
23 24
24 // TODO(yhirano): Remove NEVER_INLINE once we find the cause of crashes. 25 // TODO(yhirano): Remove NEVER_INLINE once we find the cause of crashes.
25 class CORE_EXPORT ScriptPromisePropertyBase 26 class CORE_EXPORT ScriptPromisePropertyBase
26 : public GarbageCollectedFinalized<ScriptPromisePropertyBase> { 27 : public GarbageCollectedFinalized<ScriptPromisePropertyBase>,
28 public ContextLifecycleObserver {
29 USING_GARBAGE_COLLECTED_MIXIN(ScriptPromisePropertyBase);
30
27 public: 31 public:
28 virtual ~ScriptPromisePropertyBase(); 32 virtual ~ScriptPromisePropertyBase();
29 33
30 enum Name { 34 enum Name {
31 #define P(Name) Name, 35 #define P(Name) Name,
32 SCRIPT_PROMISE_PROPERTIES(P) 36 SCRIPT_PROMISE_PROPERTIES(P)
33 #undef P 37 #undef P
34 }; 38 };
35 39
36 enum State { 40 enum State {
37 Pending, 41 Pending,
38 Resolved, 42 Resolved,
39 Rejected, 43 Rejected,
40 }; 44 };
41 State getState() const { return m_state; } 45 State getState() const { return m_state; }
42 ExecutionContext* getExecutionContext() const; 46
43 ScriptPromise promise(DOMWrapperWorld&); 47 ScriptPromise promise(DOMWrapperWorld&);
44 48
45 DECLARE_VIRTUAL_TRACE(); 49 DECLARE_VIRTUAL_TRACE();
46 50
47 protected: 51 protected:
48 ScriptPromisePropertyBase(ExecutionContext*, Name); 52 ScriptPromisePropertyBase(ExecutionContext*, Name);
49 53
50 void resolveOrReject(State targetState); 54 void resolveOrReject(State targetState);
51 55
52 // ScriptPromiseProperty overrides these to wrap the holder, 56 // ScriptPromiseProperty overrides these to wrap the holder,
(...skipping 21 matching lines...) Expand all
74 void resolveOrRejectInternal(v8::Local<v8::Promise::Resolver>); 78 void resolveOrRejectInternal(v8::Local<v8::Promise::Resolver>);
75 v8::Local<v8::Object> ensureHolderWrapper(ScriptState*); 79 v8::Local<v8::Object> ensureHolderWrapper(ScriptState*);
76 NEVER_INLINE void clearWrappers(); 80 NEVER_INLINE void clearWrappers();
77 // TODO(yhirano): Remove these functions once we find the cause of crashes. 81 // TODO(yhirano): Remove these functions once we find the cause of crashes.
78 NEVER_INLINE void checkThis(); 82 NEVER_INLINE void checkThis();
79 NEVER_INLINE void checkWrappers(); 83 NEVER_INLINE void checkWrappers();
80 84
81 v8::Local<v8::String> promiseName(); 85 v8::Local<v8::String> promiseName();
82 v8::Local<v8::String> resolverName(); 86 v8::Local<v8::String> resolverName();
83 87
84 Member<ExecutionContext> m_executionContext;
85 v8::Isolate* m_isolate; 88 v8::Isolate* m_isolate;
86 Name m_name; 89 Name m_name;
87 State m_state; 90 State m_state;
88 91
89 WeakPersistentSet m_wrappers; 92 WeakPersistentSet m_wrappers;
90 }; 93 };
91 94
92 } // namespace blink 95 } // namespace blink
93 96
94 #endif // ScriptPromisePropertyBase_h 97 #endif // ScriptPromisePropertyBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698