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

Side by Side Diff: Source/bindings/tests/results/V8TestInterfaceConstructor3.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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return result->value.newLocal(isolate); 128 return result->value.newLocal(isolate);
129 129
130 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 130 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
131 v8::EscapableHandleScope handleScope(isolate); 131 v8::EscapableHandleScope handleScope(isolate);
132 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode); 132 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
133 configureV8TestInterfaceConstructor3Template(templ, isolate, currentWorldTyp e); 133 configureV8TestInterfaceConstructor3Template(templ, isolate, currentWorldTyp e);
134 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 134 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
135 return handleScope.Escape(templ); 135 return handleScope.Escape(templ);
136 } 136 }
137 137
138 bool V8TestInterfaceConstructor3::hasInstance(v8::Handle<v8::Value> jsValue, v8: :Isolate* isolate, WrapperWorldType currentWorldType) 138 bool V8TestInterfaceConstructor3::hasInstance(v8::Handle<v8::Value> jsValue, v8: :Isolate* isolate)
139 { 139 {
140 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 140 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
141 } 141 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
142
143 bool V8TestInterfaceConstructor3::hasInstanceInAnyWorld(v8::Handle<v8::Value> js Value, v8::Isolate* isolate)
144 {
145 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld)
146 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, IsolatedWorld)
147 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, WorkerWorld);
148 } 142 }
149 143
150 v8::Handle<v8::Object> V8TestInterfaceConstructor3::createWrapper(PassRefPtr<Tes tInterfaceConstructor3> impl, v8::Handle<v8::Object> creationContext, v8::Isolat e* isolate) 144 v8::Handle<v8::Object> V8TestInterfaceConstructor3::createWrapper(PassRefPtr<Tes tInterfaceConstructor3> impl, v8::Handle<v8::Object> creationContext, v8::Isolat e* isolate)
151 { 145 {
152 ASSERT(impl); 146 ASSERT(impl);
153 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceConstructor3>(impl.get( ), isolate)); 147 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceConstructor3>(impl.get( ), isolate));
154 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 148 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
155 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 149 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
156 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 150 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
157 // the same object de-ref functions, though, so use that as the basis of the check. 151 // the same object de-ref functions, though, so use that as the basis of the check.
(...skipping 14 matching lines...) Expand all
172 fromInternalPointer(object)->deref(); 166 fromInternalPointer(object)->deref();
173 } 167 }
174 168
175 template<> 169 template<>
176 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor3* impl, v8::Handle<v 8::Object> creationContext, v8::Isolate* isolate) 170 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor3* impl, v8::Handle<v 8::Object> creationContext, v8::Isolate* isolate)
177 { 171 {
178 return toV8(impl, creationContext, isolate); 172 return toV8(impl, creationContext, isolate);
179 } 173 }
180 174
181 } // namespace WebCore 175 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698