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

Side by Side Diff: webkit/plugins/ppapi/ppb_file_io_impl.h

Issue 7006022: Revert 87415 - Convert more interfaces to the new thunk system. This goes up to and including (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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 | « webkit/plugins/ppapi/ppb_file_chooser_impl.cc ('k') | webkit/plugins/ppapi/ppb_file_io_impl.cc » ('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) 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 WEBKIT_PLUGINS_PPAPI_PPB_FILE_IO_IMPL_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_FILE_IO_IMPL_H_
6 #define WEBKIT_PLUGINS_PPAPI_PPB_FILE_IO_IMPL_H_ 6 #define WEBKIT_PLUGINS_PPAPI_PPB_FILE_IO_IMPL_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_callback_factory.h" 11 #include "base/memory/scoped_callback_factory.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/platform_file.h" 13 #include "base/platform_file.h"
14 #include "ppapi/c/dev/pp_file_info_dev.h" 14 #include "ppapi/c/dev/pp_file_info_dev.h"
15 #include "ppapi/c/pp_time.h" 15 #include "ppapi/c/pp_time.h"
16 #include "ppapi/thunk/ppb_file_io_api.h"
17 #include "webkit/plugins/ppapi/callbacks.h" 16 #include "webkit/plugins/ppapi/callbacks.h"
18 #include "webkit/plugins/ppapi/plugin_delegate.h" 17 #include "webkit/plugins/ppapi/plugin_delegate.h"
19 #include "webkit/plugins/ppapi/resource.h" 18 #include "webkit/plugins/ppapi/resource.h"
20 19
21 struct PP_CompletionCallback; 20 struct PP_CompletionCallback;
22 struct PPB_FileIO_Dev; 21 struct PPB_FileIO_Dev;
23 struct PPB_FileIOTrusted_Dev; 22 struct PPB_FileIOTrusted_Dev;
24 23
25 namespace webkit { 24 namespace webkit {
26 namespace ppapi { 25 namespace ppapi {
27 26
28 class PluginModule; 27 class PluginModule;
29 class PPB_FileRef_Impl; 28 class PPB_FileRef_Impl;
30 29
31 class PPB_FileIO_Impl : public Resource, 30 class PPB_FileIO_Impl : public Resource {
32 public ::ppapi::thunk::PPB_FileIO_API {
33 public: 31 public:
34 explicit PPB_FileIO_Impl(PluginInstance* instance); 32 explicit PPB_FileIO_Impl(PluginInstance* instance);
35 virtual ~PPB_FileIO_Impl(); 33 virtual ~PPB_FileIO_Impl();
36 34
37 static PP_Resource Create(PP_Instance instance); 35 // Returns a pointer to the interface implementing PPB_FileIO that is exposed
36 // to the plugin.
37 static const PPB_FileIO_Dev* GetInterface();
38 38
39 // ResourceObjectBase overrides. 39 // Returns a pointer to the interface implementing PPB_FileIOTrusted that is
40 ::ppapi::thunk::PPB_FileIO_API* AsPPB_FileIO_API(); 40 // exposed to the plugin.
41 static const PPB_FileIOTrusted_Dev* GetTrustedInterface();
41 42
42 // PPB_FileIO_API implementation. 43 // Resource overrides.
43 virtual int32_t Open(PP_Resource file_ref, 44 virtual PPB_FileIO_Impl* AsPPB_FileIO_Impl();
44 int32_t open_flags, 45
45 PP_CompletionCallback callback) OVERRIDE; 46 // PPB_FileIO implementation.
46 virtual int32_t Query(PP_FileInfo_Dev* info, 47 int32_t Open(PPB_FileRef_Impl* file_ref,
47 PP_CompletionCallback callback) OVERRIDE; 48 int32_t open_flags,
48 virtual int32_t Touch(PP_Time last_access_time, 49 PP_CompletionCallback callback);
49 PP_Time last_modified_time, 50 int32_t Query(PP_FileInfo_Dev* info,
50 PP_CompletionCallback callback) OVERRIDE; 51 PP_CompletionCallback callback);
51 virtual int32_t Read(int64_t offset, 52 int32_t Touch(PP_Time last_access_time,
52 char* buffer, 53 PP_Time last_modified_time,
53 int32_t bytes_to_read, 54 PP_CompletionCallback callback);
54 PP_CompletionCallback callback) OVERRIDE; 55 int32_t Read(int64_t offset,
55 virtual int32_t Write(int64_t offset, 56 char* buffer,
56 const char* buffer, 57 int32_t bytes_to_read,
57 int32_t bytes_to_write, 58 PP_CompletionCallback callback);
58 PP_CompletionCallback callback) OVERRIDE; 59 int32_t Write(int64_t offset,
59 virtual int32_t SetLength(int64_t length, 60 const char* buffer,
60 PP_CompletionCallback callback) OVERRIDE; 61 int32_t bytes_to_write,
61 virtual int32_t Flush(PP_CompletionCallback callback) OVERRIDE; 62 PP_CompletionCallback callback);
62 virtual void Close() OVERRIDE; 63 int32_t SetLength(int64_t length,
63 virtual int32_t GetOSFileDescriptor() OVERRIDE; 64 PP_CompletionCallback callback);
64 virtual int32_t WillWrite(int64_t offset, 65 int32_t Flush(PP_CompletionCallback callback);
65 int32_t bytes_to_write, 66 void Close();
66 PP_CompletionCallback callback) OVERRIDE; 67
67 virtual int32_t WillSetLength(int64_t length, 68 // PPB_FileIOTrusted implementation.
68 PP_CompletionCallback callback) OVERRIDE; 69 int32_t GetOSFileDescriptor();
70 int32_t WillWrite(int64_t offset,
71 int32_t bytes_to_write,
72 PP_CompletionCallback callback);
73 int32_t WillSetLength(int64_t length,
74 PP_CompletionCallback callback);
69 75
70 private: 76 private:
71 // Verifies: 77 // Verifies:
72 // - that |callback| is valid (only nonblocking operation supported); 78 // - that |callback| is valid (only nonblocking operation supported);
73 // - that the file is already open or not, depending on |should_be_open|; and 79 // - that the file is already open or not, depending on |should_be_open|; and
74 // - that no callback is already pending. 80 // - that no callback is already pending.
75 // Returns |PP_OK| to indicate that everything is valid or |PP_ERROR_...| if 81 // Returns |PP_OK| to indicate that everything is valid or |PP_ERROR_...| if
76 // the call should be aborted and that code returned to the plugin. 82 // the call should be aborted and that code returned to the plugin.
77 int32_t CommonCallValidation(bool should_be_open, 83 int32_t CommonCallValidation(bool should_be_open,
78 PP_CompletionCallback callback); 84 PP_CompletionCallback callback);
(...skipping 28 matching lines...) Expand all
107 // Pointer back to the caller's read buffer; used by |Read()|. Not owned. 113 // Pointer back to the caller's read buffer; used by |Read()|. Not owned.
108 char* read_buffer_; 114 char* read_buffer_;
109 115
110 DISALLOW_COPY_AND_ASSIGN(PPB_FileIO_Impl); 116 DISALLOW_COPY_AND_ASSIGN(PPB_FileIO_Impl);
111 }; 117 };
112 118
113 } // namespace ppapi 119 } // namespace ppapi
114 } // namespace webkit 120 } // namespace webkit
115 121
116 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FILE_IO_IMPL_H_ 122 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FILE_IO_IMPL_H_
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_file_chooser_impl.cc ('k') | webkit/plugins/ppapi/ppb_file_io_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698