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 namespace WebCore { | 72 namespace WebCore { |
73 const WrapperTypeInfo V8TestOverloadedConstructors::wrapperTypeInfo = { gin::kEm
bedderBlink, V8TestOverloadedConstructors::GetTemplate, V8TestOverloadedConstruc
tors::derefObject, 0, 0, 0, V8TestOverloadedConstructors::installPerContextEnabl
edMethods, 0, WrapperTypeObjectPrototype }; | 73 const WrapperTypeInfo V8TestOverloadedConstructors::wrapperTypeInfo = { gin::kEm
bedderBlink, V8TestOverloadedConstructors::GetTemplate, V8TestOverloadedConstruc
tors::derefObject, 0, 0, 0, V8TestOverloadedConstructors::installPerContextEnabl
edMethods, 0, WrapperTypeObjectPrototype }; |
74 | 74 |
75 namespace TestOverloadedConstructorsV8Internal { | 75 namespace TestOverloadedConstructorsV8Internal { |
76 | 76 |
77 template <typename T> void V8_USE(T) { } | 77 template <typename T> void V8_USE(T) { } |
78 | 78 |
79 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info) | 79 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info) |
80 { | 80 { |
81 V8TRYCATCH_VOID(ArrayBuffer*, arrayBuffer, info[0]->IsArrayBuffer() ? V8Arra
yBuffer::toNative(v8::Handle<v8::ArrayBuffer>::Cast(info[0])) : 0); | 81 V8TRYCATCH_VOID(ArrayBuffer*, arrayBuffer, info[0]->IsArrayBuffer() ? V8Arra
yBuffer::toNative(v8::Handle<v8::ArrayBuffer>::Cast(info[0])) : 0); |
82 | |
83 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(arrayBuffer); | 82 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(arrayBuffer); |
84 v8::Handle<v8::Object> wrapper = info.Holder(); | 83 v8::Handle<v8::Object> wrapper = info.Holder(); |
85 | 84 |
86 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::wrapperTypeInfo, wrapper, info.GetIsol
ate(), WrapperConfiguration::Dependent); | 85 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::wrapperTypeInfo, wrapper, info.GetIsol
ate(), WrapperConfiguration::Dependent); |
87 v8SetReturnValue(info, wrapper); | 86 v8SetReturnValue(info, wrapper); |
88 } | 87 } |
89 | 88 |
90 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) | 89 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) |
91 { | 90 { |
92 V8TRYCATCH_VOID(ArrayBufferView*, arrayBufferView, info[0]->IsArrayBufferVie
w() ? V8ArrayBufferView::toNative(v8::Handle<v8::ArrayBufferView>::Cast(info[0])
) : 0); | 91 V8TRYCATCH_VOID(ArrayBufferView*, arrayBufferView, info[0]->IsArrayBufferVie
w() ? V8ArrayBufferView::toNative(v8::Handle<v8::ArrayBufferView>::Cast(info[0])
) : 0); |
93 | |
94 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(arrayBufferView); | 92 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(arrayBufferView); |
95 v8::Handle<v8::Object> wrapper = info.Holder(); | 93 v8::Handle<v8::Object> wrapper = info.Holder(); |
96 | 94 |
97 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::wrapperTypeInfo, wrapper, info.GetIsol
ate(), WrapperConfiguration::Dependent); | 95 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::wrapperTypeInfo, wrapper, info.GetIsol
ate(), WrapperConfiguration::Dependent); |
98 v8SetReturnValue(info, wrapper); | 96 v8SetReturnValue(info, wrapper); |
99 } | 97 } |
100 | 98 |
101 static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& info) | 99 static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& info) |
102 { | 100 { |
103 V8TRYCATCH_VOID(Blob*, blob, V8Blob::hasInstance(info[0], info.GetIsolate(),
worldType(info.GetIsolate())) ? V8Blob::toNative(v8::Handle<v8::Object>::Cast(i
nfo[0])) : 0); | 101 V8TRYCATCH_VOID(Blob*, blob, V8Blob::hasInstance(info[0], info.GetIsolate(),
worldType(info.GetIsolate())) ? V8Blob::toNative(v8::Handle<v8::Object>::Cast(i
nfo[0])) : 0); |
104 | |
105 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(blob); | 102 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(blob); |
106 v8::Handle<v8::Object> wrapper = info.Holder(); | 103 v8::Handle<v8::Object> wrapper = info.Holder(); |
107 | 104 |
108 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::wrapperTypeInfo, wrapper, info.GetIsol
ate(), WrapperConfiguration::Dependent); | 105 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::wrapperTypeInfo, wrapper, info.GetIsol
ate(), WrapperConfiguration::Dependent); |
109 v8SetReturnValue(info, wrapper); | 106 v8SetReturnValue(info, wrapper); |
110 } | 107 } |
111 | 108 |
112 static void constructor4(const v8::FunctionCallbackInfo<v8::Value>& info) | 109 static void constructor4(const v8::FunctionCallbackInfo<v8::Value>& info) |
113 { | 110 { |
114 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, string, info[0]); | 111 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, string, info[0]); |
115 | |
116 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(string); | 112 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(string); |
117 v8::Handle<v8::Object> wrapper = info.Holder(); | 113 v8::Handle<v8::Object> wrapper = info.Holder(); |
118 | 114 |
119 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::wrapperTypeInfo, wrapper, info.GetIsol
ate(), WrapperConfiguration::Dependent); | 115 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::wrapperTypeInfo, wrapper, info.GetIsol
ate(), WrapperConfiguration::Dependent); |
120 v8SetReturnValue(info, wrapper); | 116 v8SetReturnValue(info, wrapper); |
121 } | 117 } |
122 | 118 |
123 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 119 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
124 { | 120 { |
125 if (((info.Length() == 1) && (V8ArrayBuffer::hasInstance(info[0], info.GetIs
olate(), worldType(info.GetIsolate()))))) { | 121 if (((info.Length() == 1) && (V8ArrayBuffer::hasInstance(info[0], info.GetIs
olate(), worldType(info.GetIsolate()))))) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 fromInternalPointer(object)->deref(); | 235 fromInternalPointer(object)->deref(); |
240 } | 236 } |
241 | 237 |
242 template<> | 238 template<> |
243 v8::Handle<v8::Value> toV8NoInline(TestOverloadedConstructors* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) | 239 v8::Handle<v8::Value> toV8NoInline(TestOverloadedConstructors* impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) |
244 { | 240 { |
245 return toV8(impl, creationContext, isolate); | 241 return toV8(impl, creationContext, isolate); |
246 } | 242 } |
247 | 243 |
248 } // namespace WebCore | 244 } // namespace WebCore |
OLD | NEW |