| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 * The state transitions are: | 105 * The state transitions are: |
| 106 * - new: an empty ScriptWrappable. | 106 * - new: an empty ScriptWrappable. |
| 107 * - setWrapper: install a v8::Persistent (or empty) | 107 * - setWrapper: install a v8::Persistent (or empty) |
| 108 * - disposeWrapper (via setWeakCallback, triggered by V8 garbage collecter): | 108 * - disposeWrapper (via setWeakCallback, triggered by V8 garbage collecter): |
| 109 * remove v8::Persistent and become empty. | 109 * remove v8::Persistent and become empty. |
| 110 */ | 110 */ |
| 111 class ScriptWrappable : public ScriptWrappableBase { | 111 class ScriptWrappable : public ScriptWrappableBase { |
| 112 public: | 112 public: |
| 113 ScriptWrappable() { } | 113 ScriptWrappable() { } |
| 114 | 114 |
| 115 template<typename T> | |
| 116 static void init(T*) {} | |
| 117 | |
| 118 // Returns the WrapperTypeInfo of the instance. | 115 // Returns the WrapperTypeInfo of the instance. |
| 119 // | 116 // |
| 120 // This method must be overridden by DEFINE_WRAPPERTYPEINFO macro. | 117 // This method must be overridden by DEFINE_WRAPPERTYPEINFO macro. |
| 121 virtual const WrapperTypeInfo* wrapperTypeInfo() const = 0; | 118 virtual const WrapperTypeInfo* wrapperTypeInfo() const = 0; |
| 122 | 119 |
| 123 // Creates and returns a new wrapper object. | 120 // Creates and returns a new wrapper object. |
| 124 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*); |
| 125 | 122 |
| 126 // Associates the instance with the existing wrapper. Returns |wrapper|. | 123 // Associates the instance with the existing wrapper. Returns |wrapper|. |
| 127 virtual v8::Handle<v8::Object> associateWithWrapper(const WrapperTypeInfo*,
v8::Handle<v8::Object> wrapper, v8::Isolate*); | 124 virtual v8::Handle<v8::Object> associateWithWrapper(const WrapperTypeInfo*,
v8::Handle<v8::Object> wrapper, v8::Isolate*); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 virtual const WrapperTypeInfo* wrapperTypeInfo() const override \ | 266 virtual const WrapperTypeInfo* wrapperTypeInfo() const override \ |
| 270 { \ | 267 { \ |
| 271 return &s_wrapperTypeInfo; \ | 268 return &s_wrapperTypeInfo; \ |
| 272 } \ | 269 } \ |
| 273 private: \ | 270 private: \ |
| 274 static const WrapperTypeInfo& s_wrapperTypeInfo | 271 static const WrapperTypeInfo& s_wrapperTypeInfo |
| 275 | 272 |
| 276 } // namespace blink | 273 } // namespace blink |
| 277 | 274 |
| 278 #endif // ScriptWrappable_h | 275 #endif // ScriptWrappable_h |
| OLD | NEW |