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

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

Issue 154133003: IDL compiler: sync Python to r166698 (and add test case) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfaceWillBeGarbageCollected.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // In ScriptWrappable::init, the use of a local function declaration has an issu e on Windows: 58 // In ScriptWrappable::init, the use of a local function declaration has an issu e on Windows:
59 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function 59 // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function
60 // in the global namespace. 60 // in the global namespace.
61 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe edback/details/664619/the-namespace-of-local-function-declarations-in-c) 61 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe edback/details/664619/the-namespace-of-local-function-declarations-in-c)
62 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceWillBeGa rbageCollected* object) 62 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceWillBeGa rbageCollected* object)
63 { 63 {
64 WebCore::initializeScriptWrappableForInterface(object); 64 WebCore::initializeScriptWrappableForInterface(object);
65 } 65 }
66 66
67 namespace WebCore { 67 namespace WebCore {
68 const WrapperTypeInfo V8TestInterfaceWillBeGarbageCollected::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceWillBeGarbageCollected::domTemplate, V8Test InterfaceWillBeGarbageCollected::derefObject, 0, 0, 0, V8TestInterfaceWillBeGarb ageCollected::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, tr ue }; 68 const WrapperTypeInfo V8TestInterfaceWillBeGarbageCollected::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceWillBeGarbageCollected::domTemplate, V8Test InterfaceWillBeGarbageCollected::derefObject, 0, V8TestInterfaceWillBeGarbageCol lected::toEventTarget, 0, V8TestInterfaceWillBeGarbageCollected::installPerConte xtEnabledMethods, &V8EventTarget::wrapperTypeInfo, WrapperTypeObjectPrototype, t rue };
69 69
70 namespace TestInterfaceWillBeGarbageCollectedV8Internal { 70 namespace TestInterfaceWillBeGarbageCollectedV8Internal {
71 71
72 template <typename T> void V8_USE(T) { } 72 template <typename T> void V8_USE(T) { }
73 73
74 static void attr1AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info ) 74 static void attr1AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info )
75 { 75 {
76 TestInterfaceWillBeGarbageCollected* imp = V8TestInterfaceWillBeGarbageColle cted::toNative(info.Holder()); 76 TestInterfaceWillBeGarbageCollected* imp = V8TestInterfaceWillBeGarbageColle cted::toNative(info.Holder());
77 v8SetReturnValueFast(info, imp->attr1(), imp); 77 v8SetReturnValueFast(info, imp->attr1(), imp);
78 } 78 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 154 }
155 155
156 TestInterfaceWillBeGarbageCollectedV8Internal::constructor(info); 156 TestInterfaceWillBeGarbageCollectedV8Internal::constructor(info);
157 } 157 }
158 158
159 static void configureV8TestInterfaceWillBeGarbageCollectedTemplate(v8::Handle<v8 ::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType cur rentWorldType) 159 static void configureV8TestInterfaceWillBeGarbageCollectedTemplate(v8::Handle<v8 ::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType cur rentWorldType)
160 { 160 {
161 functionTemplate->ReadOnlyPrototype(); 161 functionTemplate->ReadOnlyPrototype();
162 162
163 v8::Local<v8::Signature> defaultSignature; 163 v8::Local<v8::Signature> defaultSignature;
164 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfaceWillBeGarbageCollected", v8::Local<v8::FunctionTemplate>(), V 8TestInterfaceWillBeGarbageCollected::internalFieldCount, 164 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfaceWillBeGarbageCollected", V8EventTarget::domTemplate(isolate, currentWorldType), V8TestInterfaceWillBeGarbageCollected::internalFieldCount,
165 V8TestInterfaceWillBeGarbageCollectedAttributes, WTF_ARRAY_LENGTH(V8Test InterfaceWillBeGarbageCollectedAttributes), 165 V8TestInterfaceWillBeGarbageCollectedAttributes, WTF_ARRAY_LENGTH(V8Test InterfaceWillBeGarbageCollectedAttributes),
166 0, 0, 166 0, 0,
167 V8TestInterfaceWillBeGarbageCollectedMethods, WTF_ARRAY_LENGTH(V8TestInt erfaceWillBeGarbageCollectedMethods), 167 V8TestInterfaceWillBeGarbageCollectedMethods, WTF_ARRAY_LENGTH(V8TestInt erfaceWillBeGarbageCollectedMethods),
168 isolate, currentWorldType); 168 isolate, currentWorldType);
169 functionTemplate->SetCallHandler(V8TestInterfaceWillBeGarbageCollected::cons tructorCallback); 169 functionTemplate->SetCallHandler(V8TestInterfaceWillBeGarbageCollected::cons tructorCallback);
170 functionTemplate->SetLength(1); 170 functionTemplate->SetLength(1);
171 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate(); 171 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
172 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate(); 172 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate();
173 173
174 // Custom toString template 174 // Custom toString template
(...skipping 14 matching lines...) Expand all
189 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 189 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
190 return handleScope.Escape(templ); 190 return handleScope.Escape(templ);
191 } 191 }
192 192
193 bool V8TestInterfaceWillBeGarbageCollected::hasInstance(v8::Handle<v8::Value> js Value, v8::Isolate* isolate) 193 bool V8TestInterfaceWillBeGarbageCollected::hasInstance(v8::Handle<v8::Value> js Value, v8::Isolate* isolate)
194 { 194 {
195 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue) 195 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
196 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue); 196 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
197 } 197 }
198 198
199 EventTarget* V8TestInterfaceWillBeGarbageCollected::toEventTarget(v8::Handle<v8: :Object> object)
200 {
201 return toNative(object);
202 }
203
199 v8::Handle<v8::Object> V8TestInterfaceWillBeGarbageCollected::createWrapper(Pass RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl, v8::Handle<v8::Obj ect> creationContext, v8::Isolate* isolate) 204 v8::Handle<v8::Object> V8TestInterfaceWillBeGarbageCollected::createWrapper(Pass RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl, v8::Handle<v8::Obj ect> creationContext, v8::Isolate* isolate)
200 { 205 {
201 ASSERT(impl); 206 ASSERT(impl);
202 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceWillBeGarbageCollected> (impl.get(), isolate)); 207 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceWillBeGarbageCollected> (impl.get(), isolate));
203 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 208 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
204 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 209 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
205 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 210 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
206 // the same object de-ref functions, though, so use that as the basis of the check. 211 // the same object de-ref functions, though, so use that as the basis of the check.
207 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); 212 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
208 } 213 }
(...skipping 12 matching lines...) Expand all
221 fromInternalPointer(object)->deref(); 226 fromInternalPointer(object)->deref();
222 } 227 }
223 228
224 template<> 229 template<>
225 v8::Handle<v8::Value> toV8NoInline(TestInterfaceWillBeGarbageCollected* impl, v8 ::Handle<v8::Object> creationContext, v8::Isolate* isolate) 230 v8::Handle<v8::Value> toV8NoInline(TestInterfaceWillBeGarbageCollected* impl, v8 ::Handle<v8::Object> creationContext, v8::Isolate* isolate)
226 { 231 {
227 return toV8(impl, creationContext, isolate); 232 return toV8(impl, creationContext, isolate);
228 } 233 }
229 234
230 } // namespace WebCore 235 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfaceWillBeGarbageCollected.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698