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

Side by Side Diff: Source/web/SuspendableScriptExecutor.h

Issue 1258653003: Switch SuspendableScriptExecutor over to using SelfKeepAlive<>. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: retire m_disposed checking Created 5 years, 4 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
« no previous file with comments | « no previous file | Source/web/SuspendableScriptExecutor.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 #if ENABLE(ASSERT)
48 bool m_disposed;
49 #endif
50 }; 47 };
51 48
52 } // namespace blink 49 } // namespace blink
53 50
54 #endif // SuspendableScriptExecutor_h 51 #endif // SuspendableScriptExecutor_h
OLDNEW
« no previous file with comments | « no previous file | Source/web/SuspendableScriptExecutor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698