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

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

Issue 2832743003: Move SuspendableScriptExecutor.* from web/ -> core/frame/. (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
(Empty)
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.
4
5 #ifndef SuspendableScriptExecutor_h
6 #define SuspendableScriptExecutor_h
7
8 #include "bindings/core/v8/DOMWrapperWorld.h"
9 #include "core/frame/SuspendableTimer.h"
10 #include "platform/heap/Handle.h"
11 #include "platform/heap/SelfKeepAlive.h"
12 #include "platform/wtf/RefPtr.h"
13 #include "platform/wtf/Vector.h"
14 #include "v8/include/v8.h"
15
16 namespace blink {
17
18 class LocalFrame;
19 class ScriptSourceCode;
20 class ScriptState;
21 class WebScriptExecutionCallback;
22
23 class SuspendableScriptExecutor final
24 : public GarbageCollectedFinalized<SuspendableScriptExecutor>,
25 public SuspendableTimer {
26 USING_GARBAGE_COLLECTED_MIXIN(SuspendableScriptExecutor);
27
28 public:
29 enum BlockingOption { kNonBlocking, kOnloadBlocking };
30
31 static SuspendableScriptExecutor* Create(
32 LocalFrame*,
33 RefPtr<DOMWrapperWorld>,
34 const HeapVector<ScriptSourceCode>& sources,
35 bool user_gesture,
36 WebScriptExecutionCallback*);
37 static void CreateAndRun(LocalFrame*,
38 v8::Isolate*,
39 v8::Local<v8::Context>,
40 v8::Local<v8::Function>,
41 v8::Local<v8::Value> receiver,
42 int argc,
43 v8::Local<v8::Value> argv[],
44 WebScriptExecutionCallback*);
45 ~SuspendableScriptExecutor() override;
46
47 void Run();
48 void RunAsync(BlockingOption);
49 void ContextDestroyed(ExecutionContext*) override;
50
51 DECLARE_VIRTUAL_TRACE();
52
53 class Executor : public GarbageCollectedFinalized<Executor> {
54 public:
55 virtual ~Executor() {}
56
57 virtual Vector<v8::Local<v8::Value>> Execute(LocalFrame*) = 0;
58
59 DEFINE_INLINE_VIRTUAL_TRACE(){};
60 };
61
62 private:
63 SuspendableScriptExecutor(LocalFrame*,
64 ScriptState*,
65 WebScriptExecutionCallback*,
66 Executor*);
67
68 void Fired() override;
69
70 void ExecuteAndDestroySelf();
71 void Dispose();
72
73 RefPtr<ScriptState> script_state_;
74 WebScriptExecutionCallback* callback_;
75 BlockingOption blocking_option_;
76
77 SelfKeepAlive<SuspendableScriptExecutor> keep_alive_;
78
79 Member<Executor> executor_;
80 };
81
82 } // namespace blink
83
84 #endif // SuspendableScriptExecutor_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/BUILD.gn ('k') | third_party/WebKit/Source/web/SuspendableScriptExecutor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698