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 |
131 bool isEqualTo(const v8::Local<v8::Object>& other) const { | 139 bool isEqualTo(const v8::Local<v8::Object>& other) const { |
132 return m_mainWorldWrapper == other; | 140 return m_mainWorldWrapper == other; |
133 } | 141 } |
134 | 142 |
135 // Provides a way to convert Node* to ScriptWrappable* without including | 143 // Provides a way to convert Node* to ScriptWrappable* without including |
136 // "core/dom/Node.h". | 144 // "core/dom/Node.h". |
137 // | 145 // |
138 // Example: | 146 // Example: |
139 // void foo(const void*) { ... } // [1] | 147 // void foo(const void*) { ... } // [1] |
140 // void foo(ScriptWrappable*) { ... } // [2] | 148 // void foo(ScriptWrappable*) { ... } // [2] |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 #define DECLARE_WRAPPERTYPEINFO() \ | 224 #define DECLARE_WRAPPERTYPEINFO() \ |
217 public: \ | 225 public: \ |
218 const WrapperTypeInfo* wrapperTypeInfo() const override; \ | 226 const WrapperTypeInfo* wrapperTypeInfo() const override; \ |
219 \ | 227 \ |
220 private: \ | 228 private: \ |
221 typedef void end_of_define_wrappertypeinfo_not_reached_t | 229 typedef void end_of_define_wrappertypeinfo_not_reached_t |
222 | 230 |
223 } // namespace blink | 231 } // namespace blink |
224 | 232 |
225 #endif // ScriptWrappable_h | 233 #endif // ScriptWrappable_h |
OLD | NEW |