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

Unified Diff: ppapi/cpp/file_system.cc

Issue 52233002: [PPAPI] Added VarResource_Dev class. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix Windows compile. Created 7 years, 1 month 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/file_system.h ('k') | ppapi/cpp/resource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/file_system.cc
diff --git a/ppapi/cpp/file_system.cc b/ppapi/cpp/file_system.cc
index f993fdaa892459a036ff94192b5fd5460373ba08..8bd86d0eefdc8a9279953b39a6e79bceda6b32c4 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
« no previous file with comments | « ppapi/cpp/file_system.h ('k') | ppapi/cpp/resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698