summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp/output_traits.h
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-01 16:56:45 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-01 16:56:45 +0000
commitbab93c1c832a6fd66e574dd4732b27c6a8e254ed (patch)
tree00af907817c39c6e9ed8e22c8e7d7e2b28586813 /ppapi/cpp/output_traits.h
parent83ad1c47f14cce065228d5dafee4dc1a81d40d77 (diff)
downloadchromium_src-bab93c1c832a6fd66e574dd4732b27c6a8e254ed.zip
chromium_src-bab93c1c832a6fd66e574dd4732b27c6a8e254ed.tar.gz
chromium_src-bab93c1c832a6fd66e574dd4732b27c6a8e254ed.tar.bz2
Introduce ExtCompletionCallbackWithOutput to support Pepper APIs in pp::ext.
This change is necessary because apps V2 APIs always use PP_Var* as output parameter type (even for POD or resources). This behavior is different from CompletionCallbackWithOutput. BUG=226303 TEST=None Review URL: https://chromiumcodereview.appspot.com/14189017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197639 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp/output_traits.h')
-rw-r--r--ppapi/cpp/output_traits.h62
1 files changed, 17 insertions, 45 deletions
diff --git a/ppapi/cpp/output_traits.h b/ppapi/cpp/output_traits.h
index 889c612..1779e7a 100644
--- a/ppapi/cpp/output_traits.h
+++ b/ppapi/cpp/output_traits.h
@@ -9,8 +9,6 @@
#include "ppapi/c/pp_resource.h"
#include "ppapi/cpp/array_output.h"
-#include "ppapi/cpp/dev/directory_entry_dev.h"
-#include "ppapi/cpp/extensions/ext_output_traits.h"
#include "ppapi/cpp/resource.h"
/// @file
@@ -118,20 +116,16 @@ struct ResourceCallbackOutputTraits {
};
// The general templatized base class for all CallbackOutputTraits. This class
-// covers resources, extensions API output objects and POD (ints, structs, etc.)
-// by inheriting from the appropriate base class depending on whether the given
-// type derives from pp::Resource or ext::internal::OutputObjectBase. This trick
-// allows us to do this once rather than writing specializations for every
-// object type.
+// covers both resources and POD (ints, structs, etc.) by inheriting from the
+// appropriate base class depending on whether the given type derives from
+// pp::Resource. This trick allows us to do this once rather than writing
+// specializations for every resource object type.
template<typename T>
struct CallbackOutputTraits
- : public InheritIf<ResourceCallbackOutputTraits<T>,
- IsBaseOf<Resource, T>::value>,
- public InheritIf<ext::internal::ExtensionsCallbackOutputTraits<T>,
- IsBaseOf<ext::internal::OutputObjectBase, T>::value>,
- public InheritIf<GenericCallbackOutputTraits<T>,
- !IsBaseOf<Resource, T>::value &&
- !IsBaseOf<ext::internal::OutputObjectBase, T>::value> {
+ : public InheritIf<GenericCallbackOutputTraits<T>,
+ !IsBaseOf<Resource, T>::value>,
+ public InheritIf<ResourceCallbackOutputTraits<T>,
+ IsBaseOf<Resource, T>::value> {
};
// A specialization of CallbackOutputTraits for pp::Var output parameters.
@@ -204,21 +198,17 @@ struct ResourceVectorCallbackOutputTraits {
}
};
-// Specialization of CallbackOutputTraits for vectors. This struct covers arrays
-// of resources, extensions API output objects and POD (ints, structs, etc.) by
-// inheriting from the appropriate base class depending on whether the given
-// type derives from pp::Resource or ext::internal::OutputObjectBase. This trick
-// allows us to do this once rather than writing specializations for every
-// object type.
+// Specialization of CallbackOutputTraits for vectors. This struct covers both
+// arrays of resources and arrays of POD (ints, structs, etc.) by inheriting
+// from the appropriate base class depending on whether the given type derives
+// from pp::Resource. This trick allows us to do this once rather than writing
+// specializations for every resource object type.
template<typename T>
struct CallbackOutputTraits< std::vector<T> >
- : public InheritIf<ResourceVectorCallbackOutputTraits<T>,
- IsBaseOf<Resource, T>::value>,
- public InheritIf<ext::internal::ExtensionsVectorCallbackOutputTraits<T>,
- IsBaseOf<ext::internal::OutputObjectBase, T>::value>,
- public InheritIf<GenericVectorCallbackOutputTraits<T>,
- !IsBaseOf<Resource, T>::value &&
- !IsBaseOf<ext::internal::OutputObjectBase, T>::value> {
+ : public InheritIf<GenericVectorCallbackOutputTraits<T>,
+ !IsBaseOf<Resource, T>::value>,
+ public InheritIf<ResourceVectorCallbackOutputTraits<T>,
+ IsBaseOf<Resource, T>::value> {
};
// A specialization of CallbackOutputTraits to provide the callback system
@@ -245,24 +235,6 @@ struct CallbackOutputTraits< std::vector<pp::Var> > {
}
};
-// A specialization of CallbackOutputTraits to provide the callback system the
-// information on how to handle vectors of pp::DirectoryEntry_Dev. This converts
-// PP_DirectoryEntry_Dev to pp::DirectoryEntry_Dev when passing to the plugin.
-template<>
-struct CallbackOutputTraits< std::vector<pp::DirectoryEntry_Dev> > {
- typedef PP_ArrayOutput APIArgType;
- typedef DirectoryEntryArrayOutputAdapterWithStorage StorageType;
-
- static inline APIArgType StorageToAPIArg(StorageType& t) {
- return t.pp_array_output();
- }
-
- static inline std::vector<pp::DirectoryEntry_Dev>& StorageToPluginArg(
- StorageType& t) {
- return t.output();
- }
-};
-
} // namespace internal
} // namespace pp