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

Unified Diff: Source/bindings/core/v8/ScriptWrappable.h

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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/core/v8/ScriptWrappable.h
diff --git a/Source/bindings/core/v8/ScriptWrappable.h b/Source/bindings/core/v8/ScriptWrappable.h
index bec774b3141785d7a83011dcbd45b3c260672c94..463e6b1af2a30dbd28caf26727f6b4834bf2b7fc 100644
--- a/Source/bindings/core/v8/ScriptWrappable.h
+++ b/Source/bindings/core/v8/ScriptWrappable.h
@@ -57,16 +57,16 @@ namespace blink {
*/
class ScriptWrappableBase {
public:
- template <class T> static T* fromInternalPointer(void* internalPointer)
+ template <class T> static T* fromInternalPointer(ScriptWrappableBase* internalPointer)
{
// Check if T* is castable to ScriptWrappableBase*, which means T
// doesn't have two or more ScriptWrappableBase as superclasses.
// If T has two ScriptWrappableBase as superclasses, conversions
// from T* to ScriptWrappableBase* are ambiguous.
- ASSERT(static_cast<ScriptWrappableBase*>(static_cast<T*>(static_cast<ScriptWrappableBase*>(internalPointer))));
- return static_cast<T*>(static_cast<ScriptWrappableBase*>(internalPointer));
+ ASSERT(static_cast<ScriptWrappableBase*>(static_cast<T*>(internalPointer)));
+ return static_cast<T*>(internalPointer);
}
- void* toInternalPointer() { return this; }
+ ScriptWrappableBase* toInternalPointer() { return this; }
};
/**

Powered by Google App Engine
This is Rietveld 408576698