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

Side by Side Diff: ppapi/proxy/file_io_resource.h

Issue 11941022: Refactor FileIO to the new resource host system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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
« no previous file with comments | « ppapi/ppapi_shared.gypi ('k') | ppapi/proxy/file_io_resource.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_PROXY_FILE_IO_RESOURCE_H_
6 #define PPAPI_PROXY_FILE_IO_RESOURCE_H_
7
8 #include <string>
9
10 #include "ppapi/proxy/connection.h"
11 #include "ppapi/proxy/plugin_resource.h"
12 #include "ppapi/proxy/ppapi_proxy_export.h"
13 #include "ppapi/shared_impl/file_io_state_manager.h"
14 #include "ppapi/thunk/ppb_file_io_api.h"
15
16 namespace ppapi {
17
18 class TrackedCallback;
19
20 namespace proxy {
21
22 class PPAPI_PROXY_EXPORT FileIOResource
23 : public PluginResource,
24 public thunk::PPB_FileIO_API {
25 public:
26 FileIOResource(Connection connection, PP_Instance instance);
27 virtual ~FileIOResource();
28
29 // Resource overrides.
30 virtual thunk::PPB_FileIO_API* AsPPB_FileIO_API() OVERRIDE;
31
32 // PPB_FileIO_API implementation.
33 virtual int32_t Open(PP_Resource file_ref,
34 int32_t open_flags,
35 scoped_refptr<TrackedCallback> callback) OVERRIDE;
36 virtual int32_t Query(PP_FileInfo* info,
37 scoped_refptr<TrackedCallback> callback) OVERRIDE;
38 virtual int32_t Touch(PP_Time last_access_time,
39 PP_Time last_modified_time,
40 scoped_refptr<TrackedCallback> callback) OVERRIDE;
41 virtual int32_t Read(int64_t offset,
42 char* buffer,
43 int32_t bytes_to_read,
44 scoped_refptr<TrackedCallback> callback) OVERRIDE;
45 virtual int32_t ReadToArray(int64_t offset,
46 int32_t max_read_length,
47 PP_ArrayOutput* array_output,
48 scoped_refptr<TrackedCallback> callback) OVERRIDE;
49 virtual int32_t Write(int64_t offset,
50 const char* buffer,
51 int32_t bytes_to_write,
52 scoped_refptr<TrackedCallback> callback) OVERRIDE;
53 virtual int32_t SetLength(int64_t length,
54 scoped_refptr<TrackedCallback> callback) OVERRIDE;
55 virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) OVERRIDE;
56 virtual void Close() OVERRIDE;
57 virtual int32_t GetOSFileDescriptor() OVERRIDE;
58 virtual int32_t WillWrite(int64_t offset,
59 int32_t bytes_to_write,
60 scoped_refptr<TrackedCallback> callback) OVERRIDE;
61 virtual int32_t WillSetLength(
62 int64_t length,
63 scoped_refptr<TrackedCallback> callback) OVERRIDE;
64
65 private:
66 int32_t ReadValidated(int64_t offset,
67 int32_t bytes_to_read,
68 const PP_ArrayOutput& array_output,
69 scoped_refptr<TrackedCallback> callback);
70
71 // Handlers of reply messages. Note that all of them have a callback
72 // parameters bound when call to the host.
73 void OnPluginMsgGeneralComplete(scoped_refptr<TrackedCallback> callback,
74 const ResourceMessageReplyParams& params);
75 void OnPluginMsgOpenFileComplete(scoped_refptr<TrackedCallback> callback,
76 const ResourceMessageReplyParams& params);
77 void OnPluginMsgQueryComplete(scoped_refptr<TrackedCallback> callback,
78 PP_FileInfo* output_info_,
79 const ResourceMessageReplyParams& params,
80 const PP_FileInfo& info);
81 void OnPluginMsgReadComplete(scoped_refptr<TrackedCallback> callback,
82 PP_ArrayOutput array_output,
83 const ResourceMessageReplyParams& params,
84 const std::string& data);
85
86 FileIOStateManager state_manager_;
87
88 DISALLOW_COPY_AND_ASSIGN(FileIOResource);
89 };
90
91 } // namespace proxy
92 } // namespace ppapi
93
94 #endif // PPAPI_PROXY_FILE_IO_RESOURCE_H_
95
OLDNEW
« no previous file with comments | « ppapi/ppapi_shared.gypi ('k') | ppapi/proxy/file_io_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698