Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: Source/bindings/v8/custom/V8TypedArrayCustom.h

Issue 40433002: Make wrapperTypeInfo static member const in bindings classes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return TypedArrayTraits<TypedArray>::IsInstance(value); 52 return TypedArrayTraits<TypedArray>::IsInstance(value);
53 } 53 }
54 54
55 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Isolate*) 55 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Isolate*)
56 { 56 {
57 return TypedArrayTraits<TypedArray>::IsInstance(value); 57 return TypedArrayTraits<TypedArray>::IsInstance(value);
58 } 58 }
59 59
60 static TypedArray* toNative(v8::Handle<v8::Object>); 60 static TypedArray* toNative(v8::Handle<v8::Object>);
61 static void derefObject(void*); 61 static void derefObject(void*);
62 static WrapperTypeInfo wrapperTypeInfo; 62 static const WrapperTypeInfo wrapperTypeInfo;
63 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount; 63 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount;
64 64
65 static v8::Handle<v8::Object> wrap(TypedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 65 static v8::Handle<v8::Object> wrap(TypedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
66 { 66 {
67 ASSERT(impl); 67 ASSERT(impl);
68 ASSERT(!DOMDataStore::containsWrapper<Binding>(impl, isolate)); 68 ASSERT(!DOMDataStore::containsWrapper<Binding>(impl, isolate));
69 return V8TypedArray<TypedArray>::createWrapper(impl, creationContext, is olate); 69 return V8TypedArray<TypedArray>::createWrapper(impl, creationContext, is olate);
70 } 70 }
71 71
72 static v8::Handle<v8::Value> toV8(TypedArray* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 72 static v8::Handle<v8::Value> toV8(TypedArray* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 typedef TypedArrayTraits<TypedArray> Traits; 127 typedef TypedArrayTraits<TypedArray> Traits;
128 typedef typename Traits::V8Type V8Type; 128 typedef typename Traits::V8Type V8Type;
129 typedef V8TypedArray<TypedArray> Binding; 129 typedef V8TypedArray<TypedArray> Binding;
130 130
131 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TypedArray>, v8::Hand le<v8::Object> creationContext, v8::Isolate*); 131 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TypedArray>, v8::Hand le<v8::Object> creationContext, v8::Isolate*);
132 }; 132 };
133 133
134 template<typename TypedArray> 134 template<typename TypedArray>
135 class TypedArrayWrapperTraits { 135 class TypedArrayWrapperTraits {
136 public: 136 public:
137 static WrapperTypeInfo* info() { return &V8TypedArray<TypedArray>::wrapperTy peInfo; } 137 static const WrapperTypeInfo* info() { return &V8TypedArray<TypedArray>::wra pperTypeInfo; }
138 }; 138 };
139 139
140 140
141 template <typename TypedArray> 141 template <typename TypedArray>
142 v8::Handle<v8::Object> V8TypedArray<TypedArray>::createWrapper(PassRefPtr<TypedA rray> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 142 v8::Handle<v8::Object> V8TypedArray<TypedArray>::createWrapper(PassRefPtr<TypedA rray> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
143 { 143 {
144 ASSERT(impl.get()); 144 ASSERT(impl.get());
145 ASSERT(!DOMDataStore::containsWrapper<Binding>(impl.get(), isolate)); 145 ASSERT(!DOMDataStore::containsWrapper<Binding>(impl.get(), isolate));
146 146
147 RefPtr<ArrayBuffer> buffer = impl->buffer(); 147 RefPtr<ArrayBuffer> buffer = impl->buffer();
(...skipping 21 matching lines...) Expand all
169 ASSERT(typedArray.get()); 169 ASSERT(typedArray.get());
170 V8DOMWrapper::associateObjectWithWrapper<Binding>(typedArray.release(), &wra pperTypeInfo, object, v8::Isolate::GetCurrent(), WrapperConfiguration::Independe nt); 170 V8DOMWrapper::associateObjectWithWrapper<Binding>(typedArray.release(), &wra pperTypeInfo, object, v8::Isolate::GetCurrent(), WrapperConfiguration::Independe nt);
171 171
172 typedarrayPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObjec tIndex); 172 typedarrayPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObjec tIndex);
173 ASSERT(typedarrayPtr); 173 ASSERT(typedarrayPtr);
174 return reinterpret_cast<TypedArray*>(typedarrayPtr); 174 return reinterpret_cast<TypedArray*>(typedarrayPtr);
175 } 175 }
176 176
177 177
178 template <typename TypedArray> 178 template <typename TypedArray>
179 WrapperTypeInfo V8TypedArray<TypedArray>::wrapperTypeInfo = { 179 const WrapperTypeInfo V8TypedArray<TypedArray>::wrapperTypeInfo = {
180 0, V8TypedArray<TypedArray>::derefObject, 180 0, V8TypedArray<TypedArray>::derefObject,
181 0, 0, 0, 0, 0, WrapperTypeObjectPrototype 181 0, 0, 0, 0, 0, WrapperTypeObjectPrototype
182 }; 182 };
183 183
184 template <typename TypedArray> 184 template <typename TypedArray>
185 void V8TypedArray<TypedArray>::derefObject(void* object) 185 void V8TypedArray<TypedArray>::derefObject(void* object)
186 { 186 {
187 static_cast<TypedArray*>(object)->deref(); 187 static_cast<TypedArray*>(object)->deref();
188 } 188 }
189 189
190 190
191 } // namespace WebCode 191 } // namespace WebCode
192 192
193 #endif // V8TypedArrayCustom_h 193 #endif // V8TypedArrayCustom_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698