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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 ASSERT(static_cast<ScriptWrappable*>(static_cast<T*>(this))); | 66 ASSERT(static_cast<ScriptWrappable*>(static_cast<T*>(this))); |
67 return static_cast<T*>(this); | 67 return static_cast<T*>(this); |
68 } | 68 } |
69 | 69 |
70 // Returns the WrapperTypeInfo of the instance. | 70 // Returns the WrapperTypeInfo of the instance. |
71 // | 71 // |
72 // This method must be overridden by DEFINE_WRAPPERTYPEINFO macro. | 72 // This method must be overridden by DEFINE_WRAPPERTYPEINFO macro. |
73 virtual const WrapperTypeInfo* wrapperTypeInfo() const = 0; | 73 virtual const WrapperTypeInfo* wrapperTypeInfo() const = 0; |
74 | 74 |
75 // Creates and returns a new wrapper object. | 75 // Creates and returns a new wrapper object. |
76 virtual v8::Local<v8::Object> wrap(v8::Local<v8::Object> creationContext, v8
::Isolate*); | 76 virtual v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creat
ionContext); |
77 | 77 |
78 // Associates the instance with the existing wrapper. Returns |wrapper|. | 78 // Associates the instance with the existing wrapper. Returns |wrapper|. |
79 virtual v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const Wrapp
erTypeInfo*, v8::Local<v8::Object> wrapper); | 79 virtual v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const Wrapp
erTypeInfo*, v8::Local<v8::Object> wrapper); |
80 | 80 |
81 void setWrapper(v8::Local<v8::Object> wrapper, v8::Isolate* isolate, const W
rapperTypeInfo* wrapperTypeInfo) | 81 void setWrapper(v8::Local<v8::Object> wrapper, v8::Isolate* isolate, const W
rapperTypeInfo* wrapperTypeInfo) |
82 { | 82 { |
83 RELEASE_ASSERT(!containsWrapper()); | 83 RELEASE_ASSERT(!containsWrapper()); |
84 if (!*wrapper) | 84 if (!*wrapper) |
85 return; | 85 return; |
86 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(toScriptWrappable(wrapper) == t
his); | 86 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(toScriptWrappable(wrapper) == t
his); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // in X's cpp code, and instantiate X, i.e. "template class X;". | 235 // in X's cpp code, and instantiate X, i.e. "template class X;". |
236 #define DECLARE_WRAPPERTYPEINFO() \ | 236 #define DECLARE_WRAPPERTYPEINFO() \ |
237 public: \ | 237 public: \ |
238 virtual const WrapperTypeInfo* wrapperTypeInfo() const override; \ | 238 virtual const WrapperTypeInfo* wrapperTypeInfo() const override; \ |
239 private: \ | 239 private: \ |
240 typedef void end_of_define_wrappertypeinfo_not_reached_t | 240 typedef void end_of_define_wrappertypeinfo_not_reached_t |
241 | 241 |
242 } // namespace blink | 242 } // namespace blink |
243 | 243 |
244 #endif // ScriptWrappable_h | 244 #endif // ScriptWrappable_h |
OLD | NEW |