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

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

Issue 125043004: Remove world type from hasInstance() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return result->value.newLocal(isolate); 114 return result->value.newLocal(isolate);
115 115
116 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 116 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
117 v8::EscapableHandleScope handleScope(isolate); 117 v8::EscapableHandleScope handleScope(isolate);
118 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode); 118 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
119 configureV8TestInterfaceCustomConstructorTemplate(templ, isolate, currentWor ldType); 119 configureV8TestInterfaceCustomConstructorTemplate(templ, isolate, currentWor ldType);
120 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 120 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
121 return handleScope.Escape(templ); 121 return handleScope.Escape(templ);
122 } 122 }
123 123
124 bool V8TestInterfaceCustomConstructor::hasInstance(v8::Handle<v8::Value> jsValue , v8::Isolate* isolate, WrapperWorldType currentWorldType) 124 bool V8TestInterfaceCustomConstructor::hasInstance(v8::Handle<v8::Value> jsValue , v8::Isolate* isolate)
125 { 125 {
126 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 126 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
127 } 127 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
128
129 bool V8TestInterfaceCustomConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Valu e> jsValue, v8::Isolate* isolate)
130 {
131 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld)
132 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, IsolatedWorld)
133 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, WorkerWorld);
134 } 128 }
135 129
136 v8::Handle<v8::Object> V8TestInterfaceCustomConstructor::createWrapper(PassRefPt r<TestInterfaceCustomConstructor> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 130 v8::Handle<v8::Object> V8TestInterfaceCustomConstructor::createWrapper(PassRefPt r<TestInterfaceCustomConstructor> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
137 { 131 {
138 ASSERT(impl); 132 ASSERT(impl);
139 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceCustomConstructor>(impl .get(), isolate)); 133 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceCustomConstructor>(impl .get(), isolate));
140 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 134 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
141 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 135 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
142 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 136 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
143 // the same object de-ref functions, though, so use that as the basis of the check. 137 // the same object de-ref functions, though, so use that as the basis of the check.
(...skipping 14 matching lines...) Expand all
158 fromInternalPointer(object)->deref(); 152 fromInternalPointer(object)->deref();
159 } 153 }
160 154
161 template<> 155 template<>
162 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCustomConstructor* impl, v8::Han dle<v8::Object> creationContext, v8::Isolate* isolate) 156 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCustomConstructor* impl, v8::Han dle<v8::Object> creationContext, v8::Isolate* isolate)
163 { 157 {
164 return toV8(impl, creationContext, isolate); 158 return toV8(impl, creationContext, isolate);
165 } 159 }
166 160
167 } // namespace WebCore 161 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698