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

Side by Side 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: Respond to reviews, and add FileSystem methods. 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 unified diff | Download patch
« no previous file with comments | « ppapi/cpp/file_system.h ('k') | ppapi/cpp/resource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/cpp/file_system.h" 5 #include "ppapi/cpp/file_system.h"
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_file_system.h" 8 #include "ppapi/c/ppb_file_system.h"
9 #include "ppapi/cpp/completion_callback.h" 9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/file_ref.h" 10 #include "ppapi/cpp/file_ref.h"
(...skipping 10 matching lines...) Expand all
21 } 21 }
22 22
23 } // namespace 23 } // namespace
24 24
25 FileSystem::FileSystem() { 25 FileSystem::FileSystem() {
26 } 26 }
27 27
28 FileSystem::FileSystem(const FileSystem& other) : Resource(other) { 28 FileSystem::FileSystem(const FileSystem& other) : Resource(other) {
29 } 29 }
30 30
31 FileSystem::FileSystem(Resource resource) : Resource(resource) {
32 PP_DCHECK(ResourceIsFileSystem(resource));
dmichael (off chromium) 2013/10/31 16:48:56 Let's make the Resource a "Null" one in this case
Matt Giuca 2013/10/31 23:24:43 Done. Note: I added Clear() as a protected method
33 }
34
31 FileSystem::FileSystem(PassRef, PP_Resource resource) 35 FileSystem::FileSystem(PassRef, PP_Resource resource)
32 : Resource(PASS_REF, resource) { 36 : Resource(PASS_REF, resource) {
33 } 37 }
34 38
35 FileSystem::FileSystem(const InstanceHandle& instance, 39 FileSystem::FileSystem(const InstanceHandle& instance,
36 PP_FileSystemType type) { 40 PP_FileSystemType type) {
37 if (!has_interface<PPB_FileSystem_1_0>()) 41 if (!has_interface<PPB_FileSystem_1_0>())
38 return; 42 return;
39 PassRefFromConstructor(get_interface<PPB_FileSystem_1_0>()->Create( 43 PassRefFromConstructor(get_interface<PPB_FileSystem_1_0>()->Create(
40 instance.pp_instance(), type)); 44 instance.pp_instance(), type));
41 } 45 }
42 46
43 int32_t FileSystem::Open(int64_t expected_size, 47 int32_t FileSystem::Open(int64_t expected_size,
44 const CompletionCallback& cc) { 48 const CompletionCallback& cc) {
45 if (!has_interface<PPB_FileSystem_1_0>()) 49 if (!has_interface<PPB_FileSystem_1_0>())
46 return cc.MayForce(PP_ERROR_NOINTERFACE); 50 return cc.MayForce(PP_ERROR_NOINTERFACE);
47 return get_interface<PPB_FileSystem_1_0>()->Open( 51 return get_interface<PPB_FileSystem_1_0>()->Open(
48 pp_resource(), expected_size, cc.pp_completion_callback()); 52 pp_resource(), expected_size, cc.pp_completion_callback());
49 } 53 }
50 54
55 // static
56 bool FileSystem::ResourceIsFileSystem(const Resource& resource) {
57 if (!has_interface<PPB_FileSystem_1_0>())
58 return false;
59 return get_interface<PPB_FileSystem_1_0>()->IsFileSystem(
60 resource.pp_resource());
61 }
62
51 } // namespace pp 63 } // namespace pp
OLDNEW
« 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