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

Side by Side Diff: third_party/WebKit/Source/platform/bindings/V8PerIsolateData.h

Issue 2843603002: Move ScriptWrappable and dependencies to platform/bindings (Closed)
Patch Set: Rebase and try again Created 3 years, 7 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
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 10 matching lines...) Expand all
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE. 23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef V8PerIsolateData_h 26 #ifndef V8PerIsolateData_h
27 #define V8PerIsolateData_h 27 #define V8PerIsolateData_h
28 28
29 #include <memory> 29 #include <memory>
30 30
31 #include "bindings/core/v8/ScopedPersistent.h"
32 #include "bindings/core/v8/ScriptState.h"
33 #include "bindings/core/v8/ScriptWrappableVisitor.h"
34 #include "bindings/core/v8/WrapperTypeInfo.h"
35 #include "core/CoreExport.h"
36 #include "gin/public/isolate_holder.h" 31 #include "gin/public/isolate_holder.h"
37 #include "gin/public/v8_idle_task_runner.h" 32 #include "gin/public/v8_idle_task_runner.h"
33 #include "platform/PlatformExport.h"
34 #include "platform/bindings/ScopedPersistent.h"
35 #include "platform/bindings/ScriptState.h"
36 #include "platform/bindings/ScriptWrappableVisitor.h"
37 #include "platform/bindings/WrapperTypeInfo.h"
38 #include "platform/heap/Handle.h" 38 #include "platform/heap/Handle.h"
39 #include "platform/wtf/HashMap.h" 39 #include "platform/wtf/HashMap.h"
40 #include "platform/wtf/Noncopyable.h" 40 #include "platform/wtf/Noncopyable.h"
41 #include "platform/wtf/Vector.h" 41 #include "platform/wtf/Vector.h"
42 #include "v8/include/v8.h" 42 #include "v8/include/v8.h"
43 43
44 namespace blink { 44 namespace blink {
45 45
46 class ActiveScriptWrappableBase; 46 class ActiveScriptWrappableBase;
47 class DOMDataStore; 47 class DOMDataStore;
48 class StringCache; 48 class StringCache;
49 class V8PrivateProperty; 49 class V8PrivateProperty;
50 class WebTaskRunner; 50 class WebTaskRunner;
51 struct WrapperTypeInfo; 51 struct WrapperTypeInfo;
52 52
53 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList; 53 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList;
54 54
55 class CORE_EXPORT V8PerIsolateData { 55 class PLATFORM_EXPORT V8PerIsolateData {
56 USING_FAST_MALLOC(V8PerIsolateData); 56 USING_FAST_MALLOC(V8PerIsolateData);
57 WTF_MAKE_NONCOPYABLE(V8PerIsolateData); 57 WTF_MAKE_NONCOPYABLE(V8PerIsolateData);
58 58
59 public: 59 public:
60 class EndOfScopeTask { 60 class EndOfScopeTask {
61 USING_FAST_MALLOC(EndOfScopeTask); 61 USING_FAST_MALLOC(EndOfScopeTask);
62 62
63 public: 63 public:
64 virtual ~EndOfScopeTask() {} 64 virtual ~EndOfScopeTask() {}
65 virtual void Run() = 0; 65 virtual void Run() = 0;
(...skipping 20 matching lines...) Expand all
86 } 86 }
87 87
88 private: 88 private:
89 V8PerIsolateData* per_isolate_data_; 89 V8PerIsolateData* per_isolate_data_;
90 const bool original_use_counter_disabled_; 90 const bool original_use_counter_disabled_;
91 }; 91 };
92 92
93 // Use this class to abstract away types of members that are pointers to core/ 93 // Use this class to abstract away types of members that are pointers to core/
94 // objects, which are simply owned and released by V8PerIsolateData (see 94 // objects, which are simply owned and released by V8PerIsolateData (see
95 // m_threadDebugger for an example). 95 // m_threadDebugger for an example).
96 class CORE_EXPORT Data { 96 class PLATFORM_EXPORT Data {
97 public: 97 public:
98 virtual ~Data() = default; 98 virtual ~Data() = default;
99 }; 99 };
100 100
101 static v8::Isolate* Initialize(WebTaskRunner*); 101 static v8::Isolate* Initialize(WebTaskRunner*);
102 102
103 static V8PerIsolateData* From(v8::Isolate* isolate) { 103 static V8PerIsolateData* From(v8::Isolate* isolate) {
104 DCHECK(isolate); 104 DCHECK(isolate);
105 DCHECK(isolate->GetData(gin::kEmbedderBlink)); 105 DCHECK(isolate->GetData(gin::kEmbedderBlink));
106 return static_cast<V8PerIsolateData*>( 106 return static_cast<V8PerIsolateData*>(
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 void SetThreadDebugger(std::unique_ptr<Data>); 178 void SetThreadDebugger(std::unique_ptr<Data>);
179 Data* ThreadDebugger(); 179 Data* ThreadDebugger();
180 180
181 using ActiveScriptWrappableSet = 181 using ActiveScriptWrappableSet =
182 HeapHashSet<WeakMember<ActiveScriptWrappableBase>>; 182 HeapHashSet<WeakMember<ActiveScriptWrappableBase>>;
183 void AddActiveScriptWrappable(ActiveScriptWrappableBase*); 183 void AddActiveScriptWrappable(ActiveScriptWrappableBase*);
184 const ActiveScriptWrappableSet* ActiveScriptWrappables() const { 184 const ActiveScriptWrappableSet* ActiveScriptWrappables() const {
185 return active_script_wrappables_.Get(); 185 return active_script_wrappables_.Get();
186 } 186 }
187 187
188 class CORE_EXPORT TemporaryScriptWrappableVisitorScope { 188 class PLATFORM_EXPORT TemporaryScriptWrappableVisitorScope {
189 WTF_MAKE_NONCOPYABLE(TemporaryScriptWrappableVisitorScope); 189 WTF_MAKE_NONCOPYABLE(TemporaryScriptWrappableVisitorScope);
190 STACK_ALLOCATED(); 190 STACK_ALLOCATED();
191 191
192 public: 192 public:
193 TemporaryScriptWrappableVisitorScope( 193 TemporaryScriptWrappableVisitorScope(
194 v8::Isolate* isolate, 194 v8::Isolate* isolate,
195 std::unique_ptr<ScriptWrappableVisitor> visitor) 195 std::unique_ptr<ScriptWrappableVisitor> visitor)
196 : isolate_(isolate), saved_visitor_(std::move(visitor)) { 196 : isolate_(isolate), saved_visitor_(std::move(visitor)) {
197 SwapWithV8PerIsolateDataVisitor(saved_visitor_); 197 SwapWithV8PerIsolateDataVisitor(saved_visitor_);
198 } 198 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 Vector<std::unique_ptr<EndOfScopeTask>> end_of_scope_tasks_; 266 Vector<std::unique_ptr<EndOfScopeTask>> end_of_scope_tasks_;
267 std::unique_ptr<Data> thread_debugger_; 267 std::unique_ptr<Data> thread_debugger_;
268 268
269 Persistent<ActiveScriptWrappableSet> active_script_wrappables_; 269 Persistent<ActiveScriptWrappableSet> active_script_wrappables_;
270 std::unique_ptr<ScriptWrappableVisitor> script_wrappable_visitor_; 270 std::unique_ptr<ScriptWrappableVisitor> script_wrappable_visitor_;
271 }; 271 };
272 272
273 } // namespace blink 273 } // namespace blink
274 274
275 #endif // V8PerIsolateData_h 275 #endif // V8PerIsolateData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698