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 #ifndef PPAPI_SHARED_IMPL_PPB_FILE_IO_SHARED_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PPB_FILE_IO_SHARED_H_ |
6 #define PPAPI_SHARED_IMPL_PPB_FILE_IO_SHARED_H_ | 6 #define PPAPI_SHARED_IMPL_PPB_FILE_IO_SHARED_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "ppapi/shared_impl/ppapi_shared_export.h" | 11 #include "ppapi/shared_impl/ppapi_shared_export.h" |
12 #include "ppapi/shared_impl/resource.h" | 12 #include "ppapi/shared_impl/resource.h" |
| 13 #include "ppapi/shared_impl/tracked_callback.h" |
13 #include "ppapi/thunk/ppb_file_io_api.h" | 14 #include "ppapi/thunk/ppb_file_io_api.h" |
14 | 15 |
15 namespace ppapi { | 16 namespace ppapi { |
16 | 17 |
17 namespace thunk { | 18 namespace thunk { |
18 class PPB_FileRef_API; | 19 class PPB_FileRef_API; |
19 } | 20 } |
20 | 21 |
21 class PPAPI_SHARED_EXPORT PPB_FileIO_Shared : public Resource, | 22 class PPAPI_SHARED_EXPORT PPB_FileIO_Shared : public Resource, |
22 public thunk::PPB_FileIO_API { | 23 public thunk::PPB_FileIO_API { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 void ExecuteOpenFileCallback(int32_t pp_error); | 56 void ExecuteOpenFileCallback(int32_t pp_error); |
56 void ExecuteQueryCallback(int32_t pp_error, const PP_FileInfo& info); | 57 void ExecuteQueryCallback(int32_t pp_error, const PP_FileInfo& info); |
57 void ExecuteReadCallback(int32_t pp_error, const char* data); | 58 void ExecuteReadCallback(int32_t pp_error, const char* data); |
58 | 59 |
59 protected: | 60 protected: |
60 struct CallbackEntry { | 61 struct CallbackEntry { |
61 CallbackEntry(); | 62 CallbackEntry(); |
62 CallbackEntry(const CallbackEntry& entry); | 63 CallbackEntry(const CallbackEntry& entry); |
63 ~CallbackEntry(); | 64 ~CallbackEntry(); |
64 | 65 |
65 PP_CompletionCallback callback; | 66 scoped_refptr<TrackedCallback> callback; |
66 | 67 |
67 // Pointer back to the caller's read buffer; only used by |Read()|, NULL | 68 // Pointer back to the caller's read buffer; only used by |Read()|, NULL |
68 // for non-read operations. Not owned. | 69 // for non-read operations. Not owned. |
69 char* read_buffer; | 70 char* read_buffer; |
70 | 71 |
71 // Pointer back to the caller's PP_FileInfo structure for Query operations. | 72 // Pointer back to the caller's PP_FileInfo structure for Query operations. |
72 // NULL for non-query operations. Not owned. | 73 // NULL for non-query operations. Not owned. |
73 PP_FileInfo* info; | 74 PP_FileInfo* info; |
74 }; | 75 }; |
75 | 76 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 149 |
149 std::deque<CallbackEntry> callbacks_; | 150 std::deque<CallbackEntry> callbacks_; |
150 OperationType pending_op_; | 151 OperationType pending_op_; |
151 | 152 |
152 DISALLOW_COPY_AND_ASSIGN(PPB_FileIO_Shared); | 153 DISALLOW_COPY_AND_ASSIGN(PPB_FileIO_Shared); |
153 }; | 154 }; |
154 | 155 |
155 } // namespace ppapi | 156 } // namespace ppapi |
156 | 157 |
157 #endif // PPAPI_SHARED_IMPL_PPB_FILE_IO_SHARED_H_ | 158 #endif // PPAPI_SHARED_IMPL_PPB_FILE_IO_SHARED_H_ |
OLD | NEW |