diff options
author | nhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-05 06:13:30 +0000 |
---|---|---|
committer | nhiroki@chromium.org <nhiroki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-05 06:13:30 +0000 |
commit | 5445a1e82312f687d45681dce5b38c3dec72983c (patch) | |
tree | 85b482a01ef8e6f0cf9c95b12295986434aa4b60 /ppapi/cpp/output_traits.h | |
parent | cbc8a45c3bb4009b3843bd15bf46e2aff9286d04 (diff) | |
download | chromium_src-5445a1e82312f687d45681dce5b38c3dec72983c.zip chromium_src-5445a1e82312f687d45681dce5b38c3dec72983c.tar.gz chromium_src-5445a1e82312f687d45681dce5b38c3dec72983c.tar.bz2 |
[Retry] Implement ReadEntries API for PPB_DirectoryReader
The ReadEntries API returns all file entries in the given directory at once.
This CL includes:
- Implementing the ReadEntries API.
- Removing the GetNextEntry API.
- Modifying the nacl_io library since the library uses the GetNextEntry API.
Original review: https://codereview.chromium.org/12090071/
BUG=113086
TEST=browser_tests --gtest_filter=\*DirectoryReader\*
TBR=yzshen1,dmichael
Review URL: https://chromiumcodereview.appspot.com/12378062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186112 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp/output_traits.h')
-rw-r--r-- | ppapi/cpp/output_traits.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ppapi/cpp/output_traits.h b/ppapi/cpp/output_traits.h index 5b45aa47e..cc04330 100644 --- a/ppapi/cpp/output_traits.h +++ b/ppapi/cpp/output_traits.h @@ -5,8 +5,11 @@ #ifndef PPAPI_CPP_OUTPUT_TRAITS_H_ #define PPAPI_CPP_OUTPUT_TRAITS_H_ +#include <vector> + #include "ppapi/c/pp_resource.h" #include "ppapi/cpp/array_output.h" +#include "ppapi/cpp/dev/directory_entry_dev.h" /// @file /// This file defines internal templates for defining how data is passed to the @@ -233,6 +236,24 @@ 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 |