OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_io.h" | 5 #include "ppapi/cpp/file_io.h" |
6 | 6 |
7 #include "ppapi/c/ppb_file_io.h" | 7 #include "ppapi/c/ppb_file_io.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.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" |
11 #include "ppapi/cpp/instance.h" | 11 #include "ppapi/cpp/instance_handle.h" |
12 #include "ppapi/cpp/module.h" | 12 #include "ppapi/cpp/module.h" |
13 #include "ppapi/cpp/module_impl.h" | 13 #include "ppapi/cpp/module_impl.h" |
14 | 14 |
15 namespace pp { | 15 namespace pp { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 template <> const char* interface_name<PPB_FileIO>() { | 19 template <> const char* interface_name<PPB_FileIO>() { |
20 return PPB_FILEIO_INTERFACE; | 20 return PPB_FILEIO_INTERFACE; |
21 } | 21 } |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 FileIO::FileIO() { | 25 FileIO::FileIO() { |
26 } | 26 } |
27 | 27 |
28 FileIO::FileIO(Instance* instance) { | 28 FileIO::FileIO(const InstanceHandle& instance) { |
29 if (!has_interface<PPB_FileIO>()) | 29 if (!has_interface<PPB_FileIO>()) |
30 return; | 30 return; |
31 PassRefFromConstructor(get_interface<PPB_FileIO>()->Create( | 31 PassRefFromConstructor(get_interface<PPB_FileIO>()->Create( |
32 instance->pp_instance())); | 32 instance.pp_instance())); |
33 } | 33 } |
34 | 34 |
35 FileIO::FileIO(const FileIO& other) | 35 FileIO::FileIO(const FileIO& other) |
36 : Resource(other) { | 36 : Resource(other) { |
37 } | 37 } |
38 | 38 |
39 int32_t FileIO::Open(const FileRef& file_ref, | 39 int32_t FileIO::Open(const FileRef& file_ref, |
40 int32_t open_flags, | 40 int32_t open_flags, |
41 const CompletionCallback& cc) { | 41 const CompletionCallback& cc) { |
42 if (!has_interface<PPB_FileIO>()) | 42 if (!has_interface<PPB_FileIO>()) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 pp_resource(), cc.pp_completion_callback()); | 100 pp_resource(), cc.pp_completion_callback()); |
101 } | 101 } |
102 | 102 |
103 void FileIO::Close() { | 103 void FileIO::Close() { |
104 if (!has_interface<PPB_FileIO>()) | 104 if (!has_interface<PPB_FileIO>()) |
105 return; | 105 return; |
106 get_interface<PPB_FileIO>()->Close(pp_resource()); | 106 get_interface<PPB_FileIO>()->Close(pp_resource()); |
107 } | 107 } |
108 | 108 |
109 } // namespace pp | 109 } // namespace pp |
OLD | NEW |