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 "V8PluginPlaceholderElement.h"
  
  #include "bindings/core/v8/ExceptionState.h"
  #include "bindings/core/v8/PrivateScriptRunner.h"
  #include "bindings/core/v8/V8DOMConfiguration.h"
  #include "bindings/core/v8/V8ObjectConstructor.h"
  #include "core/dom/ContextFeatures.h"
  #include "core/dom/Document.h"
  #include "core/frame/LocalFrame.h"
  #include "platform/RuntimeEnabledFeatures.h"
  #include "platform/ScriptForbiddenScope.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 V8PluginPlaceholderElement::wrapperTypeInfo = { gin::kEmbedderBlink, V8PluginPlaceholderElement::domTemplate, V8PluginPlaceholderElement::refObject, V8PluginPlaceholderElement::derefObject, V8PluginPlaceholderElement::trace, 0, 0, V8PluginPlaceholderElement::preparePrototypeObject, V8PluginPlaceholderElement::installConditionallyEnabledProperties, "PluginPlaceholderElement", &V8HTMLDivElement::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::NodeClassId, WrapperTypeInfo::InheritFromEventTarget, WrapperTypeInfo::Dependent, WrapperTypeInfo::WillBeGarbageCollectedObject };
  #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
  #pragma clang diagnostic pop
  #endif
  
  // This static member must be declared by DEFINE_WRAPPERTYPEINFO in PluginPlaceholderElement.h.
  // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
  // bindings/core/v8/ScriptWrappable.h.
  const WrapperTypeInfo& PluginPlaceholderElement::s_wrapperTypeInfo = V8PluginPlaceholderElement::wrapperTypeInfo;
  
  namespace PluginPlaceholderElementV8Internal {
  
  } // namespace PluginPlaceholderElementV8Internal
  
  static void installV8PluginPlaceholderElementTemplate(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
  {
      functionTemplate->ReadOnlyPrototype();
  
      v8::Local<v8::Signature> defaultSignature;
      defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "PluginPlaceholderElement", V8HTMLDivElement::domTemplate(isolate), V8PluginPlaceholderElement::internalFieldCount,
          0, 0,
          0, 0,
          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> V8PluginPlaceholderElement::domTemplate(v8::Isolate* isolate)
  {
      return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8PluginPlaceholderElementTemplate);
  }
  
  bool V8PluginPlaceholderElement::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
  {
      return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
  }
  
  v8::Local<v8::Object> V8PluginPlaceholderElement::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
  {
      return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
  }
  
  PluginPlaceholderElement* V8PluginPlaceholderElement::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value)
  {
      return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : 0;
  }
  
  void V8PluginPlaceholderElement::refObject(ScriptWrappable* scriptWrappable)
  {
  #if !ENABLE(OILPAN)
      scriptWrappable->toImpl<PluginPlaceholderElement>()->ref();
  #endif
  }
  
  void V8PluginPlaceholderElement::derefObject(ScriptWrappable* scriptWrappable)
  {
  #if !ENABLE(OILPAN)
      scriptWrappable->toImpl<PluginPlaceholderElement>()->deref();
  #endif
  }
  
  bool V8PluginPlaceholderElement::PrivateScript::createdCallbackMethod(LocalFrame* frame, PluginPlaceholderElement* holderImpl)
  {
      if (!frame)
          return false;
      v8::HandleScope handleScope(toIsolate(frame));
      ScriptForbiddenScope::AllowUserAgentScript script;
      ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::privateScriptIsolatedWorld());
      if (!scriptState->contextIsValid())
          return false;
      ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
      if (!scriptState->contextIsValid())
          return false;
  
      ScriptState::Scope scope(scriptState);
      v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Global(), scriptState->isolate());
      if (holder.IsEmpty())
          return false;
  
      v8::Local<v8::Value> *argv = 0;
      ExceptionState exceptionState(ExceptionState::ExecutionContext, "createdCallback", "PluginPlaceholderElement", scriptState->context()->Global(), scriptState->isolate());
      v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState, scriptStateInUserScript, "PluginPlaceholderElement", "createdCallback", holder, 0, argv);
      if (v8Value.IsEmpty())
          return false;
      RELEASE_ASSERT(!exceptionState.hadException());
      return true;
  }
  
  bool V8PluginPlaceholderElement::PrivateScript::messageAttributeGetter(LocalFrame* frame, PluginPlaceholderElement* holderImpl, String* result)
  {
      if (!frame)
          return false;
      v8::HandleScope handleScope(toIsolate(frame));
      ScriptForbiddenScope::AllowUserAgentScript script;
      ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::privateScriptIsolatedWorld());
      if (!scriptState->contextIsValid())
          return false;
      ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
      if (!scriptState->contextIsValid())
          return false;
  
      ScriptState::Scope scope(scriptState);
      v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Global(), scriptState->isolate());
      if (holder.IsEmpty())
          return false;
  
      ExceptionState exceptionState(ExceptionState::GetterContext, "message", "PluginPlaceholderElement", scriptState->context()->Global(), scriptState->isolate());
      v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(scriptState, scriptStateInUserScript, "PluginPlaceholderElement", "message", holder);
      if (v8Value.IsEmpty())
          return false;
      V8StringResource<> cppValue = v8Value;
      if (!cppValue.prepare())
          return false;
      RELEASE_ASSERT(!exceptionState.hadException());
      *result = cppValue;
      return true;
  }
  
  bool V8PluginPlaceholderElement::PrivateScript::messageAttributeSetter(LocalFrame* frame, PluginPlaceholderElement* holderImpl, String cppValue)
  {
      if (!frame)
          return false;
      v8::HandleScope handleScope(toIsolate(frame));
      ScriptForbiddenScope::AllowUserAgentScript script;
      ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::privateScriptIsolatedWorld());
      if (!scriptState->contextIsValid())
          return false;
      ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
      if (!scriptState->contextIsValid())
          return false;
  
      ScriptState::Scope scope(scriptState);
      v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Global(), scriptState->isolate());
      if (holder.IsEmpty())
          return false;
  
      ExceptionState exceptionState(ExceptionState::SetterContext, "message", "PluginPlaceholderElement", scriptState->context()->Global(), scriptState->isolate());
      return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateInUserScript, "PluginPlaceholderElement", "message", holder, v8String(scriptState->isolate(), cppValue));
  }
  
  bool V8PluginPlaceholderElement::PrivateScript::closeableAttributeGetter(LocalFrame* frame, PluginPlaceholderElement* holderImpl, bool* result)
  {
      if (!frame)
          return false;
      v8::HandleScope handleScope(toIsolate(frame));
      ScriptForbiddenScope::AllowUserAgentScript script;
      ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::privateScriptIsolatedWorld());
      if (!scriptState->contextIsValid())
          return false;
      ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
      if (!scriptState->contextIsValid())
          return false;
  
      ScriptState::Scope scope(scriptState);
      v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Global(), scriptState->isolate());
      if (holder.IsEmpty())
          return false;
  
      ExceptionState exceptionState(ExceptionState::GetterContext, "closeable", "PluginPlaceholderElement", scriptState->context()->Global(), scriptState->isolate());
      v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(scriptState, scriptStateInUserScript, "PluginPlaceholderElement", "closeable", holder);
      if (v8Value.IsEmpty())
          return false;
      bool cppValue = toBoolean(scriptState->isolate(), v8Value, exceptionState);
      if (exceptionState.throwIfNeeded())
          return false;
      RELEASE_ASSERT(!exceptionState.hadException());
      *result = cppValue;
      return true;
  }
  
  bool V8PluginPlaceholderElement::PrivateScript::closeableAttributeSetter(LocalFrame* frame, PluginPlaceholderElement* holderImpl, bool cppValue)
  {
      if (!frame)
          return false;
      v8::HandleScope handleScope(toIsolate(frame));
      ScriptForbiddenScope::AllowUserAgentScript script;
      ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::privateScriptIsolatedWorld());
      if (!scriptState->contextIsValid())
          return false;
      ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
      if (!scriptState->contextIsValid())
          return false;
  
      ScriptState::Scope scope(scriptState);
      v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Global(), scriptState->isolate());
      if (holder.IsEmpty())
          return false;
  
      ExceptionState exceptionState(ExceptionState::SetterContext, "closeable", "PluginPlaceholderElement", scriptState->context()->Global(), scriptState->isolate());
      return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateInUserScript, "PluginPlaceholderElement", "closeable", holder, v8Boolean(cppValue, scriptState->isolate()));
  }
  
  } // namespace blink
  