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"
15 class ScriptSourceCode
;
16 class WebScriptExecutionCallback
;
18 class SuspendableScriptExecutor final
: public GarbageCollectedFinalized
<SuspendableScriptExecutor
>, public SuspendableTimer
{
19 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SuspendableScriptExecutor
);
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();
29 SuspendableScriptExecutor(LocalFrame
*, int worldID
, const WillBeHeapVector
<ScriptSourceCode
>& sources
, int extensionGroup
, bool userGesture
, WebScriptExecutionCallback
*);
31 void fired() override
;
34 void executeAndDestroySelf();
37 RefPtrWillBeMember
<LocalFrame
> m_frame
;
38 WillBeHeapVector
<ScriptSourceCode
> m_sources
;
39 WebScriptExecutionCallback
* m_callback
;
41 SelfKeepAlive
<SuspendableScriptExecutor
> m_keepAlive
;
51 #endif // SuspendableScriptExecutor_h