| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 virtual bool HasPendingActivity() const { return false; } | 110 virtual bool HasPendingActivity() const { return false; } |
| 111 | 111 |
| 112 // Associates this instance with the given |wrapper| if this instance is not | 112 // Associates this instance with the given |wrapper| if this instance is not |
| 113 // yet associated with any wrapper. Returns true if the given wrapper is | 113 // yet associated with any wrapper. Returns true if the given wrapper is |
| 114 // associated with this instance, or false if this instance is already | 114 // associated with this instance, or false if this instance is already |
| 115 // associated with a wrapper. In the latter case, |wrapper| will be updated | 115 // associated with a wrapper. In the latter case, |wrapper| will be updated |
| 116 // to the existing wrapper. | 116 // to the existing wrapper. |
| 117 WARN_UNUSED_RESULT bool SetWrapper(v8::Isolate* isolate, | 117 WARN_UNUSED_RESULT bool SetWrapper(v8::Isolate* isolate, |
| 118 const WrapperTypeInfo* wrapper_type_info, | 118 const WrapperTypeInfo* wrapper_type_info, |
| 119 v8::Local<v8::Object>& wrapper) { | 119 v8::Local<v8::Object>& wrapper) { |
| 120 ASSERT(!wrapper.IsEmpty()); | 120 DCHECK(!wrapper.IsEmpty()); |
| 121 if (UNLIKELY(ContainsWrapper())) { | 121 if (UNLIKELY(ContainsWrapper())) { |
| 122 wrapper = MainWorldWrapper(isolate); | 122 wrapper = MainWorldWrapper(isolate); |
| 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 ASSERT(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 bool IsEqualTo(const v8::Local<v8::Object>& other) const { | 133 bool IsEqualTo(const v8::Local<v8::Object>& other) const { |
| 134 return main_world_wrapper_ == other; | 134 return main_world_wrapper_ == other; |
| 135 } | 135 } |
| 136 | 136 |
| 137 // Provides a way to convert Node* to ScriptWrappable* without including | 137 // Provides a way to convert Node* to ScriptWrappable* without including |
| 138 // "core/dom/Node.h". | 138 // "core/dom/Node.h". |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 #define DECLARE_WRAPPERTYPEINFO() \ | 213 #define DECLARE_WRAPPERTYPEINFO() \ |
| 214 public: \ | 214 public: \ |
| 215 const WrapperTypeInfo* GetWrapperTypeInfo() const override; \ | 215 const WrapperTypeInfo* GetWrapperTypeInfo() const override; \ |
| 216 \ | 216 \ |
| 217 private: \ | 217 private: \ |
| 218 typedef void end_of_define_wrappertypeinfo_not_reached_t | 218 typedef void end_of_define_wrappertypeinfo_not_reached_t |
| 219 | 219 |
| 220 } // namespace blink | 220 } // namespace blink |
| 221 | 221 |
| 222 #endif // ScriptWrappable_h | 222 #endif // ScriptWrappable_h |
| OLD | NEW |