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

Side by Side Diff: Source/bindings/tests/results/core/V8TestInterface.cpp

Issue 594213002: Inline exception handling code into PrivateScriptRunner helpers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
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 #if ENABLE(CONDITION) 8 #if ENABLE(CONDITION)
9 #include "V8TestInterface.h" 9 #include "V8TestInterface.h"
10 10
(...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 2106 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
2107 if (!scriptState->executionContext()) 2107 if (!scriptState->executionContext())
2108 return false; 2108 return false;
2109 2109
2110 ScriptState::Scope scope(scriptState); 2110 ScriptState::Scope scope(scriptState);
2111 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate()); 2111 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate());
2112 2112
2113 v8::Handle<v8::Value> valueHandle = v8::Integer::New(scriptState->isolate(), value); 2113 v8::Handle<v8::Value> valueHandle = v8::Integer::New(scriptState->isolate(), value);
2114 v8::Handle<v8::Value> argv[] = { valueHandle }; 2114 v8::Handle<v8::Value> argv[] = { valueHandle };
2115 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod WithShortArgumentImplementedInPrivateScript", "TestInterfaceImplementation", scr iptState->context()->Global(), scriptState->isolate()); 2115 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod WithShortArgumentImplementedInPrivateScript", "TestInterfaceImplementation", scr iptState->context()->Global(), scriptState->isolate());
2116 v8::TryCatch block; 2116 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat e, scriptStateInUserScript, "TestInterfaceImplementation", "shortMethodWithShort ArgumentImplementedInPrivateScript", holder, 1, argv);
2117 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat e, "TestInterfaceImplementation", "shortMethodWithShortArgumentImplementedInPriv ateScript", holder, 1, argv); 2117 if (v8Value.IsEmpty())
2118 if (block.HasCaught()) {
2119 PrivateScriptRunner::rethrowExceptionInPrivateScript(scriptState->isolat e(), block, scriptStateInUserScript, ExceptionState::ExecutionContext, "shortMet hodWithShortArgumentImplementedInPrivateScript", "TestInterfaceImplementation");
2120 block.ReThrow();
2121 return false; 2118 return false;
2122 }
2123 TONATIVE_DEFAULT_EXCEPTIONSTATE(int, cppValue, toInt16(v8Value, exceptionSta te), exceptionState, false); 2119 TONATIVE_DEFAULT_EXCEPTIONSTATE(int, cppValue, toInt16(v8Value, exceptionSta te), exceptionState, false);
2120 *result = cppValue;
2124 RELEASE_ASSERT(!exceptionState.hadException()); 2121 RELEASE_ASSERT(!exceptionState.hadException());
2125 *result = cppValue;
2126 return true; 2122 return true;
2127 } 2123 }
2128 2124
2129 bool V8TestInterface::PrivateScript::stringAttributeAttributeGetter(LocalFrame* frame, TestInterfaceImplementation* holderImpl, String* result) 2125 bool V8TestInterface::PrivateScript::stringAttributeAttributeGetter(LocalFrame* frame, TestInterfaceImplementation* holderImpl, String* result)
2130 { 2126 {
2131 if (!frame) 2127 if (!frame)
2132 return false; 2128 return false;
2133 v8::HandleScope handleScope(toIsolate(frame)); 2129 v8::HandleScope handleScope(toIsolate(frame));
2134 ScriptForbiddenScope::AllowUserAgentScript script; 2130 ScriptForbiddenScope::AllowUserAgentScript script;
2135 v8::Handle<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrapp erWorld::privateScriptIsolatedWorld()); 2131 v8::Handle<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrapp erWorld::privateScriptIsolatedWorld());
2136 if (contextInPrivateScript.IsEmpty()) 2132 if (contextInPrivateScript.IsEmpty())
2137 return false; 2133 return false;
2138 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 2134 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
2139 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 2135 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
2140 if (!scriptState->executionContext()) 2136 if (!scriptState->executionContext())
2141 return false; 2137 return false;
2142 2138
2143 ScriptState::Scope scope(scriptState); 2139 ScriptState::Scope scope(scriptState);
2144 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate()); 2140 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate());
2145 2141
2146 ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttribut e", "TestInterfaceImplementation", scriptState->context()->Global(), scriptState ->isolate()); 2142 ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttribut e", "TestInterfaceImplementation", scriptState->context()->Global(), scriptState ->isolate());
2147 v8::TryCatch block; 2143 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(s criptState, scriptStateInUserScript, "TestInterfaceImplementation", "stringAttri bute", holder);
2148 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(s criptState, "TestInterfaceImplementation", "stringAttribute", holder); 2144 if (v8Value.IsEmpty())
2149 if (block.HasCaught()) {
2150 PrivateScriptRunner::rethrowExceptionInPrivateScript(scriptState->isolat e(), block, scriptStateInUserScript, ExceptionState::GetterContext, "stringAttri bute", "TestInterfaceImplementation");
2151 block.ReThrow();
2152 return false; 2145 return false;
2153 }
2154 TOSTRING_DEFAULT(V8StringResource<>, cppValue, v8Value, false); 2146 TOSTRING_DEFAULT(V8StringResource<>, cppValue, v8Value, false);
2155 RELEASE_ASSERT(!exceptionState.hadException()); 2147 RELEASE_ASSERT(!exceptionState.hadException());
2156 *result = cppValue; 2148 *result = cppValue;
2157 return true; 2149 return true;
2158 } 2150 }
2159 2151
2160 bool V8TestInterface::PrivateScript::stringAttributeAttributeSetter(LocalFrame* frame, TestInterfaceImplementation* holderImpl, String cppValue) 2152 bool V8TestInterface::PrivateScript::stringAttributeAttributeSetter(LocalFrame* frame, TestInterfaceImplementation* holderImpl, String cppValue)
2161 { 2153 {
2162 if (!frame) 2154 if (!frame)
2163 return false; 2155 return false;
2164 v8::HandleScope handleScope(toIsolate(frame)); 2156 v8::HandleScope handleScope(toIsolate(frame));
2165 ScriptForbiddenScope::AllowUserAgentScript script; 2157 ScriptForbiddenScope::AllowUserAgentScript script;
2166 v8::Handle<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrapp erWorld::privateScriptIsolatedWorld()); 2158 v8::Handle<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrapp erWorld::privateScriptIsolatedWorld());
2167 if (contextInPrivateScript.IsEmpty()) 2159 if (contextInPrivateScript.IsEmpty())
2168 return false; 2160 return false;
2169 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); 2161 ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
2170 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 2162 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
2171 if (!scriptState->executionContext()) 2163 if (!scriptState->executionContext())
2172 return false; 2164 return false;
2173 2165
2174 ScriptState::Scope scope(scriptState); 2166 ScriptState::Scope scope(scriptState);
2175 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate()); 2167 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate());
2176 2168
2177 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttribut e", "TestInterfaceImplementation", scriptState->context()->Global(), scriptState ->isolate()); 2169 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttribut e", "TestInterfaceImplementation", scriptState->context()->Global(), scriptState ->isolate());
2178 v8::TryCatch block; 2170 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestInterfaceImplementation", "stringAttribute", holder, v8String(s criptState->isolate(), cppValue));
2179 PrivateScriptRunner::runDOMAttributeSetter(scriptState, "TestInterfaceImplem entation", "stringAttribute", holder, v8String(scriptState->isolate(), cppValue) );
2180 if (block.HasCaught()) {
2181 PrivateScriptRunner::rethrowExceptionInPrivateScript(scriptState->isolat e(), block, scriptStateInUserScript, ExceptionState::SetterContext, "stringAttri bute", "TestInterfaceImplementation");
2182 block.ReThrow();
2183 return false;
2184 }
2185 return true;
2186 } 2171 }
2187 2172
2188 } // namespace blink 2173 } // namespace blink
2189 #endif // ENABLE(CONDITION) 2174 #endif // ENABLE(CONDITION)
OLDNEW
« no previous file with comments | « Source/bindings/templates/methods.cpp ('k') | Source/bindings/tests/results/core/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698