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

Unified Diff: include/v8.h

Issue 240013004: Prevent calls to ReturnValue::Set with pointer-valued types. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 4d99d151522b98b22d8d10fc2ec5e2f0b77e7798..ceb57c0abd3cafc1d228da2d8efbd72ee324d02f 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -2458,6 +2458,9 @@ class ReturnValue {
// Convenience getter for Isolate
V8_INLINE Isolate* GetIsolate();
+ // Pointer setter: Uncompilable to prevent inadvertent misuse.
+ void Set(void* whatever);
+
private:
template<class F> friend class ReturnValue;
template<class F> friend class FunctionCallbackInfo;
@@ -5981,6 +5984,12 @@ Isolate* ReturnValue<T>::GetIsolate() {
}
template<typename T>
+void ReturnValue<T>::Set(void* whatever) {
+ // Uncompilable to prevent inadvertent misuse.
+ TYPE_CHECK(void*, Primitive);
+}
+
+template<typename T>
internal::Object* ReturnValue<T>::GetDefaultValue() {
// Default value is always the pointer below value_ on the stack.
return value_[-1];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698