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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 ScriptWrappable() : m_wrapper(0) { } | 113 ScriptWrappable() : m_wrapper(0) { } |
114 | 114 |
115 // Returns the WrapperTypeInfo of the instance. | 115 // Returns the WrapperTypeInfo of the instance. |
116 // | 116 // |
117 // This method must be overridden by DEFINE_WRAPPERTYPEINFO macro. | 117 // This method must be overridden by DEFINE_WRAPPERTYPEINFO macro. |
118 virtual const WrapperTypeInfo* wrapperTypeInfo() const = 0; | 118 virtual const WrapperTypeInfo* wrapperTypeInfo() const = 0; |
119 | 119 |
120 // Creates and returns a new wrapper object. | 120 // Creates and returns a new wrapper object. |
121 virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*); | 121 virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*); |
122 | 122 |
123 // Associates the instance with the existing wrapper. Returns |wrapper|. | |
haraken
2014/09/08 08:48:45
Why does this need to return a wrapper? The return
Yuki
2014/09/08 09:00:22
Not necessary, it's just convenient that we can
haraken
2014/09/08 09:07:22
Either is fine with me :)
| |
124 virtual v8::Handle<v8::Object> associateWithWrapper(const WrapperTypeInfo*, v8::Handle<v8::Object> wrapper, v8::Isolate*); | |
125 | |
123 void setWrapper(v8::Handle<v8::Object> wrapper, v8::Isolate* isolate, const WrapperTypeInfo* wrapperTypeInfo) | 126 void setWrapper(v8::Handle<v8::Object> wrapper, v8::Isolate* isolate, const WrapperTypeInfo* wrapperTypeInfo) |
124 { | 127 { |
125 ASSERT(!containsWrapper()); | 128 ASSERT(!containsWrapper()); |
126 if (!*wrapper) { | 129 if (!*wrapper) { |
127 m_wrapper = 0; | 130 m_wrapper = 0; |
128 return; | 131 return; |
129 } | 132 } |
130 v8::Persistent<v8::Object> persistent(isolate, wrapper); | 133 v8::Persistent<v8::Object> persistent(isolate, wrapper); |
131 wrapperTypeInfo->configureWrapper(&persistent); | 134 wrapperTypeInfo->configureWrapper(&persistent); |
132 persistent.SetWeak(this, &setWeakCallback); | 135 persistent.SetWeak(this, &setWeakCallback); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
299 virtual const WrapperTypeInfo* wrapperTypeInfo() const OVERRIDE \ | 302 virtual const WrapperTypeInfo* wrapperTypeInfo() const OVERRIDE \ |
300 { \ | 303 { \ |
301 return &s_wrapperTypeInfo; \ | 304 return &s_wrapperTypeInfo; \ |
302 } \ | 305 } \ |
303 private: \ | 306 private: \ |
304 static const WrapperTypeInfo& s_wrapperTypeInfo | 307 static const WrapperTypeInfo& s_wrapperTypeInfo |
305 | 308 |
306 } // namespace blink | 309 } // namespace blink |
307 | 310 |
308 #endif // ScriptWrappable_h | 311 #endif // ScriptWrappable_h |
OLD | NEW |