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

Side by Side Diff: Source/bindings/core/v8/V8NPObject.cpp

Issue 456683002: bindings: Introduces type-check for the internal pointers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 461
462 // FIXME: Move staticNPObjectMap() to DOMDataStore. 462 // FIXME: Move staticNPObjectMap() to DOMDataStore.
463 // Use V8DOMWrapper::createWrapper() and 463 // Use V8DOMWrapper::createWrapper() and
464 // V8DOMWrapper::associateObjectWithWrapper() 464 // V8DOMWrapper::associateObjectWithWrapper()
465 // to create a wrapper object. 465 // to create a wrapper object.
466 v8::Handle<v8::Function> v8Function = npObjectDesc.Get(isolate)->GetFunction (); 466 v8::Handle<v8::Function> v8Function = npObjectDesc.Get(isolate)->GetFunction ();
467 v8::Local<v8::Object> value = V8ObjectConstructor::newInstance(isolate, v8Fu nction); 467 v8::Local<v8::Object> value = V8ObjectConstructor::newInstance(isolate, v8Fu nction);
468 if (value.IsEmpty()) 468 if (value.IsEmpty())
469 return value; 469 return value;
470 470
471 V8DOMWrapper::setNativeInfo(value, npObjectTypeInfo(), object); 471 V8DOMWrapper::setNativeInfo(value, npObjectTypeInfo(), npObjectToInternalPoi nter(object));
472 472
473 // KJS retains the object as part of its wrapper (see Bindings::CInstance). 473 // KJS retains the object as part of its wrapper (see Bindings::CInstance).
474 _NPN_RetainObject(object); 474 _NPN_RetainObject(object);
475 _NPN_RegisterObject(object, root); 475 _NPN_RegisterObject(object, root);
476 476
477 WrapperConfiguration configuration = buildWrapperConfiguration(object, Wrapp erConfiguration::Dependent); 477 WrapperConfiguration configuration = buildWrapperConfiguration(object, Wrapp erConfiguration::Dependent);
478 staticNPObjectMap().set(object, value, configuration); 478 staticNPObjectMap().set(object, value, configuration);
479 ASSERT(V8DOMWrapper::isDOMWrapper(value)); 479 ASSERT(V8DOMWrapper::isDOMWrapper(value));
480 return value; 480 return value;
481 } 481 }
482 482
483 void forgetV8ObjectForNPObject(NPObject* object) 483 void forgetV8ObjectForNPObject(NPObject* object)
484 { 484 {
485 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 485 v8::Isolate* isolate = v8::Isolate::GetCurrent();
486 v8::HandleScope scope(isolate); 486 v8::HandleScope scope(isolate);
487 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat e); 487 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat e);
488 if (!wrapper.IsEmpty()) { 488 if (!wrapper.IsEmpty()) {
489 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo()); 489 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo());
490 staticNPObjectMap().removeAndDispose(object); 490 staticNPObjectMap().removeAndDispose(object);
491 _NPN_ReleaseObject(object); 491 _NPN_ReleaseObject(object);
492 } 492 }
493 } 493 }
494 494
495 } // namespace blink 495 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698