| OLD | NEW |
| 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 "V8TestSpecialOperations.h" | 8 #include "V8TestSpecialOperations.h" |
| 9 | 9 |
| 10 #include "bindings/core/v8/ExceptionState.h" | 10 #include "bindings/core/v8/ExceptionState.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | 57 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) |
| 58 { | 58 { |
| 59 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 59 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 60 TestSpecialOperationsV8Internal::namedItemMethod(info); | 60 TestSpecialOperationsV8Internal::namedItemMethod(info); |
| 61 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 61 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 62 } | 62 } |
| 63 | 63 |
| 64 static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall
backInfo<v8::Value>& info) | 64 static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall
backInfo<v8::Value>& info) |
| 65 { | 65 { |
| 66 if (!name->IsString()) | |
| 67 return; | |
| 68 auto nameString = name.As<v8::String>(); | 66 auto nameString = name.As<v8::String>(); |
| 69 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder())
; | 67 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder())
; |
| 70 AtomicString propertyName = toCoreAtomicString(nameString); | 68 AtomicString propertyName = toCoreAtomicString(nameString); |
| 71 NodeOrNodeList result; | 69 NodeOrNodeList result; |
| 72 impl->getItem(propertyName, result); | 70 impl->getItem(propertyName, result); |
| 73 if (result.isNull()) | 71 if (result.isNull()) |
| 74 return; | 72 return; |
| 75 v8SetReturnValue(info, result); | 73 v8SetReturnValue(info, result); |
| 76 } | 74 } |
| 77 | 75 |
| 78 static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::Prop
ertyCallbackInfo<v8::Value>& info) | 76 static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::Prop
ertyCallbackInfo<v8::Value>& info) |
| 79 { | 77 { |
| 80 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | 78 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| 81 TestSpecialOperationsV8Internal::namedPropertyGetter(name, info); | 79 TestSpecialOperationsV8Internal::namedPropertyGetter(name, info); |
| 82 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 80 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 83 } | 81 } |
| 84 | 82 |
| 85 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 83 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 86 { | 84 { |
| 87 if (!name->IsString()) | |
| 88 return; | |
| 89 auto nameString = name.As<v8::String>(); | 85 auto nameString = name.As<v8::String>(); |
| 90 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder())
; | 86 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder())
; |
| 91 V8StringResource<> propertyName(nameString); | 87 V8StringResource<> propertyName(nameString); |
| 92 if (!propertyName.prepare()) | 88 if (!propertyName.prepare()) |
| 93 return; | 89 return; |
| 94 Node* propertyValue = V8Node::toImplWithTypeCheck(info.GetIsolate(), v8Value
); | 90 Node* propertyValue = V8Node::toImplWithTypeCheck(info.GetIsolate(), v8Value
); |
| 95 if (!propertyValue && !isUndefinedOrNull(v8Value)) { | 91 if (!propertyValue && !isUndefinedOrNull(v8Value)) { |
| 96 exceptionState.throwTypeError("The provided value is not of type 'Node'.
"); | 92 exceptionState.throwTypeError("The provided value is not of type 'Node'.
"); |
| 97 exceptionState.throwIfNeeded(); | 93 exceptionState.throwIfNeeded(); |
| 98 return; | 94 return; |
| 99 } | 95 } |
| 100 bool result = impl->anonymousNamedSetter(propertyName, propertyValue); | 96 bool result = impl->anonymousNamedSetter(propertyName, propertyValue); |
| 101 if (!result) | 97 if (!result) |
| 102 return; | 98 return; |
| 103 v8SetReturnValue(info, v8Value); | 99 v8SetReturnValue(info, v8Value); |
| 104 } | 100 } |
| 105 | 101 |
| 106 static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::
Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 102 static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::
Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 107 { | 103 { |
| 108 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | 104 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| 109 TestSpecialOperationsV8Internal::namedPropertySetter(name, v8Value, info); | 105 TestSpecialOperationsV8Internal::namedPropertySetter(name, v8Value, info); |
| 110 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 106 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 111 } | 107 } |
| 112 | 108 |
| 113 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb
ackInfo<v8::Integer>& info) | 109 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb
ackInfo<v8::Integer>& info) |
| 114 { | 110 { |
| 115 if (!name->IsString()) | |
| 116 return; | |
| 117 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder())
; | 111 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder())
; |
| 118 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); | 112 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); |
| 119 v8::String::Utf8Value namedProperty(name); | 113 v8::String::Utf8Value namedProperty(name); |
| 120 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperations", info.Holder(), info.GetIsolate()); | 114 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperations", info.Holder(), info.GetIsolate()); |
| 121 bool result = impl->namedPropertyQuery(propertyName, exceptionState); | 115 bool result = impl->namedPropertyQuery(propertyName, exceptionState); |
| 122 if (exceptionState.throwIfNeeded()) | 116 if (exceptionState.throwIfNeeded()) |
| 123 return; | 117 return; |
| 124 if (!result) | 118 if (!result) |
| 125 return; | 119 return; |
| 126 v8SetReturnValueInt(info, v8::None); | 120 v8SetReturnValueInt(info, v8::None); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, func
tionTemplate, "TestSpecialOperations", v8::Local<v8::FunctionTemplate>(), V8Test
SpecialOperations::internalFieldCount, | 162 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, func
tionTemplate, "TestSpecialOperations", v8::Local<v8::FunctionTemplate>(), V8Test
SpecialOperations::internalFieldCount, |
| 169 0, 0, | 163 0, 0, |
| 170 0, 0, | 164 0, 0, |
| 171 V8TestSpecialOperationsMethods, WTF_ARRAY_LENGTH(V8TestSpecialOperations
Methods)); | 165 V8TestSpecialOperationsMethods, WTF_ARRAY_LENGTH(V8TestSpecialOperations
Methods)); |
| 172 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 166 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 173 ALLOW_UNUSED_LOCAL(instanceTemplate); | 167 ALLOW_UNUSED_LOCAL(instanceTemplate); |
| 174 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 168 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 175 ALLOW_UNUSED_LOCAL(prototypeTemplate); | 169 ALLOW_UNUSED_LOCAL(prototypeTemplate); |
| 176 { | 170 { |
| 177 v8::NamedPropertyHandlerConfiguration config(TestSpecialOperationsV8Inte
rnal::namedPropertyGetterCallback, TestSpecialOperationsV8Internal::namedPropert
ySetterCallback, TestSpecialOperationsV8Internal::namedPropertyQueryCallback, 0,
TestSpecialOperationsV8Internal::namedPropertyEnumeratorCallback); | 171 v8::NamedPropertyHandlerConfiguration config(TestSpecialOperationsV8Inte
rnal::namedPropertyGetterCallback, TestSpecialOperationsV8Internal::namedPropert
ySetterCallback, TestSpecialOperationsV8Internal::namedPropertyQueryCallback, 0,
TestSpecialOperationsV8Internal::namedPropertyEnumeratorCallback); |
| 172 config.flags = static_cast<v8::PropertyHandlerFlags>(static_cast<int>(co
nfig.flags) | static_cast<int>(v8::PropertyHandlerFlags::kOnlyInterceptStrings))
; |
| 178 functionTemplate->InstanceTemplate()->SetHandler(config); | 173 functionTemplate->InstanceTemplate()->SetHandler(config); |
| 179 } | 174 } |
| 180 | 175 |
| 181 // Custom toString template | 176 // Custom toString template |
| 182 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); | 177 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); |
| 183 } | 178 } |
| 184 | 179 |
| 185 v8::Local<v8::FunctionTemplate> V8TestSpecialOperations::domTemplate(v8::Isolate
* isolate) | 180 v8::Local<v8::FunctionTemplate> V8TestSpecialOperations::domTemplate(v8::Isolate
* isolate) |
| 186 { | 181 { |
| 187 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI
nfo*>(&wrapperTypeInfo), installV8TestSpecialOperationsTemplate); | 182 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI
nfo*>(&wrapperTypeInfo), installV8TestSpecialOperationsTemplate); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 206 { | 201 { |
| 207 scriptWrappable->toImpl<TestSpecialOperations>()->ref(); | 202 scriptWrappable->toImpl<TestSpecialOperations>()->ref(); |
| 208 } | 203 } |
| 209 | 204 |
| 210 void V8TestSpecialOperations::derefObject(ScriptWrappable* scriptWrappable) | 205 void V8TestSpecialOperations::derefObject(ScriptWrappable* scriptWrappable) |
| 211 { | 206 { |
| 212 scriptWrappable->toImpl<TestSpecialOperations>()->deref(); | 207 scriptWrappable->toImpl<TestSpecialOperations>()->deref(); |
| 213 } | 208 } |
| 214 | 209 |
| 215 } // namespace blink | 210 } // namespace blink |
| OLD | NEW |