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

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

Issue 2703183002: Factor out gin::IsolateHolder's constructor
Patch Set: fix WorkerBackingThread Created 3 years, 10 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 29 matching lines...) Expand all
40 #include "wtf/HashMap.h" 40 #include "wtf/HashMap.h"
41 #include "wtf/Noncopyable.h" 41 #include "wtf/Noncopyable.h"
42 #include "wtf/Vector.h" 42 #include "wtf/Vector.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;
51 struct WrapperTypeInfo; 50 struct WrapperTypeInfo;
52 51
53 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList; 52 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList;
54 53
55 class CORE_EXPORT V8PerIsolateData { 54 class CORE_EXPORT V8PerIsolateData {
56 USING_FAST_MALLOC(V8PerIsolateData); 55 USING_FAST_MALLOC(V8PerIsolateData);
57 WTF_MAKE_NONCOPYABLE(V8PerIsolateData); 56 WTF_MAKE_NONCOPYABLE(V8PerIsolateData);
58 57
59 public: 58 public:
60 class EndOfScopeTask { 59 class EndOfScopeTask {
(...skipping 29 matching lines...) Expand all
90 }; 89 };
91 90
92 // Use this class to abstract away types of members that are pointers to core/ 91 // Use this class to abstract away types of members that are pointers to core/
93 // objects, which are simply owned and released by V8PerIsolateData (see 92 // objects, which are simply owned and released by V8PerIsolateData (see
94 // m_threadDebugger for an example). 93 // m_threadDebugger for an example).
95 class CORE_EXPORT Data { 94 class CORE_EXPORT Data {
96 public: 95 public:
97 virtual ~Data() = default; 96 virtual ~Data() = default;
98 }; 97 };
99 98
100 static v8::Isolate* initialize(WebTaskRunner*); 99 static v8::Isolate* initialize(std::unique_ptr<gin::IsolateHolder>);
101 100
102 static V8PerIsolateData* from(v8::Isolate* isolate) { 101 static V8PerIsolateData* from(v8::Isolate* isolate) {
103 ASSERT(isolate); 102 ASSERT(isolate);
104 ASSERT(isolate->GetData(gin::kEmbedderBlink)); 103 ASSERT(isolate->GetData(gin::kEmbedderBlink));
105 return static_cast<V8PerIsolateData*>( 104 return static_cast<V8PerIsolateData*>(
106 isolate->GetData(gin::kEmbedderBlink)); 105 isolate->GetData(gin::kEmbedderBlink));
107 } 106 }
108 107
109 static void willBeDestroyed(v8::Isolate*); 108 static void willBeDestroyed(v8::Isolate*);
110 static void destroy(v8::Isolate*); 109 static void destroy(v8::Isolate*);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 204
206 void setScriptWrappableVisitor( 205 void setScriptWrappableVisitor(
207 std::unique_ptr<ScriptWrappableVisitor> visitor) { 206 std::unique_ptr<ScriptWrappableVisitor> visitor) {
208 m_scriptWrappableVisitor = std::move(visitor); 207 m_scriptWrappableVisitor = std::move(visitor);
209 } 208 }
210 ScriptWrappableVisitor* scriptWrappableVisitor() { 209 ScriptWrappableVisitor* scriptWrappableVisitor() {
211 return m_scriptWrappableVisitor.get(); 210 return m_scriptWrappableVisitor.get();
212 } 211 }
213 212
214 private: 213 private:
215 explicit V8PerIsolateData(WebTaskRunner*); 214 explicit V8PerIsolateData(std::unique_ptr<gin::IsolateHolder>);
216 ~V8PerIsolateData(); 215 ~V8PerIsolateData();
217 216
218 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate>> 217 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate>>
219 V8FunctionTemplateMap; 218 V8FunctionTemplateMap;
220 V8FunctionTemplateMap& selectInterfaceTemplateMap(const DOMWrapperWorld&); 219 V8FunctionTemplateMap& selectInterfaceTemplateMap(const DOMWrapperWorld&);
221 V8FunctionTemplateMap& selectOperationTemplateMap(const DOMWrapperWorld&); 220 V8FunctionTemplateMap& selectOperationTemplateMap(const DOMWrapperWorld&);
222 bool hasInstance(const WrapperTypeInfo* untrusted, 221 bool hasInstance(const WrapperTypeInfo* untrusted,
223 v8::Local<v8::Value>, 222 v8::Local<v8::Value>,
224 V8FunctionTemplateMap&); 223 V8FunctionTemplateMap&);
225 v8::Local<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*, 224 v8::Local<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*,
(...skipping 29 matching lines...) Expand all
255 Vector<std::unique_ptr<EndOfScopeTask>> m_endOfScopeTasks; 254 Vector<std::unique_ptr<EndOfScopeTask>> m_endOfScopeTasks;
256 std::unique_ptr<Data> m_threadDebugger; 255 std::unique_ptr<Data> m_threadDebugger;
257 256
258 Persistent<ActiveScriptWrappableSet> m_activeScriptWrappables; 257 Persistent<ActiveScriptWrappableSet> m_activeScriptWrappables;
259 std::unique_ptr<ScriptWrappableVisitor> m_scriptWrappableVisitor; 258 std::unique_ptr<ScriptWrappableVisitor> m_scriptWrappableVisitor;
260 }; 259 };
261 260
262 } // namespace blink 261 } // namespace blink
263 262
264 #endif // V8PerIsolateData_h 263 #endif // V8PerIsolateData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698