OLD | NEW |
---|---|
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 SuspendableScriptExecutor_h | 5 #ifndef SuspendableScriptExecutor_h |
6 #define SuspendableScriptExecutor_h | 6 #define SuspendableScriptExecutor_h |
7 | 7 |
8 #include "core/frame/SuspendableTimer.h" | 8 #include "core/frame/SuspendableTimer.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 #include "wtf/OwnPtr.h" | |
11 #include "wtf/Vector.h" | 10 #include "wtf/Vector.h" |
12 | 11 |
13 namespace blink { | 12 namespace blink { |
14 | 13 |
15 class LocalFrame; | 14 class LocalFrame; |
16 class ScriptSourceCode; | 15 class ScriptSourceCode; |
17 class WebScriptExecutionCallback; | 16 class WebScriptExecutionCallback; |
18 | 17 |
19 class SuspendableScriptExecutor final : public RefCountedWillBeRefCountedGarbage Collected<SuspendableScriptExecutor>, public SuspendableTimer { | 18 class SuspendableScriptExecutor final : public GarbageCollectedFinalized<Suspend ableScriptExecutor>, public SuspendableTimer { |
20 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SuspendableScriptExecutor); | 19 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SuspendableScriptExecutor); |
21 public: | 20 public: |
22 static void createAndRun(LocalFrame*, int worldID, const WillBeHeapVector<Sc riptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecuti onCallback*); | 21 static void createAndRun(LocalFrame*, int worldID, const WillBeHeapVector<Sc riptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecuti onCallback*); |
23 ~SuspendableScriptExecutor() override; | 22 ~SuspendableScriptExecutor() override; |
24 | 23 |
25 void contextDestroyed() override; | 24 void contextDestroyed() override; |
26 | 25 |
27 // Eager finalization is needed to promptly stop this timer object. | |
28 // (see DOMTimer comment for more.) | |
29 EAGERLY_FINALIZE(); | |
30 DECLARE_VIRTUAL_TRACE(); | 26 DECLARE_VIRTUAL_TRACE(); |
31 | 27 |
32 private: | 28 private: |
33 SuspendableScriptExecutor(LocalFrame*, int worldID, const WillBeHeapVector<S criptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecut ionCallback*); | 29 SuspendableScriptExecutor(LocalFrame*, int worldID, const WillBeHeapVector<S criptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecut ionCallback*); |
34 | 30 |
35 void fired() override; | 31 void fired() override; |
36 | 32 |
37 void run(); | 33 void run(); |
38 void executeAndDestroySelf(); | 34 void executeAndDestroySelf(); |
39 void dispose(); | 35 void dispose(); |
40 | 36 |
41 RefPtrWillBeMember<LocalFrame> m_frame; | 37 RefPtrWillBeMember<LocalFrame> m_frame; |
38 WillBeHeapVector<ScriptSourceCode> m_sources; | |
39 WebScriptExecutionCallback* m_callback; | |
40 | |
41 SelfKeepAlive<SuspendableScriptExecutor> m_keepAlive; | |
42 | |
42 int m_worldID; | 43 int m_worldID; |
43 WillBeHeapVector<ScriptSourceCode> m_sources; | |
44 int m_extensionGroup; | 44 int m_extensionGroup; |
45 | |
45 bool m_userGesture; | 46 bool m_userGesture; |
46 WebScriptExecutionCallback* m_callback; | 47 |
47 #if ENABLE(ASSERT) | 48 #if ENABLE(ASSERT) |
48 bool m_disposed; | 49 bool m_disposed; |
sof
2015/08/04 14:14:40
With the self-keepalive, having this object be fin
| |
49 #endif | 50 #endif |
50 }; | 51 }; |
51 | 52 |
52 } // namespace blink | 53 } // namespace blink |
53 | 54 |
54 #endif // SuspendableScriptExecutor_h | 55 #endif // SuspendableScriptExecutor_h |
OLD | NEW |