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

Side by Side Diff: Source/bindings/tests/results/V8TestSpecialOperationsNotEnumerable.cpp

Issue 171533006: V8 Binding: Introduce toNativeWithTypeCheck (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 144 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
145 return handleScope.Escape(templ); 145 return handleScope.Escape(templ);
146 } 146 }
147 147
148 bool V8TestSpecialOperationsNotEnumerable::hasInstance(v8::Handle<v8::Value> jsV alue, v8::Isolate* isolate) 148 bool V8TestSpecialOperationsNotEnumerable::hasInstance(v8::Handle<v8::Value> jsV alue, v8::Isolate* isolate)
149 { 149 {
150 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue) 150 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
151 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue); 151 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
152 } 152 }
153 153
154 TestSpecialOperationsNotEnumerable* V8TestSpecialOperationsNotEnumerable::toNati veWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
155 {
156 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
157 }
158
154 v8::Handle<v8::Object> V8TestSpecialOperationsNotEnumerable::createWrapper(PassR efPtr<TestSpecialOperationsNotEnumerable> impl, v8::Handle<v8::Object> creationC ontext, v8::Isolate* isolate) 159 v8::Handle<v8::Object> V8TestSpecialOperationsNotEnumerable::createWrapper(PassR efPtr<TestSpecialOperationsNotEnumerable> impl, v8::Handle<v8::Object> creationC ontext, v8::Isolate* isolate)
155 { 160 {
156 ASSERT(impl); 161 ASSERT(impl);
157 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsNotEnumerable>( impl.get(), isolate)); 162 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsNotEnumerable>( impl.get(), isolate));
158 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 163 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
159 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 164 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
160 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 165 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
161 // the same object de-ref functions, though, so use that as the basis of the check. 166 // the same object de-ref functions, though, so use that as the basis of the check.
162 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); 167 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
163 } 168 }
(...skipping 12 matching lines...) Expand all
176 fromInternalPointer(object)->deref(); 181 fromInternalPointer(object)->deref();
177 } 182 }
178 183
179 template<> 184 template<>
180 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsNotEnumerable* impl, v8: :Handle<v8::Object> creationContext, v8::Isolate* isolate) 185 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsNotEnumerable* impl, v8: :Handle<v8::Object> creationContext, v8::Isolate* isolate)
181 { 186 {
182 return toV8(impl, creationContext, isolate); 187 return toV8(impl, creationContext, isolate);
183 } 188 }
184 189
185 } // namespace WebCore 190 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698