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

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

Issue 1197163003: Oilpan: make SuspendableScriptExecutor safe. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: re-intro RefCountedGarbageCollected Created 5 years, 6 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 | Annotate | Revision Log
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 "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 SuspendableTimer { 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 contextDestroyed() override; 25 virtual void contextDestroyed() override;
26 26
27 // Eager finalization is needed to promptly stop this timer object.
28 // (see DOMTimer comment for more.)
29 EAGERLY_FINALIZE();
27 DECLARE_VIRTUAL_TRACE(); 30 DECLARE_VIRTUAL_TRACE();
28 31
29 private: 32 private:
30 SuspendableScriptExecutor(LocalFrame*, int worldID, const WillBeHeapVector<S criptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecut ionCallback*); 33 SuspendableScriptExecutor(LocalFrame*, int worldID, const WillBeHeapVector<S criptSourceCode>& sources, int extensionGroup, bool userGesture, WebScriptExecut ionCallback*);
31 34
32 virtual void fired() override; 35 virtual void fired() override;
33 36
34 void run(); 37 void run();
35 void executeAndDestroySelf(); 38 void executeAndDestroySelf();
39 void dispose();
36 40
37 RawPtrWillBeMember<LocalFrame> m_frame; 41 RawPtrWillBeMember<LocalFrame> m_frame;
38 int m_worldID; 42 int m_worldID;
39 WillBeHeapVector<ScriptSourceCode> m_sources; 43 WillBeHeapVector<ScriptSourceCode> m_sources;
40 int m_extensionGroup; 44 int m_extensionGroup;
41 bool m_userGesture; 45 bool m_userGesture;
42 WebScriptExecutionCallback* m_callback; 46 WebScriptExecutionCallback* m_callback;
43 }; 47 };
44 48
45 } // namespace blink 49 } // namespace blink
46 50
47 #endif // SuspendableScriptExecutor_h 51 #endif // SuspendableScriptExecutor_h
OLDNEW
« no previous file with comments | « no previous file | Source/web/SuspendableScriptExecutor.cpp » ('j') | Source/web/SuspendableScriptExecutor.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698