Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / web / SuspendableScriptExecutor.h
blobb0b4d7a4332e0285f1394a532da1430df3790ed6
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
3 // found in the LICENSE file.
5 #ifndef SuspendableScriptExecutor_h
6 #define SuspendableScriptExecutor_h
8 #include "core/frame/SuspendableTimer.h"
9 #include "platform/heap/Handle.h"
10 #include "wtf/Vector.h"
12 namespace blink {
14 class LocalFrame;
15 class ScriptSourceCode;
16 class WebScriptExecutionCallback;
18 class SuspendableScriptExecutor final : public GarbageCollectedFinalized<SuspendableScriptExecutor>, public SuspendableTimer {
19 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SuspendableScriptExecutor);
20 public:
21 static void createAndRun(LocalFrame*, int worldID, const WillBeHeapVector<ScriptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecutionCallback*);
22 ~SuspendableScriptExecutor() override;
24 void contextDestroyed() override;
26 DECLARE_VIRTUAL_TRACE();
28 private:
29 SuspendableScriptExecutor(LocalFrame*, int worldID, const WillBeHeapVector<ScriptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecutionCallback*);
31 void fired() override;
33 void run();
34 void executeAndDestroySelf();
35 void dispose();
37 RefPtrWillBeMember<LocalFrame> m_frame;
38 WillBeHeapVector<ScriptSourceCode> m_sources;
39 WebScriptExecutionCallback* m_callback;
41 SelfKeepAlive<SuspendableScriptExecutor> m_keepAlive;
43 int m_worldID;
44 int m_extensionGroup;
46 bool m_userGesture;
49 } // namespace blink
51 #endif // SuspendableScriptExecutor_h