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

Side by Side Diff: Source/bindings/tests/results/V8TestTypedefs.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
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.h ('k') | Source/bindings/v8/Dictionary.cpp » ('j') | 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 return result->value.newLocal(isolate); 469 return result->value.newLocal(isolate);
470 470
471 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 471 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
472 v8::EscapableHandleScope handleScope(isolate); 472 v8::EscapableHandleScope handleScope(isolate);
473 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode); 473 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
474 configureV8TestTypedefsTemplate(templ, isolate, currentWorldType); 474 configureV8TestTypedefsTemplate(templ, isolate, currentWorldType);
475 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 475 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
476 return handleScope.Escape(templ); 476 return handleScope.Escape(templ);
477 } 477 }
478 478
479 bool V8TestTypedefs::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* iso late, WrapperWorldType currentWorldType) 479 bool V8TestTypedefs::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* iso late)
480 { 480 {
481 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 481 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
482 } 482 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
483
484 bool V8TestTypedefs::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Is olate* isolate)
485 {
486 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld)
487 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, IsolatedWorld)
488 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, WorkerWorld);
489 } 483 }
490 484
491 v8::Handle<v8::Object> V8TestTypedefs::createWrapper(PassRefPtr<TestTypedefs> im pl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 485 v8::Handle<v8::Object> V8TestTypedefs::createWrapper(PassRefPtr<TestTypedefs> im pl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
492 { 486 {
493 ASSERT(impl); 487 ASSERT(impl);
494 ASSERT(!DOMDataStore::containsWrapper<V8TestTypedefs>(impl.get(), isolate)); 488 ASSERT(!DOMDataStore::containsWrapper<V8TestTypedefs>(impl.get(), isolate));
495 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 489 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
496 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 490 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
497 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 491 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
498 // the same object de-ref functions, though, so use that as the basis of the check. 492 // the same object de-ref functions, though, so use that as the basis of the check.
(...skipping 14 matching lines...) Expand all
513 fromInternalPointer(object)->deref(); 507 fromInternalPointer(object)->deref();
514 } 508 }
515 509
516 template<> 510 template<>
517 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate) 511 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate)
518 { 512 {
519 return toV8(impl, creationContext, isolate); 513 return toV8(impl, creationContext, isolate);
520 } 514 }
521 515
522 } // namespace WebCore 516 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.h ('k') | Source/bindings/v8/Dictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698