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" |
11 #include "bindings/core/v8/V8ArrayBuffer.h" | 11 #include "bindings/core/v8/V8ArrayBuffer.h" |
12 #include "bindings/core/v8/V8DOMConfiguration.h" | 12 #include "bindings/core/v8/V8DOMConfiguration.h" |
13 #include "bindings/core/v8/V8ObjectConstructor.h" | 13 #include "bindings/core/v8/V8ObjectConstructor.h" |
14 #include "core/dom/ContextFeatures.h" | 14 #include "core/dom/ContextFeatures.h" |
15 #include "core/dom/DOMArrayBufferDeallocationObserver.h" | |
16 #include "core/dom/Document.h" | 15 #include "core/dom/Document.h" |
17 #include "platform/RuntimeEnabledFeatures.h" | 16 #include "platform/RuntimeEnabledFeatures.h" |
18 #include "platform/TraceEvent.h" | 17 #include "platform/TraceEvent.h" |
19 #include "wtf/GetPtr.h" | 18 #include "wtf/GetPtr.h" |
20 #include "wtf/RefPtr.h" | 19 #include "wtf/RefPtr.h" |
21 | 20 |
22 namespace blink { | 21 namespace blink { |
23 | 22 |
24 const WrapperTypeInfo V8ArrayBuffer::wrapperTypeInfo = { gin::kEmbedderBlink, 0,
V8ArrayBuffer::refObject, V8ArrayBuffer::derefObject, V8ArrayBuffer::trace, 0,
0, V8ArrayBuffer::preparePrototypeObject, V8ArrayBuffer::installConditionallyEna
bledProperties, "ArrayBuffer", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, W
rapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromEventTarget, Wrapp
erTypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; | 23 const WrapperTypeInfo V8ArrayBuffer::wrapperTypeInfo = { gin::kEmbedderBlink, 0,
V8ArrayBuffer::refObject, V8ArrayBuffer::derefObject, V8ArrayBuffer::trace, 0,
0, V8ArrayBuffer::preparePrototypeObject, V8ArrayBuffer::installConditionallyEna
bledProperties, "ArrayBuffer", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, W
rapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromEventTarget, Wrapp
erTypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; |
25 | 24 |
(...skipping 14 matching lines...) Expand all Loading... |
40 if (v8buffer->IsExternal()) { | 39 if (v8buffer->IsExternal()) { |
41 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); | 40 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); |
42 RELEASE_ASSERT(wrapperTypeInfo); | 41 RELEASE_ASSERT(wrapperTypeInfo); |
43 RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink); | 42 RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink); |
44 return toScriptWrappable(object)->toImpl<TestArrayBuffer>(); | 43 return toScriptWrappable(object)->toImpl<TestArrayBuffer>(); |
45 } | 44 } |
46 | 45 |
47 // Transfer the ownership of the allocated memory to an ArrayBuffer without | 46 // Transfer the ownership of the allocated memory to an ArrayBuffer without |
48 // copying. | 47 // copying. |
49 v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize(); | 48 v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize(); |
50 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength()
, 0); | 49 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength()
); |
51 RefPtr<TestArrayBuffer> buffer = TestArrayBuffer::create(contents); | 50 RefPtr<TestArrayBuffer> buffer = TestArrayBuffer::create(contents); |
52 // Since this transfer doesn't allocate new memory, do not call | |
53 // DOMArrayBufferDeallocationObserver::blinkAllocatedMemory. | |
54 buffer->buffer()->setDeallocationObserverWithoutAllocationNotification( | |
55 DOMArrayBufferDeallocationObserver::instance()); | |
56 buffer->associateWithWrapper(v8::Isolate::GetCurrent(), buffer->wrapperTypeI
nfo(), object); | 51 buffer->associateWithWrapper(v8::Isolate::GetCurrent(), buffer->wrapperTypeI
nfo(), object); |
57 | 52 |
58 return buffer.get(); | 53 return buffer.get(); |
59 } | 54 } |
60 | 55 |
61 TestArrayBuffer* V8ArrayBuffer::toImplWithTypeCheck(v8::Isolate* isolate, v8::Lo
cal<v8::Value> value) | 56 TestArrayBuffer* V8ArrayBuffer::toImplWithTypeCheck(v8::Isolate* isolate, v8::Lo
cal<v8::Value> value) |
62 { | 57 { |
63 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : 0; | 58 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : 0; |
64 } | 59 } |
65 | 60 |
66 void V8ArrayBuffer::refObject(ScriptWrappable* scriptWrappable) | 61 void V8ArrayBuffer::refObject(ScriptWrappable* scriptWrappable) |
67 { | 62 { |
68 scriptWrappable->toImpl<TestArrayBuffer>()->ref(); | 63 scriptWrappable->toImpl<TestArrayBuffer>()->ref(); |
69 } | 64 } |
70 | 65 |
71 void V8ArrayBuffer::derefObject(ScriptWrappable* scriptWrappable) | 66 void V8ArrayBuffer::derefObject(ScriptWrappable* scriptWrappable) |
72 { | 67 { |
73 scriptWrappable->toImpl<TestArrayBuffer>()->deref(); | 68 scriptWrappable->toImpl<TestArrayBuffer>()->deref(); |
74 } | 69 } |
75 | 70 |
76 } // namespace blink | 71 } // namespace blink |
OLD | NEW |