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

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

Issue 2728203002: Remove WRAPPER_VISITOR_SPECIAL_CLASSES (Closed)
Patch Set: Change CanTraceWrappers Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 41
42 namespace blink { 42 namespace blink {
43 43
44 class CORE_EXPORT TraceWrapperBase { 44 class CORE_EXPORT TraceWrapperBase {
45 WTF_MAKE_NONCOPYABLE(TraceWrapperBase); 45 WTF_MAKE_NONCOPYABLE(TraceWrapperBase);
46 46
47 public: 47 public:
48 TraceWrapperBase() = default; 48 TraceWrapperBase() = default;
49 virtual bool isScriptWrappable() const { return false; } 49 virtual bool isScriptWrappable() const { return false; }
50 50
51 void markAndDispatchTraceWrappers(const WrapperVisitor* visitor) const {
52 visitor->dispatchTraceWrappers(this);
53 }
54
51 DECLARE_VIRTUAL_TRACE_WRAPPERS(){}; 55 DECLARE_VIRTUAL_TRACE_WRAPPERS(){};
52 }; 56 };
53 57
54 // ScriptWrappable provides a way to map from/to C++ DOM implementation to/from 58 // ScriptWrappable provides a way to map from/to C++ DOM implementation to/from
55 // JavaScript object (platform object). ToV8() converts a ScriptWrappable to 59 // JavaScript object (platform object). ToV8() converts a ScriptWrappable to
56 // a v8::Object and toScriptWrappable() converts a v8::Object back to 60 // a v8::Object and toScriptWrappable() converts a v8::Object back to
57 // a ScriptWrappable. v8::Object as platform object is called "wrapper object". 61 // a ScriptWrappable. v8::Object as platform object is called "wrapper object".
58 // The wrapepr object for the main world is stored in ScriptWrappable. Wrapper 62 // The wrapepr object for the main world is stored in ScriptWrappable. Wrapper
59 // objects for other worlds are stored in DOMWrapperMap. 63 // objects for other worlds are stored in DOMWrapperMap.
60 class CORE_EXPORT ScriptWrappable : public TraceWrapperBase { 64 class CORE_EXPORT ScriptWrappable : public TraceWrapperBase {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return containsWrapper(); 158 return containsWrapper();
155 } 159 }
156 160
157 bool containsWrapper() const { return !m_mainWorldWrapper.IsEmpty(); } 161 bool containsWrapper() const { return !m_mainWorldWrapper.IsEmpty(); }
158 162
159 // Mark wrapper of this ScriptWrappable as alive in V8. Only marks 163 // Mark wrapper of this ScriptWrappable as alive in V8. Only marks
160 // wrapper in the main world. To mark wrappers in all worlds call 164 // wrapper in the main world. To mark wrappers in all worlds call
161 // ScriptWrappableVisitor::markWrapper(ScriptWrappable*, v8::Isolate*) 165 // ScriptWrappableVisitor::markWrapper(ScriptWrappable*, v8::Isolate*)
162 void markWrapper(const WrapperVisitor*) const; 166 void markWrapper(const WrapperVisitor*) const;
163 167
168 void markAndDispatchTraceWrappers(const WrapperVisitor* visitor) const {
169 visitor->markWrappersInAllWorlds(this);
170 visitor->dispatchTraceWrappers(this);
171 }
172
164 private: 173 private:
165 // These classes are exceptionally allowed to use mainWorldWrapper(). 174 // These classes are exceptionally allowed to use mainWorldWrapper().
166 friend class DOMDataStore; 175 friend class DOMDataStore;
167 friend class HeapSnaphotWrapperVisitor; 176 friend class HeapSnaphotWrapperVisitor;
168 friend class V8HiddenValue; 177 friend class V8HiddenValue;
169 friend class V8PrivateProperty; 178 friend class V8PrivateProperty;
170 179
171 v8::Local<v8::Object> mainWorldWrapper(v8::Isolate* isolate) const { 180 v8::Local<v8::Object> mainWorldWrapper(v8::Isolate* isolate) const {
172 return v8::Local<v8::Object>::New(isolate, m_mainWorldWrapper); 181 return v8::Local<v8::Object>::New(isolate, m_mainWorldWrapper);
173 } 182 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 #define DECLARE_WRAPPERTYPEINFO() \ 220 #define DECLARE_WRAPPERTYPEINFO() \
212 public: \ 221 public: \
213 const WrapperTypeInfo* wrapperTypeInfo() const override; \ 222 const WrapperTypeInfo* wrapperTypeInfo() const override; \
214 \ 223 \
215 private: \ 224 private: \
216 typedef void end_of_define_wrappertypeinfo_not_reached_t 225 typedef void end_of_define_wrappertypeinfo_not_reached_t
217 226
218 } // namespace blink 227 } // namespace blink
219 228
220 #endif // ScriptWrappable_h 229 #endif // ScriptWrappable_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698