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

Unified Diff: include/v8.h

Issue 279883002: 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, 7 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 72dc75d42a057086cf17b24c6503a6fbe424e29a..f4ae71d43cfc2d679b9c76b210b5861d14858a69 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -2429,6 +2429,10 @@ class ReturnValue {
// Convenience getter for Isolate
V8_INLINE Isolate* GetIsolate();
+ // Pointer setter: Uncompilable to prevent inadvertent misuse.
+ template <typename S>
+ V8_INLINE void Set(S* whatever);
+
private:
template<class F> friend class ReturnValue;
template<class F> friend class FunctionCallbackInfo;
@@ -5974,6 +5978,13 @@ Isolate* ReturnValue<T>::GetIsolate() {
}
template<typename T>
+template<typename S>
+void ReturnValue<T>::Set(S* whatever) {
+ // Uncompilable to prevent inadvertent misuse.
+ TYPE_CHECK(S*, 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