| 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 "V8DataView.h" | 7 #include "V8DataView.h" |
| 8 | 8 |
| 9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
| 10 #include "bindings/core/v8/V8ArrayBuffer.h" | 10 #include "bindings/core/v8/V8ArrayBuffer.h" |
| 11 #include "bindings/core/v8/V8DOMConfiguration.h" | 11 #include "bindings/core/v8/V8DOMConfiguration.h" |
| 12 #include "bindings/core/v8/V8ObjectConstructor.h" | 12 #include "bindings/core/v8/V8ObjectConstructor.h" |
| 13 #include "bindings/core/v8/V8SharedArrayBuffer.h" | 13 #include "bindings/core/v8/V8SharedArrayBuffer.h" |
| 14 #include "core/dom/Document.h" | 14 #include "core/dom/Document.h" |
| 15 #include "wtf/GetPtr.h" | 15 #include "wtf/GetPtr.h" |
| 16 #include "wtf/RefPtr.h" | 16 #include "wtf/RefPtr.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv
ial | 20 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv
ial |
| 21 // and does not depend on another global objects. | 21 // and does not depend on another global objects. |
| 22 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) | 22 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
| 23 #pragma clang diagnostic push | 23 #pragma clang diagnostic push |
| 24 #pragma clang diagnostic ignored "-Wglobal-constructors" | 24 #pragma clang diagnostic ignored "-Wglobal-constructors" |
| 25 #endif | 25 #endif |
| 26 const WrapperTypeInfo V8DataView::wrapperTypeInfo = { gin::kEmbedderBlink, 0, V8
DataView::refObject, V8DataView::derefObject, V8DataView::trace, 0, 0, V8DataVie
w::preparePrototypeAndInterfaceObject, V8DataView::installConditionallyEnabledPr
operties, "DataView", &V8ArrayBufferView::wrapperTypeInfo, WrapperTypeInfo::Wrap
perTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInhe
ritFromEventTarget, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObj
ect }; | 26 const WrapperTypeInfo V8DataView::wrapperTypeInfo = { gin::kEmbedderBlink, 0, V8
DataView::refObject, V8DataView::derefObject, V8DataView::trace, 0, 0, V8DataVie
w::preparePrototypeAndInterfaceObject, V8DataView::installConditionallyEnabledPr
operties, "DataView", &V8ArrayBufferView::wrapperTypeInfo, WrapperTypeInfo::Wrap
perTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInhe
ritFromEventTarget, WrapperTypeInfo::Independent, WrapperTypeInfo::GarbageCollec
tedObject }; |
| 27 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) | 27 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
| 28 #pragma clang diagnostic pop | 28 #pragma clang diagnostic pop |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestDataView
.h. | 31 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestDataView
.h. |
| 32 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | 32 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in |
| 33 // bindings/core/v8/ScriptWrappable.h. | 33 // bindings/core/v8/ScriptWrappable.h. |
| 34 const WrapperTypeInfo& TestDataView::s_wrapperTypeInfo = V8DataView::wrapperType
Info; | 34 const WrapperTypeInfo& TestDataView::s_wrapperTypeInfo = V8DataView::wrapperType
Info; |
| 35 | 35 |
| 36 bool V8DataView::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) | 36 bool V8DataView::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) |
| 37 { | 37 { |
| 38 return v8Value->IsDataView(); | 38 return v8Value->IsDataView(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 TestDataView* V8DataView::toImpl(v8::Local<v8::Object> object) | 41 TestDataView* V8DataView::toImpl(v8::Local<v8::Object> object) |
| 42 { | 42 { |
| 43 ASSERT(object->IsDataView()); | 43 ASSERT(object->IsDataView()); |
| 44 ScriptWrappable* scriptWrappable = toScriptWrappable(object); | 44 ScriptWrappable* scriptWrappable = toScriptWrappable(object); |
| 45 if (scriptWrappable) | 45 if (scriptWrappable) |
| 46 return scriptWrappable->toImpl<TestDataView>(); | 46 return scriptWrappable->toImpl<TestDataView>(); |
| 47 | 47 |
| 48 v8::Local<v8::DataView> v8View = object.As<v8::DataView>(); | 48 v8::Local<v8::DataView> v8View = object.As<v8::DataView>(); |
| 49 v8::Local<v8::Object> arrayBuffer = v8View->Buffer(); | 49 v8::Local<v8::Object> arrayBuffer = v8View->Buffer(); |
| 50 RefPtr<TestDataView> typedArray; | 50 TestDataView* typedArray = nullptr; |
| 51 if (arrayBuffer->IsArrayBuffer()) { | 51 if (arrayBuffer->IsArrayBuffer()) { |
| 52 typedArray = TestDataView::create(V8ArrayBuffer::toImpl(arrayBuffer), v8
View->ByteOffset(), v8View->ByteLength()); | 52 typedArray = TestDataView::create(V8ArrayBuffer::toImpl(arrayBuffer), v8
View->ByteOffset(), v8View->ByteLength()); |
| 53 } else if (arrayBuffer->IsSharedArrayBuffer()) { | 53 } else if (arrayBuffer->IsSharedArrayBuffer()) { |
| 54 typedArray = TestDataView::create(V8SharedArrayBuffer::toImpl(arrayBuffe
r), v8View->ByteOffset(), v8View->ByteLength()); | 54 typedArray = TestDataView::create(V8SharedArrayBuffer::toImpl(arrayBuffe
r), v8View->ByteOffset(), v8View->ByteLength()); |
| 55 } else { | 55 } else { |
| 56 ASSERT_NOT_REACHED(); | 56 ASSERT_NOT_REACHED(); |
| 57 } | 57 } |
| 58 v8::Local<v8::Object> associatedWrapper = typedArray->associateWithWrapper(v
8::Isolate::GetCurrent(), typedArray->wrapperTypeInfo(), object); | 58 v8::Local<v8::Object> associatedWrapper = typedArray->associateWithWrapper(v
8::Isolate::GetCurrent(), typedArray->wrapperTypeInfo(), object); |
| 59 ASSERT_UNUSED(associatedWrapper, associatedWrapper == object); | 59 ASSERT_UNUSED(associatedWrapper, associatedWrapper == object); |
| 60 | 60 |
| 61 return typedArray->toImpl<TestDataView>(); | 61 return typedArray->toImpl<TestDataView>(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 TestDataView* V8DataView::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8
::Value> value) | 64 TestDataView* V8DataView::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8
::Value> value) |
| 65 { | 65 { |
| 66 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : 0; | 66 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : 0; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void V8DataView::refObject(ScriptWrappable* scriptWrappable) | 69 void V8DataView::refObject(ScriptWrappable* scriptWrappable) |
| 70 { | 70 { |
| 71 scriptWrappable->toImpl<TestDataView>()->ref(); | |
| 72 } | 71 } |
| 73 | 72 |
| 74 void V8DataView::derefObject(ScriptWrappable* scriptWrappable) | 73 void V8DataView::derefObject(ScriptWrappable* scriptWrappable) |
| 75 { | 74 { |
| 76 scriptWrappable->toImpl<TestDataView>()->deref(); | |
| 77 } | 75 } |
| 78 | 76 |
| 79 } // namespace blink | 77 } // namespace blink |
| OLD | NEW |