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

Side by Side Diff: Source/bindings/v8/custom/V8ArrayBufferCustom.cpp

Issue 39393004: IDL compiler: rename WrapperTypeInfo info => wrapperTypeInfo (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 27 matching lines...) Expand all
38 namespace WebCore { 38 namespace WebCore {
39 39
40 using namespace WTF; 40 using namespace WTF;
41 41
42 V8ArrayBufferDeallocationObserver* V8ArrayBufferDeallocationObserver::instance() 42 V8ArrayBufferDeallocationObserver* V8ArrayBufferDeallocationObserver::instance()
43 { 43 {
44 DEFINE_STATIC_LOCAL(V8ArrayBufferDeallocationObserver, deallocationObserver, ()); 44 DEFINE_STATIC_LOCAL(V8ArrayBufferDeallocationObserver, deallocationObserver, ());
45 return &deallocationObserver; 45 return &deallocationObserver;
46 } 46 }
47 47
48 WrapperTypeInfo V8ArrayBuffer::info = { 48 WrapperTypeInfo V8ArrayBuffer::wrapperTypeInfo = {
49 0, V8ArrayBuffer::derefObject, 49 0, V8ArrayBuffer::derefObject,
50 0, 0, 0, 0, 0, WrapperTypeObjectPrototype 50 0, 0, 0, 0, 0, WrapperTypeObjectPrototype
51 }; 51 };
52 52
53 bool V8ArrayBuffer::HasInstance(v8::Handle<v8::Value> value, v8::Isolate*, Wrapp erWorldType) 53 bool V8ArrayBuffer::HasInstance(v8::Handle<v8::Value> value, v8::Isolate*, Wrapp erWorldType)
54 { 54 {
55 return value->IsArrayBuffer(); 55 return value->IsArrayBuffer();
56 } 56 }
57 57
58 bool V8ArrayBuffer::HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Isola te*) 58 bool V8ArrayBuffer::HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Isola te*)
59 { 59 {
60 return value->IsArrayBuffer(); 60 return value->IsArrayBuffer();
61 } 61 }
62 62
63 void V8ArrayBuffer::derefObject(void* object) 63 void V8ArrayBuffer::derefObject(void* object)
64 { 64 {
65 static_cast<ArrayBuffer*>(object)->deref(); 65 static_cast<ArrayBuffer*>(object)->deref();
66 } 66 }
67 67
68 v8::Handle<v8::Object> V8ArrayBuffer::createWrapper(PassRefPtr<ArrayBuffer> impl , v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 68 v8::Handle<v8::Object> V8ArrayBuffer::createWrapper(PassRefPtr<ArrayBuffer> impl , v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
69 { 69 {
70 ASSERT(impl.get()); 70 ASSERT(impl.get());
71 ASSERT(!DOMDataStore::containsWrapper<V8ArrayBuffer>(impl.get(), isolate)); 71 ASSERT(!DOMDataStore::containsWrapper<V8ArrayBuffer>(impl.get(), isolate));
72 72
73 v8::Handle<v8::Object> wrapper = v8::ArrayBuffer::New(impl->data(), impl->by teLength()); 73 v8::Handle<v8::Object> wrapper = v8::ArrayBuffer::New(impl->data(), impl->by teLength());
74 impl->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instance()) ; 74 impl->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instance()) ;
75 75
76 V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(impl, &info, wrapper , isolate, WrapperConfiguration::Independent); 76 V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(impl, &wrapperTypeIn fo, wrapper, isolate, WrapperConfiguration::Independent);
77 return wrapper; 77 return wrapper;
78 } 78 }
79 79
80 ArrayBuffer* V8ArrayBuffer::toNative(v8::Handle<v8::Object> object) 80 ArrayBuffer* V8ArrayBuffer::toNative(v8::Handle<v8::Object> object)
81 { 81 {
82 ASSERT(object->IsArrayBuffer()); 82 ASSERT(object->IsArrayBuffer());
83 void* arraybufferPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapp erObjectIndex); 83 void* arraybufferPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapp erObjectIndex);
84 if (arraybufferPtr) 84 if (arraybufferPtr)
85 return reinterpret_cast<ArrayBuffer*>(arraybufferPtr); 85 return reinterpret_cast<ArrayBuffer*>(arraybufferPtr);
86 86
87 v8::Local<v8::ArrayBuffer> v8buffer = object.As<v8::ArrayBuffer>(); 87 v8::Local<v8::ArrayBuffer> v8buffer = object.As<v8::ArrayBuffer>();
88 ASSERT(!v8buffer->IsExternal()); 88 ASSERT(!v8buffer->IsExternal());
89 89
90 v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize(); 90 v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize();
91 ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength(), 91 ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength(),
92 V8ArrayBufferDeallocationObserver::instance()); 92 V8ArrayBufferDeallocationObserver::instance());
93 RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(contents); 93 RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(contents);
94 V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(buffer.release(), &i nfo, object, v8::Isolate::GetCurrent(), WrapperConfiguration::Dependent); 94 V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(buffer.release(), &w rapperTypeInfo, object, v8::Isolate::GetCurrent(), WrapperConfiguration::Depende nt);
95 95
96 arraybufferPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObje ctIndex); 96 arraybufferPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObje ctIndex);
97 ASSERT(arraybufferPtr); 97 ASSERT(arraybufferPtr);
98 return reinterpret_cast<ArrayBuffer*>(arraybufferPtr); 98 return reinterpret_cast<ArrayBuffer*>(arraybufferPtr);
99 } 99 }
100 100
101 } // namespace WebCore 101 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8ArrayBufferCustom.h ('k') | Source/bindings/v8/custom/V8DataViewCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698