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