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

Unified Diff: ppapi/cpp/output_traits.h

Issue 18611004: PPAPI: Initialize CompletionCallbackWithOutput storage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 7 years, 5 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 | « ppapi/cpp/extensions/ext_output_traits.h ('k') | ppapi/cpp/private/pass_file_handle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ppapi/cpp/extensions/ext_output_traits.h ('k') | ppapi/cpp/private/pass_file_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698