OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 static void aAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCa
llbackInfo<v8::Value>& info) | 84 static void aAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCa
llbackInfo<v8::Value>& info) |
85 { | 85 { |
86 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 86 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
87 RealClassV8Internal::aAttributeGetter(info); | 87 RealClassV8Internal::aAttributeGetter(info); |
88 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 88 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
89 } | 89 } |
90 | 90 |
91 static void aAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCal
lbackInfo<void>& info) | 91 static void aAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCal
lbackInfo<void>& info) |
92 { | 92 { |
| 93 ExceptionState exceptionState(ExceptionState::SetterContext, "a", "TestInter
faceImplementedAs", info.Holder(), info.GetIsolate()); |
93 RealClass* imp = V8TestInterfaceImplementedAs::toNative(info.Holder()); | 94 RealClass* imp = V8TestInterfaceImplementedAs::toNative(info.Holder()); |
94 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 95 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
95 imp->setA(cppValue); | 96 imp->setA(cppValue); |
96 } | 97 } |
97 | 98 |
98 static void aAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<void>& info) | 99 static void aAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<void>& info) |
99 { | 100 { |
100 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 101 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
101 RealClassV8Internal::aAttributeSetter(jsValue, info); | 102 RealClassV8Internal::aAttributeSetter(jsValue, info); |
102 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 103 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
103 } | 104 } |
104 | 105 |
105 static void bAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) | 106 static void bAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) |
106 { | 107 { |
107 RealClass* imp = V8TestInterfaceImplementedAs::toNative(info.Holder()); | 108 RealClass* imp = V8TestInterfaceImplementedAs::toNative(info.Holder()); |
108 v8SetReturnValueFast(info, imp->b(), imp); | 109 v8SetReturnValueFast(info, imp->b(), imp); |
109 } | 110 } |
110 | 111 |
111 static void bAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCa
llbackInfo<v8::Value>& info) | 112 static void bAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCa
llbackInfo<v8::Value>& info) |
112 { | 113 { |
113 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 114 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
114 RealClassV8Internal::bAttributeGetter(info); | 115 RealClassV8Internal::bAttributeGetter(info); |
115 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 116 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
116 } | 117 } |
117 | 118 |
118 static void bAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCal
lbackInfo<void>& info) | 119 static void bAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCal
lbackInfo<void>& info) |
119 { | 120 { |
| 121 ExceptionState exceptionState(ExceptionState::SetterContext, "b", "TestInter
faceImplementedAs", info.Holder(), info.GetIsolate()); |
120 RealClass* imp = V8TestInterfaceImplementedAs::toNative(info.Holder()); | 122 RealClass* imp = V8TestInterfaceImplementedAs::toNative(info.Holder()); |
121 V8TRYCATCH_VOID(RealClass*, cppValue, V8TestInterfaceImplementedAs::hasInsta
nce(jsValue, info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestInterfaceI
mplementedAs::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); | 123 V8TRYCATCH_VOID(RealClass*, cppValue, V8TestInterfaceImplementedAs::hasInsta
nce(jsValue, info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestInterfaceI
mplementedAs::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); |
122 imp->setB(WTF::getPtr(cppValue)); | 124 imp->setB(WTF::getPtr(cppValue)); |
123 } | 125 } |
124 | 126 |
125 static void bAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<void>& info) | 127 static void bAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<void>& info) |
126 { | 128 { |
127 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 129 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
128 RealClassV8Internal::bAttributeSetter(jsValue, info); | 130 RealClassV8Internal::bAttributeSetter(jsValue, info); |
129 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 131 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
130 } | 132 } |
131 | 133 |
132 static void func1Method(const v8::FunctionCallbackInfo<v8::Value>& info) | 134 static void func1Method(const v8::FunctionCallbackInfo<v8::Value>& info) |
133 { | 135 { |
| 136 ExceptionState exceptionState(ExceptionState::ExecutionContext, "func1", "Te
stInterfaceImplementedAs", info.Holder(), info.GetIsolate()); |
134 if (UNLIKELY(info.Length() < 1)) { | 137 if (UNLIKELY(info.Length() < 1)) { |
135 throwTypeError(ExceptionMessages::failedToExecute("func1", "TestInterfac
eImplementedAs", ExceptionMessages::notEnoughArguments(1, info.Length())), info.
GetIsolate()); | 138 throwTypeError(ExceptionMessages::failedToExecute("func1", "TestInterfac
eImplementedAs", ExceptionMessages::notEnoughArguments(1, info.Length())), info.
GetIsolate()); |
136 return; | 139 return; |
137 } | 140 } |
138 RealClass* imp = V8TestInterfaceImplementedAs::toNative(info.Holder()); | 141 RealClass* imp = V8TestInterfaceImplementedAs::toNative(info.Holder()); |
139 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, a, info[0]); | 142 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, a, info[0]); |
140 v8SetReturnValueString(info, imp->func1(a), info.GetIsolate()); | 143 v8SetReturnValueString(info, imp->func1(a), info.GetIsolate()); |
141 } | 144 } |
142 | 145 |
143 static void func1MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 146 static void func1MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
144 { | 147 { |
145 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 148 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
146 RealClassV8Internal::func1Method(info); | 149 RealClassV8Internal::func1Method(info); |
147 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 150 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
148 } | 151 } |
149 | 152 |
150 static void funcTestInterfaceImplementedAsParamMethod(const v8::FunctionCallback
Info<v8::Value>& info) | 153 static void funcTestInterfaceImplementedAsParamMethod(const v8::FunctionCallback
Info<v8::Value>& info) |
151 { | 154 { |
| 155 ExceptionState exceptionState(ExceptionState::ExecutionContext, "funcTestInt
erfaceImplementedAsParam", "TestInterfaceImplementedAs", info.Holder(), info.Get
Isolate()); |
152 if (UNLIKELY(info.Length() < 1)) { | 156 if (UNLIKELY(info.Length() < 1)) { |
153 throwTypeError(ExceptionMessages::failedToExecute("funcTestInterfaceImpl
ementedAsParam", "TestInterfaceImplementedAs", ExceptionMessages::notEnoughArgum
ents(1, info.Length())), info.GetIsolate()); | 157 throwTypeError(ExceptionMessages::failedToExecute("funcTestInterfaceImpl
ementedAsParam", "TestInterfaceImplementedAs", ExceptionMessages::notEnoughArgum
ents(1, info.Length())), info.GetIsolate()); |
154 return; | 158 return; |
155 } | 159 } |
156 RealClass* imp = V8TestInterfaceImplementedAs::toNative(info.Holder()); | 160 RealClass* imp = V8TestInterfaceImplementedAs::toNative(info.Holder()); |
157 V8TRYCATCH_VOID(RealClass*, orange, V8TestInterfaceImplementedAs::hasInstanc
e(info[0], info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestInterfaceImp
lementedAs::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0); | 161 V8TRYCATCH_VOID(RealClass*, orange, V8TestInterfaceImplementedAs::hasInstanc
e(info[0], info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestInterfaceImp
lementedAs::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0); |
158 v8SetReturnValueString(info, imp->funcTestInterfaceImplementedAsParam(orange
), info.GetIsolate()); | 162 v8SetReturnValueString(info, imp->funcTestInterfaceImplementedAsParam(orange
), info.GetIsolate()); |
159 } | 163 } |
160 | 164 |
161 static void funcTestInterfaceImplementedAsParamMethodCallback(const v8::Function
CallbackInfo<v8::Value>& info) | 165 static void funcTestInterfaceImplementedAsParamMethodCallback(const v8::Function
CallbackInfo<v8::Value>& info) |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 fromInternalPointer(object)->deref(); | 259 fromInternalPointer(object)->deref(); |
256 } | 260 } |
257 | 261 |
258 template<> | 262 template<> |
259 v8::Handle<v8::Value> toV8NoInline(RealClass* impl, v8::Handle<v8::Object> creat
ionContext, v8::Isolate* isolate) | 263 v8::Handle<v8::Value> toV8NoInline(RealClass* impl, v8::Handle<v8::Object> creat
ionContext, v8::Isolate* isolate) |
260 { | 264 { |
261 return toV8(impl, creationContext, isolate); | 265 return toV8(impl, creationContext, isolate); |
262 } | 266 } |
263 | 267 |
264 } // namespace WebCore | 268 } // namespace WebCore |
OLD | NEW |