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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 v8::Local<v8::Function>, | 74 v8::Local<v8::Function>, |
75 v8::Local<v8::FunctionTemplate>); | 75 v8::Local<v8::FunctionTemplate>); |
76 | 76 |
77 inline void setObjectGroup(v8::Isolate* isolate, | 77 inline void setObjectGroup(v8::Isolate* isolate, |
78 ScriptWrappable* scriptWrappable, | 78 ScriptWrappable* scriptWrappable, |
79 const v8::Persistent<v8::Object>& wrapper) { | 79 const v8::Persistent<v8::Object>& wrapper) { |
80 isolate->SetObjectGroupId( | 80 isolate->SetObjectGroupId( |
81 wrapper, v8::UniqueId(reinterpret_cast<intptr_t>(scriptWrappable))); | 81 wrapper, v8::UniqueId(reinterpret_cast<intptr_t>(scriptWrappable))); |
82 } | 82 } |
83 | 83 |
84 // This struct provides a way to store a bunch of information that is helpful wh
en unwrapping | 84 // This struct provides a way to store a bunch of information that is helpful |
85 // v8 objects. Each v8 bindings class has exactly one static WrapperTypeInfo mem
ber, so | 85 // when unwrapping v8 objects. Each v8 bindings class has exactly one static |
86 // comparing pointers is a safe way to determine if types match. | 86 // WrapperTypeInfo member, so comparing pointers is a safe way to determine if |
| 87 // types match. |
87 struct WrapperTypeInfo { | 88 struct WrapperTypeInfo { |
88 DISALLOW_NEW(); | 89 DISALLOW_NEW(); |
89 | 90 |
90 enum WrapperTypePrototype { | 91 enum WrapperTypePrototype { |
91 WrapperTypeObjectPrototype, | 92 WrapperTypeObjectPrototype, |
92 WrapperTypeExceptionPrototype, | 93 WrapperTypeExceptionPrototype, |
93 }; | 94 }; |
94 | 95 |
95 enum WrapperClassId { | 96 enum WrapperClassId { |
96 NodeClassId = 1, // NodeClassId must be smaller than ObjectClassId. | 97 NodeClassId = 1, // NodeClassId must be smaller than ObjectClassId. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper); | 237 return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper); |
237 } | 238 } |
238 | 239 |
239 inline const WrapperTypeInfo* toWrapperTypeInfo(v8::Local<v8::Object> wrapper) { | 240 inline const WrapperTypeInfo* toWrapperTypeInfo(v8::Local<v8::Object> wrapper) { |
240 return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper); | 241 return getInternalField<WrapperTypeInfo, v8DOMWrapperTypeIndex>(wrapper); |
241 } | 242 } |
242 | 243 |
243 } // namespace blink | 244 } // namespace blink |
244 | 245 |
245 #endif // WrapperTypeInfo_h | 246 #endif // WrapperTypeInfo_h |
OLD | NEW |