diff options
Diffstat (limited to 'ppapi/cpp')
-rw-r--r-- | ppapi/cpp/dev/truetype_font_dev.h | 8 | ||||
-rw-r--r-- | ppapi/cpp/directory_entry.h | 2 | ||||
-rw-r--r-- | ppapi/cpp/extensions/ext_output_traits.h | 4 | ||||
-rw-r--r-- | ppapi/cpp/output_traits.h | 18 | ||||
-rw-r--r-- | ppapi/cpp/private/pass_file_handle.h | 6 | ||||
-rw-r--r-- | ppapi/cpp/private/video_frame_private.h | 7 |
6 files changed, 45 insertions, 0 deletions
diff --git a/ppapi/cpp/dev/truetype_font_dev.h b/ppapi/cpp/dev/truetype_font_dev.h index cdaeade..bd554f7 100644 --- a/ppapi/cpp/dev/truetype_font_dev.h +++ b/ppapi/cpp/dev/truetype_font_dev.h @@ -208,6 +208,12 @@ struct CallbackOutputTraits<TrueTypeFontDesc_Dev> { static inline TrueTypeFontDesc_Dev StorageToPluginArg(StorageType& t) { return TrueTypeFontDesc_Dev(PASS_REF, t); } + + static inline void Initialize(StorageType* t) { + // Use the same defaults as TrueTypeFontDesc_Dev does. + TrueTypeFontDesc_Dev dummy; + *t = dummy.pp_desc(); + } }; class TrueTypeFontDescArrayOutputAdapterWithStorage @@ -255,6 +261,8 @@ struct CallbackOutputTraits< std::vector<TrueTypeFontDesc_Dev> > { StorageType& t) { return t.output(); } + + static inline void Initialize(StorageType* /* t */) {} }; } // namespace internal diff --git a/ppapi/cpp/directory_entry.h b/ppapi/cpp/directory_entry.h index 81be79e..bf3d845 100644 --- a/ppapi/cpp/directory_entry.h +++ b/ppapi/cpp/directory_entry.h @@ -119,6 +119,8 @@ struct CallbackOutputTraits< std::vector<DirectoryEntry> > { StorageType& t) { return t.output(); } + + static inline void Initialize(StorageType* /* t */) {} }; } // namespace internal diff --git a/ppapi/cpp/extensions/ext_output_traits.h b/ppapi/cpp/extensions/ext_output_traits.h index 08dc744c..ed57be1 100644 --- a/ppapi/cpp/extensions/ext_output_traits.h +++ b/ppapi/cpp/extensions/ext_output_traits.h @@ -68,6 +68,8 @@ struct ExtCallbackOutputTraits { static inline T& StorageToPluginArg(StorageType& t) { return t.output(); } + + static inline void Initialize(StorageType* /* t */) {} }; // This class provides storage for a PP_Var and a vector of objects which are @@ -129,6 +131,8 @@ struct ExtCallbackOutputTraits< std::vector<T> > { static inline std::vector<T>& StorageToPluginArg(StorageType& t) { return t.output(); } + + static inline void Initialize(StorageType* /* t */) {} }; } // namespace internal diff --git a/ppapi/cpp/output_traits.h b/ppapi/cpp/output_traits.h index 1779e7a..37a8a65 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 diff --git a/ppapi/cpp/private/pass_file_handle.h b/ppapi/cpp/private/pass_file_handle.h index 53f32dd..c25353b 100644 --- a/ppapi/cpp/private/pass_file_handle.h +++ b/ppapi/cpp/private/pass_file_handle.h @@ -5,6 +5,8 @@ #ifndef PPAPI_CPP_PRIVATE_PASS_FILE_HANDLE_H_ #define PPAPI_CPP_PRIVATE_PASS_FILE_HANDLE_H_ +#include <string.h> + #include "ppapi/c/private/pp_file_handle.h" #include "ppapi/cpp/output_traits.h" @@ -67,6 +69,10 @@ struct CallbackOutputTraits<PassFileHandle> { static inline PassFileHandle StorageToPluginArg(StorageType& t) { return PassFileHandle(t); } + + static inline void Initialize(StorageType* t) { + memset(t, 0, sizeof(*t)); + } }; } // namespace internal diff --git a/ppapi/cpp/private/video_frame_private.h b/ppapi/cpp/private/video_frame_private.h index fed9d1d..7413876 100644 --- a/ppapi/cpp/private/video_frame_private.h +++ b/ppapi/cpp/private/video_frame_private.h @@ -5,6 +5,8 @@ #ifndef PPAPI_CPP_PRIVATE_VIDEO_FRAME_PRIVATE_H_ #define PPAPI_CPP_PRIVATE_VIDEO_FRAME_PRIVATE_H_ +#include <string.h> + #include "ppapi/c/pp_time.h" #include "ppapi/c/private/pp_video_frame_private.h" #include "ppapi/cpp/completion_callback.h" @@ -87,6 +89,11 @@ struct CallbackOutputTraits<pp::VideoFrame_Private> { static inline pp::VideoFrame_Private StorageToPluginArg(StorageType& t) { return pp::VideoFrame_Private(PASS_REF, t); } + + static inline void Initialize(StorageType* t) { + VideoFrame_Private dummy; + *t = dummy.pp_video_frame(); + } }; } // namespace internal |