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

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

Issue 2687943004: Abstract out ThreadDebugger from V8PerIsolateData (Closed)
Patch Set: Only abstract thread debugger 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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
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 <v8.h>
30 #include <memory>
29 #include "bindings/core/v8/ScopedPersistent.h" 31 #include "bindings/core/v8/ScopedPersistent.h"
30 #include "bindings/core/v8/ScriptState.h" 32 #include "bindings/core/v8/ScriptState.h"
31 #include "bindings/core/v8/ScriptWrappableVisitor.h" 33 #include "bindings/core/v8/ScriptWrappableVisitor.h"
32 #include "bindings/core/v8/V8HiddenValue.h" 34 #include "bindings/core/v8/V8HiddenValue.h"
33 #include "bindings/core/v8/WrapperTypeInfo.h" 35 #include "bindings/core/v8/WrapperTypeInfo.h"
34 #include "core/CoreExport.h" 36 #include "core/CoreExport.h"
35 #include "gin/public/isolate_holder.h" 37 #include "gin/public/isolate_holder.h"
36 #include "gin/public/v8_idle_task_runner.h" 38 #include "gin/public/v8_idle_task_runner.h"
37 #include "platform/heap/Handle.h" 39 #include "platform/heap/Handle.h"
38 #include "wtf/HashMap.h" 40 #include "wtf/HashMap.h"
39 #include "wtf/Noncopyable.h" 41 #include "wtf/Noncopyable.h"
40 #include "wtf/Vector.h" 42 #include "wtf/Vector.h"
41 #include <memory>
42 #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 ThreadDebugger;
50 class V8PrivateProperty; 49 class V8PrivateProperty;
51 class WebTaskRunner; 50 class WebTaskRunner;
52 struct WrapperTypeInfo; 51 struct WrapperTypeInfo;
53 52
54 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList; 53 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList;
55 54
56 class CORE_EXPORT V8PerIsolateData { 55 class CORE_EXPORT V8PerIsolateData {
57 USING_FAST_MALLOC(V8PerIsolateData); 56 USING_FAST_MALLOC(V8PerIsolateData);
58 WTF_MAKE_NONCOPYABLE(V8PerIsolateData); 57 WTF_MAKE_NONCOPYABLE(V8PerIsolateData);
59 58
(...skipping 23 matching lines...) Expand all
83 } 82 }
84 ~UseCounterDisabledScope() { 83 ~UseCounterDisabledScope() {
85 m_perIsolateData->m_useCounterDisabled = m_originalUseCounterDisabled; 84 m_perIsolateData->m_useCounterDisabled = m_originalUseCounterDisabled;
86 } 85 }
87 86
88 private: 87 private:
89 V8PerIsolateData* m_perIsolateData; 88 V8PerIsolateData* m_perIsolateData;
90 const bool m_originalUseCounterDisabled; 89 const bool m_originalUseCounterDisabled;
91 }; 90 };
92 91
92 class CORE_EXPORT Data {
haraken 2017/02/16 00:27:10 Add a comment and explain when this class should b
adithyas 2017/02/16 15:18:04 Done.
93 public:
94 virtual ~Data(){};
jbroman 2017/02/15 18:39:09 super-nit: no semicolon after a function definitio
adithyas 2017/02/16 15:18:04 Fixed.
95 };
96
93 static v8::Isolate* initialize(WebTaskRunner*); 97 static v8::Isolate* initialize(WebTaskRunner*);
94 98
95 static V8PerIsolateData* from(v8::Isolate* isolate) { 99 static V8PerIsolateData* from(v8::Isolate* isolate) {
96 ASSERT(isolate); 100 ASSERT(isolate);
97 ASSERT(isolate->GetData(gin::kEmbedderBlink)); 101 ASSERT(isolate->GetData(gin::kEmbedderBlink));
98 return static_cast<V8PerIsolateData*>( 102 return static_cast<V8PerIsolateData*>(
99 isolate->GetData(gin::kEmbedderBlink)); 103 isolate->GetData(gin::kEmbedderBlink));
100 } 104 }
101 105
102 static void willBeDestroyed(v8::Isolate*); 106 static void willBeDestroyed(v8::Isolate*);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 void clearScriptRegexpContext(); 156 void clearScriptRegexpContext();
153 157
154 // EndOfScopeTasks are run when control is returning 158 // EndOfScopeTasks are run when control is returning
155 // to C++ from script, after executing a script task (e.g. callback, 159 // to C++ from script, after executing a script task (e.g. callback,
156 // event) or microtasks (e.g. promise). This is explicitly needed for 160 // event) or microtasks (e.g. promise). This is explicitly needed for
157 // Indexed DB transactions per spec, but should in general be avoided. 161 // Indexed DB transactions per spec, but should in general be avoided.
158 void addEndOfScopeTask(std::unique_ptr<EndOfScopeTask>); 162 void addEndOfScopeTask(std::unique_ptr<EndOfScopeTask>);
159 void runEndOfScopeTasks(); 163 void runEndOfScopeTasks();
160 void clearEndOfScopeTasks(); 164 void clearEndOfScopeTasks();
161 165
162 void setThreadDebugger(std::unique_ptr<ThreadDebugger>); 166 void setThreadDebugger(std::unique_ptr<Data>);
163 ThreadDebugger* threadDebugger(); 167 Data* threadDebugger();
164 168
165 using ActiveScriptWrappableSet = 169 using ActiveScriptWrappableSet =
166 HeapHashSet<WeakMember<ActiveScriptWrappableBase>>; 170 HeapHashSet<WeakMember<ActiveScriptWrappableBase>>;
167 void addActiveScriptWrappable(ActiveScriptWrappableBase*); 171 void addActiveScriptWrappable(ActiveScriptWrappableBase*);
168 const ActiveScriptWrappableSet* activeScriptWrappables() const { 172 const ActiveScriptWrappableSet* activeScriptWrappables() const {
169 return m_activeScriptWrappables.get(); 173 return m_activeScriptWrappables.get();
170 } 174 }
171 175
172 class TemporaryScriptWrappableVisitorScope { 176 class TemporaryScriptWrappableVisitorScope {
173 WTF_MAKE_NONCOPYABLE(TemporaryScriptWrappableVisitorScope); 177 WTF_MAKE_NONCOPYABLE(TemporaryScriptWrappableVisitorScope);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 bool m_constructorMode; 243 bool m_constructorMode;
240 friend class ConstructorMode; 244 friend class ConstructorMode;
241 245
242 bool m_useCounterDisabled; 246 bool m_useCounterDisabled;
243 friend class UseCounterDisabledScope; 247 friend class UseCounterDisabledScope;
244 248
245 bool m_isHandlingRecursionLevelError; 249 bool m_isHandlingRecursionLevelError;
246 bool m_isReportingException; 250 bool m_isReportingException;
247 251
248 Vector<std::unique_ptr<EndOfScopeTask>> m_endOfScopeTasks; 252 Vector<std::unique_ptr<EndOfScopeTask>> m_endOfScopeTasks;
249 std::unique_ptr<ThreadDebugger> m_threadDebugger; 253 std::unique_ptr<Data> m_threadDebugger;
250 254
251 Persistent<ActiveScriptWrappableSet> m_activeScriptWrappables; 255 Persistent<ActiveScriptWrappableSet> m_activeScriptWrappables;
252 std::unique_ptr<ScriptWrappableVisitor> m_scriptWrappableVisitor; 256 std::unique_ptr<ScriptWrappableVisitor> m_scriptWrappableVisitor;
253 }; 257 };
254 258
255 } // namespace blink 259 } // namespace blink
256 260
257 #endif // V8PerIsolateData_h 261 #endif // V8PerIsolateData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698