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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 namespace WebCore { | 73 namespace WebCore { |
74 const WrapperTypeInfo V8TestEventTarget::wrapperTypeInfo = { gin::kEmbedderBlink
, V8TestEventTarget::GetTemplate, V8TestEventTarget::derefObject, 0, V8TestEvent
Target::toEventTarget, 0, V8TestEventTarget::installPerContextEnabledMethods, &V
8EventTarget::wrapperTypeInfo, WrapperTypeObjectPrototype }; | 74 const WrapperTypeInfo V8TestEventTarget::wrapperTypeInfo = { gin::kEmbedderBlink
, V8TestEventTarget::GetTemplate, V8TestEventTarget::derefObject, 0, V8TestEvent
Target::toEventTarget, 0, V8TestEventTarget::installPerContextEnabledMethods, &V
8EventTarget::wrapperTypeInfo, WrapperTypeObjectPrototype }; |
75 | 75 |
76 namespace TestEventTargetV8Internal { | 76 namespace TestEventTargetV8Internal { |
77 | 77 |
78 template <typename T> void V8_USE(T) { } | 78 template <typename T> void V8_USE(T) { } |
79 | 79 |
80 static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 80 static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
81 { | 81 { |
| 82 ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "Tes
tEventTarget", info.Holder(), info.GetIsolate()); |
82 if (UNLIKELY(info.Length() < 1)) { | 83 if (UNLIKELY(info.Length() < 1)) { |
83 throwTypeError(ExceptionMessages::failedToExecute("item", "TestEventTarg
et", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()
); | 84 throwTypeError(ExceptionMessages::failedToExecute("item", "TestEventTarg
et", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()
); |
84 return; | 85 return; |
85 } | 86 } |
86 TestEventTarget* imp = V8TestEventTarget::toNative(info.Holder()); | 87 TestEventTarget* imp = V8TestEventTarget::toNative(info.Holder()); |
87 V8TRYCATCH_VOID(unsigned, index, toUInt32(info[0])); | 88 V8TRYCATCH_VOID(unsigned, index, toUInt32(info[0])); |
88 v8SetReturnValue(info, imp->item(index)); | 89 v8SetReturnValue(info, imp->item(index)); |
89 } | 90 } |
90 | 91 |
91 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 92 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
92 { | 93 { |
93 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 94 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
94 TestEventTargetV8Internal::itemMethod(info); | 95 TestEventTargetV8Internal::itemMethod(info); |
95 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 96 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
96 } | 97 } |
97 | 98 |
98 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 99 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
99 { | 100 { |
| 101 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem",
"TestEventTarget", info.Holder(), info.GetIsolate()); |
100 if (UNLIKELY(info.Length() < 1)) { | 102 if (UNLIKELY(info.Length() < 1)) { |
101 throwTypeError(ExceptionMessages::failedToExecute("namedItem", "TestEven
tTarget", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsol
ate()); | 103 throwTypeError(ExceptionMessages::failedToExecute("namedItem", "TestEven
tTarget", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsol
ate()); |
102 return; | 104 return; |
103 } | 105 } |
104 TestEventTarget* imp = V8TestEventTarget::toNative(info.Holder()); | 106 TestEventTarget* imp = V8TestEventTarget::toNative(info.Holder()); |
105 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); | 107 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); |
106 v8SetReturnValue(info, imp->namedItem(name)); | 108 v8SetReturnValue(info, imp->namedItem(name)); |
107 } | 109 } |
108 | 110 |
109 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | 111 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 fromInternalPointer(object)->deref(); | 363 fromInternalPointer(object)->deref(); |
362 } | 364 } |
363 | 365 |
364 template<> | 366 template<> |
365 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) | 367 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) |
366 { | 368 { |
367 return toV8(impl, creationContext, isolate); | 369 return toV8(impl, creationContext, isolate); |
368 } | 370 } |
369 | 371 |
370 } // namespace WebCore | 372 } // namespace WebCore |
OLD | NEW |