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

Side by Side Diff: Source/bindings/tests/results/V8TestSpecialOperationsAnonymous.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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 256 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
257 return handleScope.Escape(templ); 257 return handleScope.Escape(templ);
258 } 258 }
259 259
260 bool V8TestSpecialOperationsAnonymous::hasInstance(v8::Handle<v8::Value> jsValue , v8::Isolate* isolate) 260 bool V8TestSpecialOperationsAnonymous::hasInstance(v8::Handle<v8::Value> jsValue , v8::Isolate* isolate)
261 { 261 {
262 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue) 262 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
263 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue); 263 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
264 } 264 }
265 265
266 TestSpecialOperationsAnonymous* V8TestSpecialOperationsAnonymous::toNativeWithTy peCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
267 {
268 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
269 }
270
266 v8::Handle<v8::Object> V8TestSpecialOperationsAnonymous::createWrapper(PassRefPt r<TestSpecialOperationsAnonymous> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 271 v8::Handle<v8::Object> V8TestSpecialOperationsAnonymous::createWrapper(PassRefPt r<TestSpecialOperationsAnonymous> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
267 { 272 {
268 ASSERT(impl); 273 ASSERT(impl);
269 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsAnonymous>(impl .get(), isolate)); 274 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsAnonymous>(impl .get(), isolate));
270 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 275 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
271 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 276 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
272 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 277 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
273 // the same object de-ref functions, though, so use that as the basis of the check. 278 // the same object de-ref functions, though, so use that as the basis of the check.
274 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); 279 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
275 } 280 }
(...skipping 12 matching lines...) Expand all
288 fromInternalPointer(object)->deref(); 293 fromInternalPointer(object)->deref();
289 } 294 }
290 295
291 template<> 296 template<>
292 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsAnonymous* impl, v8::Han dle<v8::Object> creationContext, v8::Isolate* isolate) 297 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsAnonymous* impl, v8::Han dle<v8::Object> creationContext, v8::Isolate* isolate)
293 { 298 {
294 return toV8(impl, creationContext, isolate); 299 return toV8(impl, creationContext, isolate);
295 } 300 }
296 301
297 } // namespace WebCore 302 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698