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

Side by Side Diff: ppapi/shared_impl/ppb_file_io_shared.h

Issue 9053003: Convert ppapi/shared to use TrackedCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments Created 8 years, 11 months 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 | Annotate | Revision Log
OLDNEW
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 {
23 public: 24 public:
24 PPB_FileIO_Shared(PP_Instance instance); 25 PPB_FileIO_Shared(PP_Instance instance);
25 PPB_FileIO_Shared(const HostResource& host_resource); 26 PPB_FileIO_Shared(const HostResource& host_resource);
26 ~PPB_FileIO_Shared(); 27 ~PPB_FileIO_Shared();
27 28
28 // Resource overrides. 29 // Resource overrides.
29 virtual void LastPluginRefWasDeleted() OVERRIDE;
30 virtual thunk::PPB_FileIO_API* AsPPB_FileIO_API() OVERRIDE; 30 virtual thunk::PPB_FileIO_API* AsPPB_FileIO_API() OVERRIDE;
31 31
32 // PPB_FileIO_API implementation. 32 // PPB_FileIO_API implementation.
33 virtual int32_t Open(PP_Resource file_ref, 33 virtual int32_t Open(PP_Resource file_ref,
34 int32_t open_flags, 34 int32_t open_flags,
35 PP_CompletionCallback callback) OVERRIDE; 35 PP_CompletionCallback callback) OVERRIDE;
36 virtual int32_t Query(PP_FileInfo* info, 36 virtual int32_t Query(PP_FileInfo* info,
37 PP_CompletionCallback callback) OVERRIDE; 37 PP_CompletionCallback callback) OVERRIDE;
38 virtual int32_t Touch(PP_Time last_access_time, 38 virtual int32_t Touch(PP_Time last_access_time,
39 PP_Time last_modified_time, 39 PP_Time last_modified_time,
(...skipping 15 matching lines...) Expand all
55 void ExecuteOpenFileCallback(int32_t pp_error); 55 void ExecuteOpenFileCallback(int32_t pp_error);
56 void ExecuteQueryCallback(int32_t pp_error, const PP_FileInfo& info); 56 void ExecuteQueryCallback(int32_t pp_error, const PP_FileInfo& info);
57 void ExecuteReadCallback(int32_t pp_error, const char* data); 57 void ExecuteReadCallback(int32_t pp_error, const char* data);
58 58
59 protected: 59 protected:
60 struct CallbackEntry { 60 struct CallbackEntry {
61 CallbackEntry(); 61 CallbackEntry();
62 CallbackEntry(const CallbackEntry& entry); 62 CallbackEntry(const CallbackEntry& entry);
63 ~CallbackEntry(); 63 ~CallbackEntry();
64 64
65 PP_CompletionCallback callback; 65 scoped_refptr<TrackedCallback> callback;
66 66
67 // Pointer back to the caller's read buffer; only used by |Read()|, NULL 67 // Pointer back to the caller's read buffer; only used by |Read()|, NULL
68 // for non-read operations. Not owned. 68 // for non-read operations. Not owned.
69 char* read_buffer; 69 char* read_buffer;
70 70
71 // Pointer back to the caller's PP_FileInfo structure for Query operations. 71 // Pointer back to the caller's PP_FileInfo structure for Query operations.
72 // NULL for non-query operations. Not owned. 72 // NULL for non-query operations. Not owned.
73 PP_FileInfo* info; 73 PP_FileInfo* info;
74 }; 74 };
75 75
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 std::deque<CallbackEntry> callbacks_; 149 std::deque<CallbackEntry> callbacks_;
150 OperationType pending_op_; 150 OperationType pending_op_;
151 151
152 DISALLOW_COPY_AND_ASSIGN(PPB_FileIO_Shared); 152 DISALLOW_COPY_AND_ASSIGN(PPB_FileIO_Shared);
153 }; 153 };
154 154
155 } // namespace ppapi 155 } // namespace ppapi
156 156
157 #endif // PPAPI_SHARED_IMPL_PPB_FILE_IO_SHARED_H_ 157 #endif // PPAPI_SHARED_IMPL_PPB_FILE_IO_SHARED_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698