OLD | NEW |
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // The definition of fromNode is placed in Node.h because we'd like to | 126 // The definition of fromNode is placed in Node.h because we'd like to |
127 // inline calls to fromNode as much as possible. | 127 // inline calls to fromNode as much as possible. |
128 static ScriptWrappable* fromNode(Node*); | 128 static ScriptWrappable* fromNode(Node*); |
129 | 129 |
130 bool setReturnValue(v8::ReturnValue<v8::Value> returnValue) | 130 bool setReturnValue(v8::ReturnValue<v8::Value> returnValue) |
131 { | 131 { |
132 returnValue.Set(m_wrapper); | 132 returnValue.Set(m_wrapper); |
133 return containsWrapper(); | 133 return containsWrapper(); |
134 } | 134 } |
135 | 135 |
136 void markAsDependentGroup(ScriptWrappable* groupRoot, v8::Isolate* isolate) | |
137 { | |
138 ASSERT(containsWrapper()); | |
139 ASSERT(groupRoot && groupRoot->containsWrapper()); | |
140 | |
141 // FIXME: There has to be a better way. | |
142 v8::UniqueId groupId(*reinterpret_cast<intptr_t*>(&groupRoot->m_wrapper)
); | |
143 m_wrapper.MarkPartiallyDependent(); | |
144 isolate->SetObjectGroupId(v8::Persistent<v8::Value>::Cast(m_wrapper), gr
oupId); | |
145 } | |
146 | |
147 void setReference(const v8::Persistent<v8::Object>& parent, v8::Isolate* iso
late) | 136 void setReference(const v8::Persistent<v8::Object>& parent, v8::Isolate* iso
late) |
148 { | 137 { |
149 isolate->SetReference(parent, m_wrapper); | 138 isolate->SetReference(parent, m_wrapper); |
150 } | 139 } |
151 | 140 |
152 bool containsWrapper() const { return !m_wrapper.IsEmpty(); } | 141 bool containsWrapper() const { return !m_wrapper.IsEmpty(); } |
153 | 142 |
154 #if !ENABLE(OILPAN) | 143 #if !ENABLE(OILPAN) |
155 protected: | 144 protected: |
156 virtual ~ScriptWrappable() | 145 virtual ~ScriptWrappable() |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // in X's cpp code, and instantiate X, i.e. "template class X;". | 231 // in X's cpp code, and instantiate X, i.e. "template class X;". |
243 #define DECLARE_WRAPPERTYPEINFO() \ | 232 #define DECLARE_WRAPPERTYPEINFO() \ |
244 public: \ | 233 public: \ |
245 const WrapperTypeInfo* wrapperTypeInfo() const override; \ | 234 const WrapperTypeInfo* wrapperTypeInfo() const override; \ |
246 private: \ | 235 private: \ |
247 typedef void end_of_define_wrappertypeinfo_not_reached_t | 236 typedef void end_of_define_wrappertypeinfo_not_reached_t |
248 | 237 |
249 } // namespace blink | 238 } // namespace blink |
250 | 239 |
251 #endif // ScriptWrappable_h | 240 #endif // ScriptWrappable_h |
OLD | NEW |