107a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch// Copyright 2014 The Chromium Authors. All rights reserved.
207a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch// Use of this source code is governed by a BSD-style license that can be
307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch// found in the LICENSE file.
45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
507a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
7a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)#ifndef V8TestInterfaceCheckSecurity_h
8a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)#define V8TestInterfaceCheckSecurity_h
95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
10e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)#include "bindings/core/v8/ScriptWrappable.h"
11197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include "bindings/core/v8/V8Binding.h"
12197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include "bindings/core/v8/V8DOMWrapper.h"
13197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include "bindings/core/v8/WrapperTypeInfo.h"
147242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci#include "bindings/tests/idls/core/TestInterfaceCheckSecurity.h"
1510f88d5669dbd969c059d61ba09fa37dd72ac559Ben Murdoch#include "platform/heap/Handle.h"
165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
17c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink {
185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
19a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)class V8TestInterfaceCheckSecurity {
205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)public:
2109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
22d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Value>, v8::Isolate*);
23d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
247242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    static TestInterfaceCheckSecurity* toImpl(v8::Handle<v8::Object> object)
255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    {
267242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci        return toImpl(blink::toScriptWrappableBase(object));
275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    }
287242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    static TestInterfaceCheckSecurity* toImplWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
29f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    static const WrapperTypeInfo wrapperTypeInfo;
307242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    static void refObject(ScriptWrappableBase* internalPointer);
31e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    static void derefObject(ScriptWrappableBase* internalPointer);
327242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    static WrapperPersistentNode* createPersistentHandle(ScriptWrappableBase* internalPointer);
335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
347242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    static inline ScriptWrappableBase* toScriptWrappableBase(TestInterfaceCheckSecurity* impl)
35e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    {
367242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci        return impl->toScriptWrappableBase();
37e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    }
38e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch
397242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    static inline TestInterfaceCheckSecurity* toImpl(ScriptWrappableBase* internalPointer)
40e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    {
417242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci        return internalPointer->toImpl<TestInterfaceCheckSecurity>();
42e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    }
43e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
44e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
45c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)
465c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)private:
475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)};
485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
497242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucciinline v8::Handle<v8::Object> wrap(TestInterfaceCheckSecurity* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
507242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci{
517242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    return impl->wrap(creationContext, isolate);
527242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci}
535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
54a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)inline v8::Handle<v8::Value> toV8(TestInterfaceCheckSecurity* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){
56926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    if (UNLIKELY(!impl))
57a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)        return v8::Null(isolate);
58a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterfaceCheckSecurity>(impl, isolate);
59926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    if (!wrapper.IsEmpty())
60926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return wrapper;
617242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci
627242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    return impl->wrap(creationContext, isolate);
63926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)}
64926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
65e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)template<typename CallbackInfo>
66a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceCheckSecurity* impl)
67926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles){
68e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    if (UNLIKELY(!impl)) {
69e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)        v8SetReturnValueNull(callbackInfo);
70e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)        return;
71e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    }
72a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceCheckSecurity>(callbackInfo.GetReturnValue(), impl))
73e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)        return;
74f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
75e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    v8SetReturnValue(callbackInfo, wrapper);
76e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)}
77e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)
78e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)template<typename CallbackInfo>
79a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestInterfaceCheckSecurity* impl)
80e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles){
81f5f02c98d2d694be40c6182631462fff13b4a479Ben Murdoch    ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
82e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    if (UNLIKELY(!impl)) {
83e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)        v8SetReturnValueNull(callbackInfo);
84e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)        return;
85e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    }
86a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfaceCheckSecurity>(callbackInfo.GetReturnValue(), impl))
87e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)        return;
88f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
89e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    v8SetReturnValue(callbackInfo, wrapper);
90926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)}
91926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
92e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdochtemplate<class CallbackInfo, class Wrappable>
93a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterfaceCheckSecurity* impl, Wrappable* wrappable)
94926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles){
95e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    if (UNLIKELY(!impl)) {
96e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)        v8SetReturnValueNull(callbackInfo);
97e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)        return;
98e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    }
99a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)    if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterfaceCheckSecurity>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
100e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)        return;
101e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
102e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    v8SetReturnValue(callbackInfo, wrapper);
1035c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}
104926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
10509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)inline v8::Handle<v8::Value> toV8(PassRefPtr<TestInterfaceCheckSecurity> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
106926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles){
107e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    return toV8(impl.get(), creationContext, isolate);
108926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)}
109926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
110e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)template<class CallbackInfo>
11109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestInterfaceCheckSecurity> impl)
112e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles){
113f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    v8SetReturnValue(callbackInfo, impl.get());
114e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)}
115926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
116e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)template<class CallbackInfo>
11709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestInterfaceCheckSecurity> impl)
118926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles){
119f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)    v8SetReturnValueForMainWorld(callbackInfo, impl.get());
120926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)}
121926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
122e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)template<class CallbackInfo, class Wrappable>
12309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestInterfaceCheckSecurity> impl, Wrappable* wrappable)
1245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){
125e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)    v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
1265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}
1275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1287242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci} // namespace blink
129a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)#endif // V8TestInterfaceCheckSecurity_h
130