Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp

Issue 196343032: Implement ImageData constructors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Generate code that custom wrap()s constructor instances Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
72 const WrapperTypeInfo V8TestInterfaceConstructor2::wrapperTypeInfo = { gin::kEmb edderBlink, V8TestInterfaceConstructor2::domTemplate, V8TestInterfaceConstructor 2::derefObject, 0, 0, 0, V8TestInterfaceConstructor2::installPerContextEnabledMe thods, 0, WrapperTypeObjectPrototype, false }; 72 const WrapperTypeInfo V8TestInterfaceConstructor2::wrapperTypeInfo = { gin::kEmb edderBlink, V8TestInterfaceConstructor2::domTemplate, V8TestInterfaceConstructor 2::derefObject, 0, 0, 0, V8TestInterfaceConstructor2::installPerContextEnabledMe thods, 0, WrapperTypeObjectPrototype, false };
73 73
74 namespace TestInterfaceConstructor2V8Internal { 74 namespace TestInterfaceConstructor2V8Internal {
75 75
76 template <typename T> void V8_USE(T) { } 76 template <typename T> void V8_USE(T) { }
77 77
78 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info) 78 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info)
79 { 79 {
80 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]) ; 80 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]) ;
81 RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(s tringArg); 81 RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(s tringArg);
82
82 v8::Handle<v8::Object> wrapper = info.Holder(); 83 v8::Handle<v8::Object> wrapper = info.Holder();
83 84 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor2>(impl.r elease(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolat e(), WrapperConfiguration::Independent);
84 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor2>(impl.r elease(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolat e(), WrapperConfiguration::Dependent);
85 v8SetReturnValue(info, wrapper); 85 v8SetReturnValue(info, wrapper);
86 } 86 }
87 87
88 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) 88 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
89 { 89 {
90 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor2", info.Holder(), info.GetIsolate()); 90 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor2", info.Holder(), info.GetIsolate());
91 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE mpty::toNativeWithTypeCheck(info.GetIsolate(), info[0])); 91 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE mpty::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
92 V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[1], exceptionState), ex ceptionState); 92 V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[1], exceptionState), ex ceptionState);
93 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, defaultUndefinedOpt ionalStringArg, info[2]); 93 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, defaultUndefinedOpt ionalStringArg, info[2]);
94 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, defaultNullStringOp tionalStringArg, argumentOrNull(info, 3)); 94 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, defaultNullStringOp tionalStringArg, argumentOrNull(info, 3));
95 V8TRYCATCH_VOID(Dictionary, defaultUndefinedOptionalDictionaryArg, Dictionar y(info[4], info.GetIsolate())); 95 V8TRYCATCH_VOID(Dictionary, defaultUndefinedOptionalDictionaryArg, Dictionar y(info[4], info.GetIsolate()));
96 if (!defaultUndefinedOptionalDictionaryArg.isUndefinedOrNull() && !defaultUn definedOptionalDictionaryArg.isObject()) { 96 if (!defaultUndefinedOptionalDictionaryArg.isUndefinedOrNull() && !defaultUn definedOptionalDictionaryArg.isObject()) {
97 exceptionState.throwTypeError("parameter 5 ('defaultUndefinedOptionalDic tionaryArg') is not an object."); 97 exceptionState.throwTypeError("parameter 5 ('defaultUndefinedOptionalDic tionaryArg') is not an object.");
98 exceptionState.throwIfNeeded(); 98 exceptionState.throwIfNeeded();
99 return; 99 return;
100 } 100 }
101 RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(t estInterfaceEmptyArg, longArg, defaultUndefinedOptionalStringArg, defaultNullStr ingOptionalStringArg, defaultUndefinedOptionalDictionaryArg); 101 RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(t estInterfaceEmptyArg, longArg, defaultUndefinedOptionalStringArg, defaultNullStr ingOptionalStringArg, defaultUndefinedOptionalDictionaryArg);
102
102 v8::Handle<v8::Object> wrapper = info.Holder(); 103 v8::Handle<v8::Object> wrapper = info.Holder();
103 104 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor2>(impl.r elease(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolat e(), WrapperConfiguration::Independent);
104 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor2>(impl.r elease(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolat e(), WrapperConfiguration::Dependent);
105 v8SetReturnValue(info, wrapper); 105 v8SetReturnValue(info, wrapper);
106 } 106 }
107 107
108 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) 108 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
109 { 109 {
110 if (((info.Length() == 1))) { 110 if (((info.Length() == 1))) {
111 TestInterfaceConstructor2V8Internal::constructor1(info); 111 TestInterfaceConstructor2V8Internal::constructor1(info);
112 return; 112 return;
113 } 113 }
114 if (((info.Length() == 2) && (V8TestInterfaceEmpty::hasInstance(info[0], inf o.GetIsolate()))) || ((info.Length() == 3) && (V8TestInterfaceEmpty::hasInstance (info[0], info.GetIsolate()))) || ((info.Length() == 4) && (V8TestInterfaceEmpty ::hasInstance(info[0], info.GetIsolate()))) || ((info.Length() == 5) && (V8TestI nterfaceEmpty::hasInstance(info[0], info.GetIsolate())) && (info[4]->IsUndefined () || info[4]->IsObject()))) { 114 if (((info.Length() == 2) && (V8TestInterfaceEmpty::hasInstance(info[0], inf o.GetIsolate()))) || ((info.Length() == 3) && (V8TestInterfaceEmpty::hasInstance (info[0], info.GetIsolate()))) || ((info.Length() == 4) && (V8TestInterfaceEmpty ::hasInstance(info[0], info.GetIsolate()))) || ((info.Length() == 5) && (V8TestI nterfaceEmpty::hasInstance(info[0], info.GetIsolate())) && (info[4]->IsUndefined () || info[4]->IsObject()))) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 fromInternalPointer(object)->deref(); 216 fromInternalPointer(object)->deref();
217 } 217 }
218 218
219 template<> 219 template<>
220 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor2* impl, v8::Handle<v 8::Object> creationContext, v8::Isolate* isolate) 220 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor2* impl, v8::Handle<v 8::Object> creationContext, v8::Isolate* isolate)
221 { 221 {
222 return toV8(impl, creationContext, isolate); 222 return toV8(impl, creationContext, isolate);
223 } 223 }
224 224
225 } // namespace WebCore 225 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698