| // Copyright 2014 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
| |
| #include "config.h" |
| #include "V8Uint8ClampedArray.h" |
| |
| #include "bindings/core/v8/ExceptionState.h" |
| #include "bindings/core/v8/V8ArrayBuffer.h" |
| #include "bindings/core/v8/V8DOMConfiguration.h" |
| #include "bindings/core/v8/V8ObjectConstructor.h" |
| #include "bindings/core/v8/V8SharedArrayBuffer.h" |
| #include "core/dom/ContextFeatures.h" |
| #include "core/dom/Document.h" |
| #include "platform/RuntimeEnabledFeatures.h" |
| #include "platform/TraceEvent.h" |
| #include "wtf/GetPtr.h" |
| #include "wtf/RefPtr.h" |
| |
| namespace blink { |
| |
| // Suppress warning: global constructors, because struct WrapperTypeInfo is trivial |
| // and does not depend on another global objects. |
| #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wglobal-constructors" |
| #endif |
| const WrapperTypeInfo V8Uint8ClampedArray::wrapperTypeInfo = { gin::kEmbedderBlink, 0, V8Uint8ClampedArray::refObject, V8Uint8ClampedArray::derefObject, V8Uint8ClampedArray::trace, 0, 0, V8Uint8ClampedArray::preparePrototypeAndInterfaceObject, V8Uint8ClampedArray::installConditionallyEnabledProperties, "Uint8ClampedArray", &V8ArrayBufferView::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromEventTarget, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; |
| #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
| #pragma clang diagnostic pop |
| #endif |
| |
| // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestUint8ClampedArray.h. |
| // For details, see the comment of DEFINE_WRAPPERTYPEINFO in |
| // bindings/core/v8/ScriptWrappable.h. |
| |
| bool V8Uint8ClampedArray::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) |
| { |
| return v8Value->IsUint8ClampedArray(); |
| } |
| |
| TestUint8ClampedArray* V8Uint8ClampedArray::toImpl(v8::Local<v8::Object> object) |
| { |
| ASSERT(object->IsUint8ClampedArray()); |
| ScriptWrappable* scriptWrappable = toScriptWrappable(object); |
| if (scriptWrappable) |
| return scriptWrappable->toImpl<TestUint8ClampedArray>(); |
| |
| v8::Local<v8::Uint8ClampedArray> v8View = object.As<v8::Uint8ClampedArray>(); |
| v8::Local<v8::Object> arrayBuffer = v8View->Buffer(); |
| RefPtr<TestUint8ClampedArray> typedArray; |
| if (arrayBuffer->IsArrayBuffer()) { |
| typedArray = TestUint8ClampedArray::create(V8ArrayBuffer::toImpl(arrayBuffer), v8View->ByteOffset(), v8View->Length()); |
| } else if (arrayBuffer->IsSharedArrayBuffer()) { |
| typedArray = TestUint8ClampedArray::create(V8SharedArrayBuffer::toImpl(arrayBuffer), v8View->ByteOffset(), v8View->Length()); |
| } else { |
| ASSERT_NOT_REACHED(); |
| } |
| v8::Local<v8::Object> associatedWrapper = typedArray->associateWithWrapper(v8::Isolate::GetCurrent(), typedArray->wrapperTypeInfo(), object); |
| ASSERT_UNUSED(associatedWrapper, associatedWrapper == object); |
| |
| return typedArray->toImpl<TestUint8ClampedArray>(); |
| } |
| |
| TestUint8ClampedArray* V8Uint8ClampedArray::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value) |
| { |
| return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : 0; |
| } |
| |
| void V8Uint8ClampedArray::refObject(ScriptWrappable* scriptWrappable) |
| { |
| scriptWrappable->toImpl<TestUint8ClampedArray>()->ref(); |
| } |
| |
| void V8Uint8ClampedArray::derefObject(ScriptWrappable* scriptWrappable) |
| { |
| scriptWrappable->toImpl<TestUint8ClampedArray>()->deref(); |
| } |
| |
| } // namespace blink |