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

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

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

Powered by Google App Engine
This is Rietveld 408576698