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

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

Issue 2454433002: [Extensions + Blink] Account for user gesture in v8 function calls (Closed)
Patch Set: nits Created 4 years, 1 month 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
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 "platform/heap/SelfKeepAlive.h" 10 #include "platform/heap/SelfKeepAlive.h"
11 #include "wtf/Vector.h" 11 #include "wtf/Vector.h"
12 #include <v8.h> 12 #include <v8.h>
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class LocalFrame; 16 class LocalFrame;
17 class ScriptSourceCode; 17 class ScriptSourceCode;
18 class ScriptState;
18 class WebScriptExecutionCallback; 19 class WebScriptExecutionCallback;
19 20
20 class SuspendableScriptExecutor final 21 class SuspendableScriptExecutor final
21 : public GarbageCollectedFinalized<SuspendableScriptExecutor>, 22 : public GarbageCollectedFinalized<SuspendableScriptExecutor>,
22 public SuspendableTimer { 23 public SuspendableTimer {
23 USING_GARBAGE_COLLECTED_MIXIN(SuspendableScriptExecutor); 24 USING_GARBAGE_COLLECTED_MIXIN(SuspendableScriptExecutor);
24 25
25 public: 26 public:
26 static void createAndRun(LocalFrame*, 27 static void createAndRun(LocalFrame*,
27 int worldID, 28 int worldID,
(...skipping 19 matching lines...) Expand all
47 public: 48 public:
48 virtual ~Executor() {} 49 virtual ~Executor() {}
49 50
50 virtual Vector<v8::Local<v8::Value>> execute(LocalFrame*) = 0; 51 virtual Vector<v8::Local<v8::Value>> execute(LocalFrame*) = 0;
51 52
52 DEFINE_INLINE_VIRTUAL_TRACE(){}; 53 DEFINE_INLINE_VIRTUAL_TRACE(){};
53 }; 54 };
54 55
55 private: 56 private:
56 SuspendableScriptExecutor(LocalFrame*, 57 SuspendableScriptExecutor(LocalFrame*,
58 ScriptState*,
57 WebScriptExecutionCallback*, 59 WebScriptExecutionCallback*,
58 Executor*); 60 Executor*);
59 61
60 void fired() override; 62 void fired() override;
61 63
62 void run(); 64 void run();
63 void executeAndDestroySelf(); 65 void executeAndDestroySelf();
64 void dispose(); 66 void dispose();
65 67
68 // TODO(devlin): m_frame is likely redundant with context accessor on
69 // SuspendableTimer.
66 Member<LocalFrame> m_frame; 70 Member<LocalFrame> m_frame;
71 RefPtr<ScriptState> m_scriptState;
67 WebScriptExecutionCallback* m_callback; 72 WebScriptExecutionCallback* m_callback;
68 73
69 SelfKeepAlive<SuspendableScriptExecutor> m_keepAlive; 74 SelfKeepAlive<SuspendableScriptExecutor> m_keepAlive;
70 75
71 Member<Executor> m_executor; 76 Member<Executor> m_executor;
72 }; 77 };
73 78
74 } // namespace blink 79 } // namespace blink
75 80
76 #endif // SuspendableScriptExecutor_h 81 #endif // SuspendableScriptExecutor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698