text: // 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 "V8VRDevice.h"
  
  #include "bindings/core/v8/ExceptionState.h"
  #include "bindings/core/v8/V8DOMConfiguration.h"
  #include "bindings/core/v8/V8ObjectConstructor.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 V8VRDevice::wrapperTypeInfo = { gin::kEmbedderBlink, V8VRDevice::domTemplate, V8VRDevice::refObject, V8VRDevice::derefObject, V8VRDevice::trace, 0, 0, V8VRDevice::preparePrototypeObject, V8VRDevice::installConditionallyEnabledProperties, "VRDevice", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromEventTarget, WrapperTypeInfo::Independent, WrapperTypeInfo::GarbageCollectedObject };
  #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
  #pragma clang diagnostic pop
  #endif
  
  // This static member must be declared by DEFINE_WRAPPERTYPEINFO in VRDevice.h.
  // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
  // bindings/core/v8/ScriptWrappable.h.
  const WrapperTypeInfo& VRDevice::s_wrapperTypeInfo = V8VRDevice::wrapperTypeInfo;
  
  namespace VRDeviceV8Internal {
  
  static void hardwareUnitIdAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
  {
      v8::Local<v8::Object> holder = info.Holder();
      VRDevice* impl = V8VRDevice::toImpl(holder);
      v8SetReturnValueString(info, impl->hardwareUnitId(), info.GetIsolate());
  }
  
  static void hardwareUnitIdAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  {
      TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
      VRDeviceV8Internal::hardwareUnitIdAttributeGetter(info);
      TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
  }
  
  static void deviceIdAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
  {
      v8::Local<v8::Object> holder = info.Holder();
      VRDevice* impl = V8VRDevice::toImpl(holder);
      v8SetReturnValueString(info, impl->deviceId(), info.GetIsolate());
  }
  
  static void deviceIdAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  {
      TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
      VRDeviceV8Internal::deviceIdAttributeGetter(info);
      TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
  }
  
  static void deviceNameAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
  {
      v8::Local<v8::Object> holder = info.Holder();
      VRDevice* impl = V8VRDevice::toImpl(holder);
      v8SetReturnValueString(info, impl->deviceName(), info.GetIsolate());
  }
  
  static void deviceNameAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
  {
      TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
      VRDeviceV8Internal::deviceNameAttributeGetter(info);
      TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
  }
  
  } // namespace VRDeviceV8Internal
  
  static const V8DOMConfiguration::AccessorConfiguration V8VRDeviceAccessors[] = {
      {"hardwareUnitId", VRDeviceV8Internal::hardwareUnitIdAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
      {"deviceId", VRDeviceV8Internal::deviceIdAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
      {"deviceName", VRDeviceV8Internal::deviceNameAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
  };
  
  static void installV8VRDeviceTemplate(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
  {
      functionTemplate->ReadOnlyPrototype();
  
      v8::Local<v8::Signature> defaultSignature;
      if (!RuntimeEnabledFeatures::webVREnabled())
          defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "VRDevice", v8::Local<v8::FunctionTemplate>(), V8VRDevice::internalFieldCount, 0, 0, 0, 0, 0, 0);
      else
          defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "VRDevice", v8::Local<v8::FunctionTemplate>(), V8VRDevice::internalFieldCount,
              0, 0,
              V8VRDeviceAccessors, WTF_ARRAY_LENGTH(V8VRDeviceAccessors),
              0, 0);
      v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
      ALLOW_UNUSED_LOCAL(instanceTemplate);
      v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
      ALLOW_UNUSED_LOCAL(prototypeTemplate);
  
      // Custom toString template
      functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
  }
  
  v8::Local<v8::FunctionTemplate> V8VRDevice::domTemplate(v8::Isolate* isolate)
  {
      return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8VRDeviceTemplate);
  }
  
  bool V8VRDevice::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
  {
      return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
  }
  
  v8::Local<v8::Object> V8VRDevice::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
  {
      return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
  }
  
  VRDevice* V8VRDevice::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value)
  {
      return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : 0;
  }
  
  void V8VRDevice::refObject(ScriptWrappable* scriptWrappable)
  {
  }
  
  void V8VRDevice::derefObject(ScriptWrappable* scriptWrappable)
  {
  }
  
  } // namespace blink
  