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

Side by Side Diff: Source/bindings/tests/results/V8TestInterfaceDoNotCheckConstants.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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return result->value.newLocal(isolate); 101 return result->value.newLocal(isolate);
102 102
103 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 103 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
104 v8::EscapableHandleScope handleScope(isolate); 104 v8::EscapableHandleScope handleScope(isolate);
105 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode); 105 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
106 configureV8TestInterfaceDoNotCheckConstantsTemplate(templ, isolate, currentW orldType); 106 configureV8TestInterfaceDoNotCheckConstantsTemplate(templ, isolate, currentW orldType);
107 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 107 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
108 return handleScope.Escape(templ); 108 return handleScope.Escape(templ);
109 } 109 }
110 110
111 bool V8TestInterfaceDoNotCheckConstants::hasInstance(v8::Handle<v8::Value> jsVal ue, v8::Isolate* isolate, WrapperWorldType currentWorldType) 111 bool V8TestInterfaceDoNotCheckConstants::hasInstance(v8::Handle<v8::Value> jsVal ue, v8::Isolate* isolate)
112 { 112 {
113 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 113 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
114 } 114 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
115
116 bool V8TestInterfaceDoNotCheckConstants::hasInstanceInAnyWorld(v8::Handle<v8::Va lue> jsValue, v8::Isolate* isolate)
117 {
118 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, MainWorld)
119 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, IsolatedWorld)
120 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, WorkerWorld);
121 } 115 }
122 116
123 v8::Handle<v8::Object> V8TestInterfaceDoNotCheckConstants::createWrapper(PassRef Ptr<TestInterfaceDoNotCheckConstants> impl, v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) 117 v8::Handle<v8::Object> V8TestInterfaceDoNotCheckConstants::createWrapper(PassRef Ptr<TestInterfaceDoNotCheckConstants> impl, v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate)
124 { 118 {
125 ASSERT(impl); 119 ASSERT(impl);
126 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceDoNotCheckConstants>(im pl.get(), isolate)); 120 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceDoNotCheckConstants>(im pl.get(), isolate));
127 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 121 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
128 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 122 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
129 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 123 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
130 // the same object de-ref functions, though, so use that as the basis of the check. 124 // the same object de-ref functions, though, so use that as the basis of the check.
(...skipping 14 matching lines...) Expand all
145 fromInternalPointer(object)->deref(); 139 fromInternalPointer(object)->deref();
146 } 140 }
147 141
148 template<> 142 template<>
149 v8::Handle<v8::Value> toV8NoInline(TestInterfaceDoNotCheckConstants* impl, v8::H andle<v8::Object> creationContext, v8::Isolate* isolate) 143 v8::Handle<v8::Value> toV8NoInline(TestInterfaceDoNotCheckConstants* impl, v8::H andle<v8::Object> creationContext, v8::Isolate* isolate)
150 { 144 {
151 return toV8(impl, creationContext, isolate); 145 return toV8(impl, creationContext, isolate);
152 } 146 }
153 147
154 } // namespace WebCore 148 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698