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

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

Issue 221073003: Add helper functions for throwing arity-related TypeErrors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix style nits. Created 6 years, 8 months 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 #include "V8TestInterface2.h" 8 #include "V8TestInterface2.h"
9 9
10 #include "RuntimeEnabledFeatures.h" 10 #include "RuntimeEnabledFeatures.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 const WrapperTypeInfo V8TestInterface2::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface2::domTemplate, V8TestInterface2::derefObject, 0, 0, V8TestInter face2::visitDOMWrapper, V8TestInterface2::installPerContextEnabledMethods, 0, Wr apperTypeObjectPrototype, false }; 45 const WrapperTypeInfo V8TestInterface2::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface2::domTemplate, V8TestInterface2::derefObject, 0, 0, V8TestInter face2::visitDOMWrapper, V8TestInterface2::installPerContextEnabledMethods, 0, Wr apperTypeObjectPrototype, false };
46 46
47 namespace TestInterface2V8Internal { 47 namespace TestInterface2V8Internal {
48 48
49 template <typename T> void V8_USE(T) { } 49 template <typename T> void V8_USE(T) { }
50 50
51 static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 51 static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
52 { 52 {
53 ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "Tes tInterface2", info.Holder(), info.GetIsolate()); 53 ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "Tes tInterface2", info.Holder(), info.GetIsolate());
54 if (UNLIKELY(info.Length() < 1)) { 54 if (UNLIKELY(info.Length() < 1)) {
55 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 55 throwArityTypeError(exceptionState, 1, info.Length());
56 exceptionState.throwIfNeeded();
57 return; 56 return;
58 } 57 }
59 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); 58 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
60 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState); 59 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState);
61 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState); 60 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState);
62 if (exceptionState.throwIfNeeded()) 61 if (exceptionState.throwIfNeeded())
63 return; 62 return;
64 v8SetReturnValue(info, result.release()); 63 v8SetReturnValue(info, result.release());
65 } 64 }
66 65
67 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 66 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
68 { 67 {
69 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 68 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
70 TestInterface2V8Internal::itemMethod(info); 69 TestInterface2V8Internal::itemMethod(info);
71 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 70 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
72 } 71 }
73 72
74 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 73 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
75 { 74 {
76 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", " TestInterface2", info.Holder(), info.GetIsolate()); 75 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", " TestInterface2", info.Holder(), info.GetIsolate());
77 if (UNLIKELY(info.Length() < 2)) { 76 if (UNLIKELY(info.Length() < 2)) {
78 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 77 throwArityTypeError(exceptionState, 2, info.Length());
79 exceptionState.throwIfNeeded();
80 return; 78 return;
81 } 79 }
82 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); 80 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
83 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState); 81 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState);
84 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]); 82 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]);
85 String result = impl->setItem(index, value, exceptionState); 83 String result = impl->setItem(index, value, exceptionState);
86 if (exceptionState.throwIfNeeded()) 84 if (exceptionState.throwIfNeeded())
87 return; 85 return;
88 v8SetReturnValueString(info, result, info.GetIsolate()); 86 v8SetReturnValueString(info, result, info.GetIsolate());
89 } 87 }
90 88
91 static void setItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& inf o) 89 static void setItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& inf o)
92 { 90 {
93 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 91 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
94 TestInterface2V8Internal::setItemMethod(info); 92 TestInterface2V8Internal::setItemMethod(info);
95 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 93 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
96 } 94 }
97 95
98 static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 96 static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
99 { 97 {
100 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem" , "TestInterface2", info.Holder(), info.GetIsolate()); 98 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem" , "TestInterface2", info.Holder(), info.GetIsolate());
101 if (UNLIKELY(info.Length() < 1)) { 99 if (UNLIKELY(info.Length() < 1)) {
102 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 100 throwArityTypeError(exceptionState, 1, info.Length());
103 exceptionState.throwIfNeeded();
104 return; 101 return;
105 } 102 }
106 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); 103 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
107 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState); 104 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState);
108 bool result = impl->deleteItem(index, exceptionState); 105 bool result = impl->deleteItem(index, exceptionState);
109 if (exceptionState.throwIfNeeded()) 106 if (exceptionState.throwIfNeeded())
110 return; 107 return;
111 v8SetReturnValueBool(info, result); 108 v8SetReturnValueBool(info, result);
112 } 109 }
113 110
114 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 111 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
115 { 112 {
116 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 113 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
117 TestInterface2V8Internal::deleteItemMethod(info); 114 TestInterface2V8Internal::deleteItemMethod(info);
118 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 115 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
119 } 116 }
120 117
121 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 118 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
122 { 119 {
123 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem", "TestInterface2", info.Holder(), info.GetIsolate()); 120 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem", "TestInterface2", info.Holder(), info.GetIsolate());
124 if (UNLIKELY(info.Length() < 1)) { 121 if (UNLIKELY(info.Length() < 1)) {
125 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 122 throwArityTypeError(exceptionState, 1, info.Length());
126 exceptionState.throwIfNeeded();
127 return; 123 return;
128 } 124 }
129 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); 125 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
130 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); 126 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]);
131 RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState); 127 RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState);
132 if (exceptionState.throwIfNeeded()) 128 if (exceptionState.throwIfNeeded())
133 return; 129 return;
134 v8SetReturnValue(info, result.release()); 130 v8SetReturnValue(info, result.release());
135 } 131 }
136 132
137 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 133 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
138 { 134 {
139 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 135 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
140 TestInterface2V8Internal::namedItemMethod(info); 136 TestInterface2V8Internal::namedItemMethod(info);
141 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 137 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
142 } 138 }
143 139
144 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 140 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
145 { 141 {
146 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte m", "TestInterface2", info.Holder(), info.GetIsolate()); 142 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte m", "TestInterface2", info.Holder(), info.GetIsolate());
147 if (UNLIKELY(info.Length() < 2)) { 143 if (UNLIKELY(info.Length() < 2)) {
148 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 144 throwArityTypeError(exceptionState, 2, info.Length());
149 exceptionState.throwIfNeeded();
150 return; 145 return;
151 } 146 }
152 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); 147 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
153 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); 148 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]);
154 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]); 149 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]);
155 String result = impl->setNamedItem(name, value, exceptionState); 150 String result = impl->setNamedItem(name, value, exceptionState);
156 if (exceptionState.throwIfNeeded()) 151 if (exceptionState.throwIfNeeded())
157 return; 152 return;
158 v8SetReturnValueString(info, result, info.GetIsolate()); 153 v8SetReturnValueString(info, result, info.GetIsolate());
159 } 154 }
160 155
161 static void setNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value> & info) 156 static void setNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value> & info)
162 { 157 {
163 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 158 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
164 TestInterface2V8Internal::setNamedItemMethod(info); 159 TestInterface2V8Internal::setNamedItemMethod(info);
165 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 160 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
166 } 161 }
167 162
168 static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& inf o) 163 static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& inf o)
169 { 164 {
170 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed Item", "TestInterface2", info.Holder(), info.GetIsolate()); 165 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed Item", "TestInterface2", info.Holder(), info.GetIsolate());
171 if (UNLIKELY(info.Length() < 1)) { 166 if (UNLIKELY(info.Length() < 1)) {
172 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 167 throwArityTypeError(exceptionState, 1, info.Length());
173 exceptionState.throwIfNeeded();
174 return; 168 return;
175 } 169 }
176 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); 170 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
177 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); 171 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]);
178 bool result = impl->deleteNamedItem(name, exceptionState); 172 bool result = impl->deleteNamedItem(name, exceptionState);
179 if (exceptionState.throwIfNeeded()) 173 if (exceptionState.throwIfNeeded())
180 return; 174 return;
181 v8SetReturnValueBool(info, result); 175 v8SetReturnValueBool(info, result);
182 } 176 }
183 177
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 fromInternalPointer(object)->deref(); 489 fromInternalPointer(object)->deref();
496 } 490 }
497 491
498 template<> 492 template<>
499 v8::Handle<v8::Value> toV8NoInline(TestInterface2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 493 v8::Handle<v8::Value> toV8NoInline(TestInterface2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
500 { 494 {
501 return toV8(impl, creationContext, isolate); 495 return toV8(impl, creationContext, isolate);
502 } 496 }
503 497
504 } // namespace WebCore 498 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface.cpp ('k') | Source/bindings/tests/results/V8TestInterfaceConstructor3.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698