Index: ppapi/cpp/output_traits.h |
diff --git a/ppapi/cpp/output_traits.h b/ppapi/cpp/output_traits.h |
index 1779e7aaaf51764beb573cbbf00b14e3e3266508..37a8a656e12df16e231121c92d1594597eb34ab6 100644 |
--- a/ppapi/cpp/output_traits.h |
+++ b/ppapi/cpp/output_traits.h |
@@ -85,6 +85,10 @@ struct GenericCallbackOutputTraits { |
// callbacks. This doesn't actually need to do anything in this case, |
// it's needed for some of more complex template specializations below. |
static inline T& StorageToPluginArg(StorageType& t) { return t; } |
+ |
+ // Initializes the "storage type" to a default value, if necessary. Here, |
+ // we do nothing, assuming that the default constructor for T suffices. |
+ static inline void Initialize(StorageType* /* t */) {} |
}; |
// Output traits for all resource types. It is implemented to pass a |
@@ -113,6 +117,10 @@ struct ResourceCallbackOutputTraits { |
static inline T StorageToPluginArg(StorageType& t) { |
return T(PASS_REF, t); |
} |
+ |
+ static inline void Initialize(StorageType* t) { |
+ *t = 0; |
+ } |
}; |
// The general templatized base class for all CallbackOutputTraits. This class |
@@ -147,6 +155,10 @@ struct CallbackOutputTraits<Var> { |
static inline pp::Var StorageToPluginArg(StorageType& t) { |
return Var(PASS_REF, t); |
} |
+ |
+ static inline void Initialize(StorageType* t) { |
+ *t = PP_MakeUndefined(); |
+ } |
}; |
// Array output parameters ----------------------------------------------------- |
@@ -175,6 +187,8 @@ struct GenericVectorCallbackOutputTraits { |
static inline std::vector<T>& StorageToPluginArg(StorageType& t) { |
return t.output(); |
} |
+ |
+ static inline void Initialize(StorageType* /* t */) {} |
}; |
// Output traits for all vectors of resource types. It is implemented to pass |
@@ -196,6 +210,8 @@ struct ResourceVectorCallbackOutputTraits { |
static inline std::vector<T>& StorageToPluginArg(StorageType& t) { |
return t.output(); |
} |
+ |
+ static inline void Initialize(StorageType* /* t */) {} |
}; |
// Specialization of CallbackOutputTraits for vectors. This struct covers both |
@@ -233,6 +249,8 @@ struct CallbackOutputTraits< std::vector<pp::Var> > { |
static inline std::vector<pp::Var>& StorageToPluginArg(StorageType& t) { |
return t.output(); |
} |
+ |
+ static inline void Initialize(StorageType* /* t */) {} |
}; |
} // namespace internal |