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

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

Issue 869513004: SuspendableScriptExecutor executes code once (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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/dom/ActiveDOMObject.h" 8 #include "core/frame/SuspendableTimer.h"
9 #include "platform/heap/Handle.h" 9 #include "platform/heap/Handle.h"
10 #include "wtf/OwnPtr.h" 10 #include "wtf/OwnPtr.h"
11 #include "wtf/Vector.h" 11 #include "wtf/Vector.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class LocalFrame; 15 class LocalFrame;
16 class ScriptSourceCode; 16 class ScriptSourceCode;
17 class WebScriptExecutionCallback; 17 class WebScriptExecutionCallback;
18 18
19 class SuspendableScriptExecutor final : public RefCountedWillBeRefCountedGarbage Collected<SuspendableScriptExecutor>, public ActiveDOMObject { 19 class SuspendableScriptExecutor final : public RefCountedWillBeRefCountedGarbage Collected<SuspendableScriptExecutor>, public SuspendableTimer {
20 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SuspendableScriptExecutor); 20 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SuspendableScriptExecutor);
21 public: 21 public:
22 static void createAndRun(LocalFrame*, int worldID, const WillBeHeapVector<Sc riptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecuti onCallback*); 22 static void createAndRun(LocalFrame*, int worldID, const WillBeHeapVector<Sc riptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecuti onCallback*);
23 virtual ~SuspendableScriptExecutor(); 23 virtual ~SuspendableScriptExecutor();
24 24
25 virtual void resume() override;
26 virtual void contextDestroyed() override; 25 virtual void contextDestroyed() override;
27 26
28 virtual void trace(Visitor*) override; 27 virtual void trace(Visitor*) override;
29 28
30 private: 29 private:
31 SuspendableScriptExecutor(LocalFrame*, int worldID, const WillBeHeapVector<S criptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecut ionCallback*); 30 SuspendableScriptExecutor(LocalFrame*, int worldID, const WillBeHeapVector<S criptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecut ionCallback*);
32 31
32 virtual void fired() override;
33
33 void run(); 34 void run();
34 void executeAndDestroySelf(); 35 void executeAndDestroySelf();
35 36
36 RawPtrWillBeMember<LocalFrame> m_frame; 37 RawPtrWillBeMember<LocalFrame> m_frame;
37 int m_worldID; 38 int m_worldID;
38 WillBeHeapVector<ScriptSourceCode> m_sources; 39 WillBeHeapVector<ScriptSourceCode> m_sources;
39 int m_extensionGroup; 40 int m_extensionGroup;
40 bool m_userGesture; 41 bool m_userGesture;
41 WebScriptExecutionCallback* m_callback; 42 WebScriptExecutionCallback* m_callback;
42 }; 43 };
43 44
44 } // namespace blink 45 } // namespace blink
45 46
46 #endif // SuspendableScriptExecutor_h 47 #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