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

Side by Side Diff: Source/bindings/tests/results/V8TestInterfaceEventConstructor.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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 return result->value.newLocal(isolate); 393 return result->value.newLocal(isolate);
394 394
395 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 395 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
396 v8::EscapableHandleScope handleScope(isolate); 396 v8::EscapableHandleScope handleScope(isolate);
397 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode); 397 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
398 configureV8TestInterfaceEventConstructorTemplate(templ, isolate, currentWorl dType); 398 configureV8TestInterfaceEventConstructorTemplate(templ, isolate, currentWorl dType);
399 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 399 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
400 return handleScope.Escape(templ); 400 return handleScope.Escape(templ);
401 } 401 }
402 402
403 bool V8TestInterfaceEventConstructor::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate, WrapperWorldType currentWorldType) 403 bool V8TestInterfaceEventConstructor::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
404 { 404 {
405 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 405 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
406 } 406 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
407
408 bool V8TestInterfaceEventConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Value > jsValue, v8::Isolate* isolate)
409 {
410 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld)
411 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, IsolatedWorld)
412 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, WorkerWorld);
413 } 407 }
414 408
415 v8::Handle<v8::Object> V8TestInterfaceEventConstructor::createWrapper(PassRefPtr <TestInterfaceEventConstructor> impl, v8::Handle<v8::Object> creationContext, v8 ::Isolate* isolate) 409 v8::Handle<v8::Object> V8TestInterfaceEventConstructor::createWrapper(PassRefPtr <TestInterfaceEventConstructor> impl, v8::Handle<v8::Object> creationContext, v8 ::Isolate* isolate)
416 { 410 {
417 ASSERT(impl); 411 ASSERT(impl);
418 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEventConstructor>(impl. get(), isolate)); 412 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEventConstructor>(impl. get(), isolate));
419 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 413 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
420 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 414 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
421 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 415 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
422 // the same object de-ref functions, though, so use that as the basis of the check. 416 // the same object de-ref functions, though, so use that as the basis of the check.
(...skipping 14 matching lines...) Expand all
437 fromInternalPointer(object)->deref(); 431 fromInternalPointer(object)->deref();
438 } 432 }
439 433
440 template<> 434 template<>
441 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate) 435 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate)
442 { 436 {
443 return toV8(impl, creationContext, isolate); 437 return toV8(impl, creationContext, isolate);
444 } 438 }
445 439
446 } // namespace WebCore 440 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698