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

Side by Side Diff: Source/bindings/tests/results/V8TestException.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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return result->value.newLocal(isolate); 145 return result->value.newLocal(isolate);
146 146
147 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 147 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
148 v8::EscapableHandleScope handleScope(isolate); 148 v8::EscapableHandleScope handleScope(isolate);
149 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode); 149 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
150 configureV8TestExceptionTemplate(templ, isolate, currentWorldType); 150 configureV8TestExceptionTemplate(templ, isolate, currentWorldType);
151 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 151 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
152 return handleScope.Escape(templ); 152 return handleScope.Escape(templ);
153 } 153 }
154 154
155 bool V8TestException::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is olate, WrapperWorldType currentWorldType) 155 bool V8TestException::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is olate)
156 { 156 {
157 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 157 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
158 } 158 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
159
160 bool V8TestException::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::I solate* isolate)
161 {
162 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld)
163 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, IsolatedWorld)
164 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, WorkerWorld);
165 } 159 }
166 160
167 v8::Handle<v8::Object> V8TestException::createWrapper(PassRefPtr<TestException> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 161 v8::Handle<v8::Object> V8TestException::createWrapper(PassRefPtr<TestException> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
168 { 162 {
169 ASSERT(impl); 163 ASSERT(impl);
170 ASSERT(!DOMDataStore::containsWrapper<V8TestException>(impl.get(), isolate)) ; 164 ASSERT(!DOMDataStore::containsWrapper<V8TestException>(impl.get(), isolate)) ;
171 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 165 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
172 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 166 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
173 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 167 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
174 // the same object de-ref functions, though, so use that as the basis of the check. 168 // the same object de-ref functions, though, so use that as the basis of the check.
(...skipping 14 matching lines...) Expand all
189 fromInternalPointer(object)->deref(); 183 fromInternalPointer(object)->deref();
190 } 184 }
191 185
192 template<> 186 template<>
193 v8::Handle<v8::Value> toV8NoInline(TestException* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 187 v8::Handle<v8::Value> toV8NoInline(TestException* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
194 { 188 {
195 return toV8(impl, creationContext, isolate); 189 return toV8(impl, creationContext, isolate);
196 } 190 }
197 191
198 } // namespace WebCore 192 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestException.h ('k') | Source/bindings/tests/results/V8TestInterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698