diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-01 22:16:43 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-01 22:16:43 +0000 |
commit | 60accc164fc11eb2b146cfaf009152ee1017d64b (patch) | |
tree | 9d9c151f06def929f5661e2d728a2a03a000eb96 /ppapi/cpp/file_system.cc | |
parent | ec66d1efde8f062599447c1b74b656ac5449fd5d (diff) | |
download | chromium_src-60accc164fc11eb2b146cfaf009152ee1017d64b.zip chromium_src-60accc164fc11eb2b146cfaf009152ee1017d64b.tar.gz chromium_src-60accc164fc11eb2b146cfaf009152ee1017d64b.tar.bz2 |
[PPAPI] Added pp::VarResource_Dev class.
This is a C++ wrapper for the C API PPB_VarResource_Dev.
Also added methods to pp::FileSystem for converting a pp::Resource to a
pp::FileSystem, which are necessary for making use of a resource
extracted using pp::VarResource_Dev.
(Committed by yzshen@chromium.org on behalf of mgiuca@chromium.org)
BUG=177017
R=dmichael@chromium.org, noelallen@chromium.org, noelallen@google.com, yzshen@chromium.org
Review URL: https://codereview.chromium.org/52233002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232482 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp/file_system.cc')
-rw-r--r-- | ppapi/cpp/file_system.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ppapi/cpp/file_system.cc b/ppapi/cpp/file_system.cc index f993fda..8bd86d0 100644 --- a/ppapi/cpp/file_system.cc +++ b/ppapi/cpp/file_system.cc @@ -9,6 +9,7 @@ #include "ppapi/cpp/completion_callback.h" #include "ppapi/cpp/file_ref.h" #include "ppapi/cpp/instance_handle.h" +#include "ppapi/cpp/logging.h" #include "ppapi/cpp/module.h" #include "ppapi/cpp/module_impl.h" @@ -28,6 +29,15 @@ FileSystem::FileSystem() { FileSystem::FileSystem(const FileSystem& other) : Resource(other) { } +FileSystem::FileSystem(const Resource& resource) : Resource(resource) { + if (!IsFileSystem(resource)) { + PP_NOTREACHED(); + + // On release builds, set this to null. + Clear(); + } +} + FileSystem::FileSystem(PassRef, PP_Resource resource) : Resource(PASS_REF, resource) { } @@ -48,4 +58,12 @@ int32_t FileSystem::Open(int64_t expected_size, pp_resource(), expected_size, cc.pp_completion_callback()); } +// static +bool FileSystem::IsFileSystem(const Resource& resource) { + if (!has_interface<PPB_FileSystem_1_0>()) + return false; + return get_interface<PPB_FileSystem_1_0>()->IsFileSystem( + resource.pp_resource()) == PP_TRUE; +} + } // namespace pp |