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

Side by Side Diff: Source/bindings/tests/results/V8TestInterfaceEmpty.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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 return result->value.newLocal(isolate); 96 return result->value.newLocal(isolate);
97 97
98 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 98 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
99 v8::EscapableHandleScope handleScope(isolate); 99 v8::EscapableHandleScope handleScope(isolate);
100 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode); 100 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
101 configureV8TestInterfaceEmptyTemplate(templ, isolate, currentWorldType); 101 configureV8TestInterfaceEmptyTemplate(templ, isolate, currentWorldType);
102 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 102 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
103 return handleScope.Escape(templ); 103 return handleScope.Escape(templ);
104 } 104 }
105 105
106 bool V8TestInterfaceEmpty::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolat e* isolate, WrapperWorldType currentWorldType) 106 bool V8TestInterfaceEmpty::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolat e* isolate)
107 { 107 {
108 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 108 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
109 } 109 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
110
111 bool V8TestInterfaceEmpty::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
112 {
113 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld)
114 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, IsolatedWorld)
115 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, WorkerWorld);
116 } 110 }
117 111
118 v8::Handle<v8::Object> V8TestInterfaceEmpty::createWrapper(PassRefPtr<TestInterf aceEmpty> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 112 v8::Handle<v8::Object> V8TestInterfaceEmpty::createWrapper(PassRefPtr<TestInterf aceEmpty> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
119 { 113 {
120 ASSERT(impl); 114 ASSERT(impl);
121 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEmpty>(impl.get(), isol ate)); 115 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEmpty>(impl.get(), isol ate));
122 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 116 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
123 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 117 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
124 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 118 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
125 // the same object de-ref functions, though, so use that as the basis of the check. 119 // the same object de-ref functions, though, so use that as the basis of the check.
(...skipping 14 matching lines...) Expand all
140 fromInternalPointer(object)->deref(); 134 fromInternalPointer(object)->deref();
141 } 135 }
142 136
143 template<> 137 template<>
144 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEmpty* impl, v8::Handle<v8::Obje ct> creationContext, v8::Isolate* isolate) 138 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEmpty* impl, v8::Handle<v8::Obje ct> creationContext, v8::Isolate* isolate)
145 { 139 {
146 return toV8(impl, creationContext, isolate); 140 return toV8(impl, creationContext, isolate);
147 } 141 }
148 142
149 } // namespace WebCore 143 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfaceEmpty.h ('k') | Source/bindings/tests/results/V8TestInterfaceEventConstructor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698