Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: Source/bindings/tests/results/V8TestConditionalInterface.cpp

Issue 101403002: IDL compiler: Consolidate test IDL files (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: More Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY!
32
33 #include "config.h"
34 #if ENABLE(CONDITION)
35 #include "V8TestConditionalInterface.h"
36
37 #include "RuntimeEnabledFeatures.h"
38 #include "bindings/v8/ScriptController.h"
39 #include "bindings/v8/V8Binding.h"
40 #include "bindings/v8/V8DOMConfiguration.h"
41 #include "bindings/v8/V8DOMWrapper.h"
42 #include "core/dom/ContextFeatures.h"
43 #include "core/dom/Document.h"
44 #include "platform/TraceEvent.h"
45 #include "wtf/UnusedParam.h"
46
47 namespace WebCore {
48
49 static void initializeScriptWrappableForInterface(TestConditionalInterface* obje ct)
50 {
51 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
52 ScriptWrappable::setTypeInfoInObject(object, &V8TestConditionalInterface ::wrapperTypeInfo);
53 else
54 ASSERT_NOT_REACHED();
55 }
56
57 } // namespace WebCore
58
59 // In ScriptWrappable::init, the use of a local function declaration has an issu e on Windows:
60 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function
61 // in the global namespace.
62 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe edback/details/664619/the-namespace-of-local-function-declarations-in-c)
63 void webCoreInitializeScriptWrappableForInterface(WebCore::TestConditionalInterf ace* object)
64 {
65 WebCore::initializeScriptWrappableForInterface(object);
66 }
67
68 namespace WebCore {
69 const WrapperTypeInfo V8TestConditionalInterface::wrapperTypeInfo = { gin::kEmbe dderBlink, V8TestConditionalInterface::GetTemplate, V8TestConditionalInterface:: derefObject, 0, 0, 0, V8TestConditionalInterface::installPerContextEnabledMethod s, 0, WrapperTypeObjectPrototype };
70
71 namespace TestConditionalInterfaceV8Internal {
72
73 template <typename T> void V8_USE(T) { }
74
75 } // namespace TestConditionalInterfaceV8Internal
76
77 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestConditionalInterfaceTempl ate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wra pperWorldType currentWorldType)
78 {
79 functionTemplate->ReadOnlyPrototype();
80
81 v8::Local<v8::Signature> defaultSignature;
82 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestConditionalInterface", v8::Local<v8::FunctionTemplate>(), V8TestCondit ionalInterface::internalFieldCount,
83 0, 0,
84 0, 0,
85 0, 0,
86 isolate, currentWorldType);
87 UNUSED_PARAM(defaultSignature);
88 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT emplate();
89 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp eTemplate();
90 UNUSED_PARAM(instanceTemplate);
91 UNUSED_PARAM(prototypeTemplate);
92
93 // Custom toString template
94 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
95 return functionTemplate;
96 }
97
98 v8::Handle<v8::FunctionTemplate> V8TestConditionalInterface::GetTemplate(v8::Iso late* isolate, WrapperWorldType currentWorldType)
99 {
100 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
101 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
102 if (result != data->templateMap(currentWorldType).end())
103 return result->value.newLocal(isolate);
104
105 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
106 v8::EscapableHandleScope handleScope(isolate);
107 v8::Local<v8::FunctionTemplate> templ =
108 ConfigureV8TestConditionalInterfaceTemplate(data->rawTemplate(&wrapperTy peInfo, currentWorldType), isolate, currentWorldType);
109 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
110 return handleScope.Escape(templ);
111 }
112
113 bool V8TestConditionalInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8:: Isolate* isolate, WrapperWorldType currentWorldType)
114 {
115 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
116 }
117
118 bool V8TestConditionalInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsV alue, v8::Isolate* isolate)
119 {
120 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld)
121 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, IsolatedWorld)
122 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, WorkerWorld);
123 }
124
125 v8::Handle<v8::Object> V8TestConditionalInterface::createWrapper(PassRefPtr<Test ConditionalInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
126 {
127 ASSERT(impl);
128 ASSERT(!DOMDataStore::containsWrapper<V8TestConditionalInterface>(impl.get() , isolate));
129 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
130 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
131 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
132 // the same object de-ref functions, though, so use that as the basis of the check.
133 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
134 }
135
136 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
137 if (UNLIKELY(wrapper.IsEmpty()))
138 return wrapper;
139
140 installPerContextEnabledProperties(wrapper, impl.get(), isolate);
141 V8DOMWrapper::associateObjectWithWrapper<V8TestConditionalInterface>(impl, & wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
142 return wrapper;
143 }
144
145 void V8TestConditionalInterface::derefObject(void* object)
146 {
147 fromInternalPointer(object)->deref();
148 }
149
150 template<>
151 v8::Handle<v8::Value> toV8NoInline(TestConditionalInterface* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate)
152 {
153 return toV8(impl, creationContext, isolate);
154 }
155
156 } // namespace WebCore
157 #endif // ENABLE(CONDITION)
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestConditionalInterface.h ('k') | Source/bindings/tests/results/V8TestConstants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698