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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 wrapper = mainWorldWrapper(isolate); | 121 wrapper = mainWorldWrapper(isolate); |
122 return false; | 122 return false; |
123 } | 123 } |
124 m_mainWorldWrapper.Reset(isolate, wrapper); | 124 m_mainWorldWrapper.Reset(isolate, wrapper); |
125 wrapperTypeInfo->configureWrapper(&m_mainWorldWrapper); | 125 wrapperTypeInfo->configureWrapper(&m_mainWorldWrapper); |
126 m_mainWorldWrapper.SetWeak(); | 126 m_mainWorldWrapper.SetWeak(); |
127 ASSERT(containsWrapper()); | 127 ASSERT(containsWrapper()); |
128 return true; | 128 return true; |
129 } | 129 } |
130 | 130 |
131 // Dissociates the wrapper, if any, from this instance. | |
132 void unsetWrapperIfAny() { | |
133 if (containsWrapper()) { | |
134 m_mainWorldWrapper.Reset(); | |
135 WrapperTypeInfo::wrapperDestroyed(); | |
136 } | |
137 } | |
138 | |
139 bool isEqualTo(const v8::Local<v8::Object>& other) const { | 131 bool isEqualTo(const v8::Local<v8::Object>& other) const { |
140 return m_mainWorldWrapper == other; | 132 return m_mainWorldWrapper == other; |
141 } | 133 } |
142 | 134 |
143 // Provides a way to convert Node* to ScriptWrappable* without including | 135 // Provides a way to convert Node* to ScriptWrappable* without including |
144 // "core/dom/Node.h". | 136 // "core/dom/Node.h". |
145 // | 137 // |
146 // Example: | 138 // Example: |
147 // void foo(const void*) { ... } // [1] | 139 // void foo(const void*) { ... } // [1] |
148 // void foo(ScriptWrappable*) { ... } // [2] | 140 // void foo(ScriptWrappable*) { ... } // [2] |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 #define DECLARE_WRAPPERTYPEINFO() \ | 211 #define DECLARE_WRAPPERTYPEINFO() \ |
220 public: \ | 212 public: \ |
221 const WrapperTypeInfo* wrapperTypeInfo() const override; \ | 213 const WrapperTypeInfo* wrapperTypeInfo() const override; \ |
222 \ | 214 \ |
223 private: \ | 215 private: \ |
224 typedef void end_of_define_wrappertypeinfo_not_reached_t | 216 typedef void end_of_define_wrappertypeinfo_not_reached_t |
225 | 217 |
226 } // namespace blink | 218 } // namespace blink |
227 | 219 |
228 #endif // ScriptWrappable_h | 220 #endif // ScriptWrappable_h |
OLD | NEW |