| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 namespace WebCore { | 69 namespace WebCore { |
| 70 const WrapperTypeInfo V8TestInterfaceWillBeGarbageCollected::wrapperTypeInfo = {
gin::kEmbedderBlink, V8TestInterfaceWillBeGarbageCollected::domTemplate, V8Test
InterfaceWillBeGarbageCollected::derefObject, 0, V8TestInterfaceWillBeGarbageCol
lected::toEventTarget, 0, V8TestInterfaceWillBeGarbageCollected::installPerConte
xtEnabledMethods, &V8EventTarget::wrapperTypeInfo, WrapperTypeObjectPrototype, t
rue }; | 70 const WrapperTypeInfo V8TestInterfaceWillBeGarbageCollected::wrapperTypeInfo = {
gin::kEmbedderBlink, V8TestInterfaceWillBeGarbageCollected::domTemplate, V8Test
InterfaceWillBeGarbageCollected::derefObject, 0, V8TestInterfaceWillBeGarbageCol
lected::toEventTarget, 0, V8TestInterfaceWillBeGarbageCollected::installPerConte
xtEnabledMethods, &V8EventTarget::wrapperTypeInfo, WrapperTypeObjectPrototype, t
rue }; |
| 71 | 71 |
| 72 namespace TestInterfaceWillBeGarbageCollectedV8Internal { | 72 namespace TestInterfaceWillBeGarbageCollectedV8Internal { |
| 73 | 73 |
| 74 template <typename T> void V8_USE(T) { } | 74 template <typename T> void V8_USE(T) { } |
| 75 | 75 |
| 76 static void attr1AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info
) | 76 static void attr1AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info
) |
| 77 { | 77 { |
| 78 TestInterfaceWillBeGarbageCollected* imp = V8TestInterfaceWillBeGarbageColle
cted::toNative(info.Holder()); | 78 TestInterfaceWillBeGarbageCollected* impl = V8TestInterfaceWillBeGarbageColl
ected::toNative(info.Holder()); |
| 79 v8SetReturnValueFast(info, WTF::getPtr(imp->attr1()), imp); | 79 v8SetReturnValueFast(info, WTF::getPtr(impl->attr1()), impl); |
| 80 } | 80 } |
| 81 | 81 |
| 82 static void attr1AttributeGetterCallback(v8::Local<v8::String>, const v8::Proper
tyCallbackInfo<v8::Value>& info) | 82 static void attr1AttributeGetterCallback(v8::Local<v8::String>, const v8::Proper
tyCallbackInfo<v8::Value>& info) |
| 83 { | 83 { |
| 84 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 84 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 85 TestInterfaceWillBeGarbageCollectedV8Internal::attr1AttributeGetter(info); | 85 TestInterfaceWillBeGarbageCollectedV8Internal::attr1AttributeGetter(info); |
| 86 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 86 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 87 } | 87 } |
| 88 | 88 |
| 89 static void attr1AttributeSetter(v8::Local<v8::Value> jsValue, const v8::Propert
yCallbackInfo<void>& info) | 89 static void attr1AttributeSetter(v8::Local<v8::Value> jsValue, const v8::Propert
yCallbackInfo<void>& info) |
| 90 { | 90 { |
| 91 TestInterfaceWillBeGarbageCollected* imp = V8TestInterfaceWillBeGarbageColle
cted::toNative(info.Holder()); | 91 TestInterfaceWillBeGarbageCollected* impl = V8TestInterfaceWillBeGarbageColl
ected::toNative(info.Holder()); |
| 92 V8TRYCATCH_VOID(TestInterfaceWillBeGarbageCollected*, cppValue, V8TestInterf
aceWillBeGarbageCollected::toNativeWithTypeCheck(info.GetIsolate(), jsValue)); | 92 V8TRYCATCH_VOID(TestInterfaceWillBeGarbageCollected*, cppValue, V8TestInterf
aceWillBeGarbageCollected::toNativeWithTypeCheck(info.GetIsolate(), jsValue)); |
| 93 imp->setAttr1(WTF::getPtr(cppValue)); | 93 impl->setAttr1(WTF::getPtr(cppValue)); |
| 94 } | 94 } |
| 95 | 95 |
| 96 static void attr1AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Va
lue> jsValue, const v8::PropertyCallbackInfo<void>& info) | 96 static void attr1AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Va
lue> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 97 { | 97 { |
| 98 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 98 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 99 TestInterfaceWillBeGarbageCollectedV8Internal::attr1AttributeSetter(jsValue,
info); | 99 TestInterfaceWillBeGarbageCollectedV8Internal::attr1AttributeSetter(jsValue,
info); |
| 100 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 100 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 101 } | 101 } |
| 102 | 102 |
| 103 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 103 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 104 { | 104 { |
| 105 if (UNLIKELY(info.Length() < 1)) { | 105 if (UNLIKELY(info.Length() < 1)) { |
| 106 throwTypeError(ExceptionMessages::failedToExecute("func", "TestInterface
WillBeGarbageCollected", ExceptionMessages::notEnoughArguments(1, info.Length())
), info.GetIsolate()); | 106 throwTypeError(ExceptionMessages::failedToExecute("func", "TestInterface
WillBeGarbageCollected", ExceptionMessages::notEnoughArguments(1, info.Length())
), info.GetIsolate()); |
| 107 return; | 107 return; |
| 108 } | 108 } |
| 109 TestInterfaceWillBeGarbageCollected* imp = V8TestInterfaceWillBeGarbageColle
cted::toNative(info.Holder()); | 109 TestInterfaceWillBeGarbageCollected* impl = V8TestInterfaceWillBeGarbageColl
ected::toNative(info.Holder()); |
| 110 V8TRYCATCH_VOID(TestInterfaceWillBeGarbageCollected*, arg, V8TestInterfaceWi
llBeGarbageCollected::toNativeWithTypeCheck(info.GetIsolate(), info[0])); | 110 V8TRYCATCH_VOID(TestInterfaceWillBeGarbageCollected*, arg, V8TestInterfaceWi
llBeGarbageCollected::toNativeWithTypeCheck(info.GetIsolate(), info[0])); |
| 111 imp->func(arg); | 111 impl->func(arg); |
| 112 } | 112 } |
| 113 | 113 |
| 114 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 114 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 115 { | 115 { |
| 116 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 116 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 117 TestInterfaceWillBeGarbageCollectedV8Internal::funcMethod(info); | 117 TestInterfaceWillBeGarbageCollectedV8Internal::funcMethod(info); |
| 118 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 118 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 119 } | 119 } |
| 120 | 120 |
| 121 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 121 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 #endif // !ENABLE(OILPAN) | 238 #endif // !ENABLE(OILPAN) |
| 239 } | 239 } |
| 240 | 240 |
| 241 template<> | 241 template<> |
| 242 v8::Handle<v8::Value> toV8NoInline(TestInterfaceWillBeGarbageCollected* impl, v8
::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 242 v8::Handle<v8::Value> toV8NoInline(TestInterfaceWillBeGarbageCollected* impl, v8
::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 243 { | 243 { |
| 244 return toV8(impl, creationContext, isolate); | 244 return toV8(impl, creationContext, isolate); |
| 245 } | 245 } |
| 246 | 246 |
| 247 } // namespace WebCore | 247 } // namespace WebCore |
| OLD | NEW |