OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
6 | 6 |
7 #include "config.h" | 7 #include "config.h" |
8 #include "V8ArrayBuffer.h" | 8 #include "V8ArrayBuffer.h" |
9 | 9 |
10 #include "bindings/core/v8/ExceptionState.h" | 10 #include "bindings/core/v8/ExceptionState.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 namespace blink { | 23 namespace blink { |
24 | 24 |
25 const WrapperTypeInfo V8ArrayBuffer::wrapperTypeInfo = { gin::kEmbedderBlink, 0,
V8ArrayBuffer::refObject, V8ArrayBuffer::derefObject, V8ArrayBuffer::trace, 0,
0, V8ArrayBuffer::installConditionallyEnabledMethods, V8ArrayBuffer::installCond
itionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, Wrap
perTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromEventTarget, WrapperT
ypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; | 25 const WrapperTypeInfo V8ArrayBuffer::wrapperTypeInfo = { gin::kEmbedderBlink, 0,
V8ArrayBuffer::refObject, V8ArrayBuffer::derefObject, V8ArrayBuffer::trace, 0,
0, V8ArrayBuffer::installConditionallyEnabledMethods, V8ArrayBuffer::installCond
itionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, Wrap
perTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromEventTarget, WrapperT
ypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; |
26 | 26 |
27 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestArrayBuf
fer.h. | 27 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestArrayBuf
fer.h. |
28 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | 28 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in |
29 // bindings/core/v8/ScriptWrappable.h. | 29 // bindings/core/v8/ScriptWrappable.h. |
30 const WrapperTypeInfo& TestArrayBuffer::s_wrapperTypeInfo = V8ArrayBuffer::wrapp
erTypeInfo; | 30 const WrapperTypeInfo& TestArrayBuffer::s_wrapperTypeInfo = V8ArrayBuffer::wrapp
erTypeInfo; |
31 | 31 |
32 bool V8ArrayBuffer::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isol
ate) | 32 bool V8ArrayBuffer::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isola
te) |
33 { | 33 { |
34 return v8Value->IsArrayBuffer(); | 34 return v8Value->IsArrayBuffer(); |
35 } | 35 } |
36 | 36 |
37 TestArrayBuffer* V8ArrayBuffer::toImpl(v8::Handle<v8::Object> object) | 37 TestArrayBuffer* V8ArrayBuffer::toImpl(v8::Local<v8::Object> object) |
38 { | 38 { |
39 ASSERT(object->IsArrayBuffer()); | 39 ASSERT(object->IsArrayBuffer()); |
40 v8::Local<v8::ArrayBuffer> v8buffer = object.As<v8::ArrayBuffer>(); | 40 v8::Local<v8::ArrayBuffer> v8buffer = object.As<v8::ArrayBuffer>(); |
41 if (v8buffer->IsExternal()) { | 41 if (v8buffer->IsExternal()) { |
42 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); | 42 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); |
43 RELEASE_ASSERT(wrapperTypeInfo); | 43 RELEASE_ASSERT(wrapperTypeInfo); |
44 RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink); | 44 RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink); |
45 return toScriptWrappable(object)->toImpl<TestArrayBuffer>(); | 45 return toScriptWrappable(object)->toImpl<TestArrayBuffer>(); |
46 } | 46 } |
47 | 47 |
48 // Transfer the ownership of the allocated memory to an ArrayBuffer without | 48 // Transfer the ownership of the allocated memory to an ArrayBuffer without |
49 // copying. | 49 // copying. |
50 v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize(); | 50 v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize(); |
51 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength()
, 0); | 51 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength()
, 0); |
52 RefPtr<TestArrayBuffer> buffer = TestArrayBuffer::create(contents); | 52 RefPtr<TestArrayBuffer> buffer = TestArrayBuffer::create(contents); |
53 // Since this transfer doesn't allocate new memory, do not call | 53 // Since this transfer doesn't allocate new memory, do not call |
54 // DOMArrayBufferDeallocationObserver::blinkAllocatedMemory. | 54 // DOMArrayBufferDeallocationObserver::blinkAllocatedMemory. |
55 buffer->buffer()->setDeallocationObserverWithoutAllocationNotification( | 55 buffer->buffer()->setDeallocationObserverWithoutAllocationNotification( |
56 DOMArrayBufferDeallocationObserver::instance()); | 56 DOMArrayBufferDeallocationObserver::instance()); |
57 buffer->associateWithWrapper(v8::Isolate::GetCurrent(), buffer->wrapperTypeI
nfo(), object); | 57 buffer->associateWithWrapper(v8::Isolate::GetCurrent(), buffer->wrapperTypeI
nfo(), object); |
58 | 58 |
59 return buffer.get(); | 59 return buffer.get(); |
60 } | 60 } |
61 | 61 |
62 TestArrayBuffer* V8ArrayBuffer::toImplWithTypeCheck(v8::Isolate* isolate, v8::Ha
ndle<v8::Value> value) | 62 TestArrayBuffer* V8ArrayBuffer::toImplWithTypeCheck(v8::Isolate* isolate, v8::Lo
cal<v8::Value> value) |
63 { | 63 { |
64 return hasInstance(value, isolate) ? toImpl(v8::Handle<v8::Object>::Cast(val
ue)) : 0; | 64 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : 0; |
65 } | 65 } |
66 | 66 |
67 void V8ArrayBuffer::refObject(ScriptWrappable* scriptWrappable) | 67 void V8ArrayBuffer::refObject(ScriptWrappable* scriptWrappable) |
68 { | 68 { |
69 scriptWrappable->toImpl<TestArrayBuffer>()->ref(); | 69 scriptWrappable->toImpl<TestArrayBuffer>()->ref(); |
70 } | 70 } |
71 | 71 |
72 void V8ArrayBuffer::derefObject(ScriptWrappable* scriptWrappable) | 72 void V8ArrayBuffer::derefObject(ScriptWrappable* scriptWrappable) |
73 { | 73 { |
74 scriptWrappable->toImpl<TestArrayBuffer>()->deref(); | 74 scriptWrappable->toImpl<TestArrayBuffer>()->deref(); |
75 } | 75 } |
76 | 76 |
77 } // namespace blink | 77 } // namespace blink |
OLD | NEW |