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

Side by Side Diff: ppapi/thunk/ppb_file_io_thunk.cc

Issue 238923007: PPAPI: Format ppapi/thunk using clang-format. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 1 month 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/thunk/ppb_file_chooser_trusted_thunk.cc ('k') | ppapi/thunk/ppb_file_mapping_thunk.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) 2012 The Chromium Authors. All rights reserved. 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 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 // From ppb_file_io.idl modified Thu Oct 31 12:30:06 2013. 5 // From ppb_file_io.idl modified Mon Nov 11 16:02:07 2013.
6 6
7 #include "ppapi/c/pp_completion_callback.h" 7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_file_io.h" 9 #include "ppapi/c/ppb_file_io.h"
10 #include "ppapi/shared_impl/tracked_callback.h" 10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h" 11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppapi_thunk_export.h" 12 #include "ppapi/thunk/ppapi_thunk_export.h"
13 #include "ppapi/thunk/ppb_file_io_api.h" 13 #include "ppapi/thunk/ppb_file_io_api.h"
14 14
15 namespace ppapi { 15 namespace ppapi {
(...skipping 16 matching lines...) Expand all
32 } 32 }
33 33
34 int32_t Open(PP_Resource file_io, 34 int32_t Open(PP_Resource file_io,
35 PP_Resource file_ref, 35 PP_Resource file_ref,
36 int32_t open_flags, 36 int32_t open_flags,
37 struct PP_CompletionCallback callback) { 37 struct PP_CompletionCallback callback) {
38 VLOG(4) << "PPB_FileIO::Open()"; 38 VLOG(4) << "PPB_FileIO::Open()";
39 EnterResource<PPB_FileIO_API> enter(file_io, callback, true); 39 EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
40 if (enter.failed()) 40 if (enter.failed())
41 return enter.retval(); 41 return enter.retval();
42 return enter.SetResult(enter.object()->Open(file_ref, 42 return enter.SetResult(
43 open_flags, 43 enter.object()->Open(file_ref, open_flags, enter.callback()));
44 enter.callback()));
45 } 44 }
46 45
47 int32_t Query(PP_Resource file_io, 46 int32_t Query(PP_Resource file_io,
48 struct PP_FileInfo* info, 47 struct PP_FileInfo* info,
49 struct PP_CompletionCallback callback) { 48 struct PP_CompletionCallback callback) {
50 VLOG(4) << "PPB_FileIO::Query()"; 49 VLOG(4) << "PPB_FileIO::Query()";
51 EnterResource<PPB_FileIO_API> enter(file_io, callback, true); 50 EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
52 if (enter.failed()) 51 if (enter.failed())
53 return enter.retval(); 52 return enter.retval();
54 return enter.SetResult(enter.object()->Query(info, enter.callback())); 53 return enter.SetResult(enter.object()->Query(info, enter.callback()));
55 } 54 }
56 55
57 int32_t Touch(PP_Resource file_io, 56 int32_t Touch(PP_Resource file_io,
58 PP_Time last_access_time, 57 PP_Time last_access_time,
59 PP_Time last_modified_time, 58 PP_Time last_modified_time,
60 struct PP_CompletionCallback callback) { 59 struct PP_CompletionCallback callback) {
61 VLOG(4) << "PPB_FileIO::Touch()"; 60 VLOG(4) << "PPB_FileIO::Touch()";
62 EnterResource<PPB_FileIO_API> enter(file_io, callback, true); 61 EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
63 if (enter.failed()) 62 if (enter.failed())
64 return enter.retval(); 63 return enter.retval();
65 return enter.SetResult(enter.object()->Touch(last_access_time, 64 return enter.SetResult(enter.object()->Touch(
66 last_modified_time, 65 last_access_time, last_modified_time, enter.callback()));
67 enter.callback()));
68 } 66 }
69 67
70 int32_t Read(PP_Resource file_io, 68 int32_t Read(PP_Resource file_io,
71 int64_t offset, 69 int64_t offset,
72 char* buffer, 70 char* buffer,
73 int32_t bytes_to_read, 71 int32_t bytes_to_read,
74 struct PP_CompletionCallback callback) { 72 struct PP_CompletionCallback callback) {
75 VLOG(4) << "PPB_FileIO::Read()"; 73 VLOG(4) << "PPB_FileIO::Read()";
76 EnterResource<PPB_FileIO_API> enter(file_io, callback, true); 74 EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
77 if (enter.failed()) 75 if (enter.failed())
78 return enter.retval(); 76 return enter.retval();
79 return enter.SetResult(enter.object()->Read(offset, 77 return enter.SetResult(
80 buffer, 78 enter.object()->Read(offset, buffer, bytes_to_read, enter.callback()));
81 bytes_to_read,
82 enter.callback()));
83 } 79 }
84 80
85 int32_t Write(PP_Resource file_io, 81 int32_t Write(PP_Resource file_io,
86 int64_t offset, 82 int64_t offset,
87 const char* buffer, 83 const char* buffer,
88 int32_t bytes_to_write, 84 int32_t bytes_to_write,
89 struct PP_CompletionCallback callback) { 85 struct PP_CompletionCallback callback) {
90 VLOG(4) << "PPB_FileIO::Write()"; 86 VLOG(4) << "PPB_FileIO::Write()";
91 EnterResource<PPB_FileIO_API> enter(file_io, callback, true); 87 EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
92 if (enter.failed()) 88 if (enter.failed())
93 return enter.retval(); 89 return enter.retval();
94 return enter.SetResult(enter.object()->Write(offset, 90 return enter.SetResult(
95 buffer, 91 enter.object()->Write(offset, buffer, bytes_to_write, enter.callback()));
96 bytes_to_write,
97 enter.callback()));
98 } 92 }
99 93
100 int32_t SetLength(PP_Resource file_io, 94 int32_t SetLength(PP_Resource file_io,
101 int64_t length, 95 int64_t length,
102 struct PP_CompletionCallback callback) { 96 struct PP_CompletionCallback callback) {
103 VLOG(4) << "PPB_FileIO::SetLength()"; 97 VLOG(4) << "PPB_FileIO::SetLength()";
104 EnterResource<PPB_FileIO_API> enter(file_io, callback, true); 98 EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
105 if (enter.failed()) 99 if (enter.failed())
106 return enter.retval(); 100 return enter.retval();
107 return enter.SetResult(enter.object()->SetLength(length, enter.callback())); 101 return enter.SetResult(enter.object()->SetLength(length, enter.callback()));
(...skipping 17 matching lines...) Expand all
125 119
126 int32_t ReadToArray(PP_Resource file_io, 120 int32_t ReadToArray(PP_Resource file_io,
127 int64_t offset, 121 int64_t offset,
128 int32_t max_read_length, 122 int32_t max_read_length,
129 struct PP_ArrayOutput* output, 123 struct PP_ArrayOutput* output,
130 struct PP_CompletionCallback callback) { 124 struct PP_CompletionCallback callback) {
131 VLOG(4) << "PPB_FileIO::ReadToArray()"; 125 VLOG(4) << "PPB_FileIO::ReadToArray()";
132 EnterResource<PPB_FileIO_API> enter(file_io, callback, true); 126 EnterResource<PPB_FileIO_API> enter(file_io, callback, true);
133 if (enter.failed()) 127 if (enter.failed())
134 return enter.retval(); 128 return enter.retval();
135 return enter.SetResult(enter.object()->ReadToArray(offset, 129 return enter.SetResult(enter.object()->ReadToArray(offset, max_read_length,
136 max_read_length, 130 output, enter.callback()));
137 output,
138 enter.callback()));
139 } 131 }
140 132
141 const PPB_FileIO_1_0 g_ppb_fileio_thunk_1_0 = { 133 const PPB_FileIO_1_0 g_ppb_fileio_thunk_1_0 = {&Create,
142 &Create, 134 &IsFileIO,
143 &IsFileIO, 135 &Open,
144 &Open, 136 &Query,
145 &Query, 137 &Touch,
146 &Touch, 138 &Read,
147 &Read, 139 &Write,
148 &Write, 140 &SetLength,
149 &SetLength, 141 &Flush,
150 &Flush, 142 &Close};
151 &Close
152 };
153 143
154 const PPB_FileIO_1_1 g_ppb_fileio_thunk_1_1 = { 144 const PPB_FileIO_1_1 g_ppb_fileio_thunk_1_1 = {&Create,
155 &Create, 145 &IsFileIO,
156 &IsFileIO, 146 &Open,
157 &Open, 147 &Query,
158 &Query, 148 &Touch,
159 &Touch, 149 &Read,
160 &Read, 150 &Write,
161 &Write, 151 &SetLength,
162 &SetLength, 152 &Flush,
163 &Flush, 153 &Close,
164 &Close, 154 &ReadToArray};
165 &ReadToArray
166 };
167 155
168 } // namespace 156 } // namespace
169 157
170 PPAPI_THUNK_EXPORT const PPB_FileIO_1_0* GetPPB_FileIO_1_0_Thunk() { 158 PPAPI_THUNK_EXPORT const PPB_FileIO_1_0* GetPPB_FileIO_1_0_Thunk() {
171 return &g_ppb_fileio_thunk_1_0; 159 return &g_ppb_fileio_thunk_1_0;
172 } 160 }
173 161
174 PPAPI_THUNK_EXPORT const PPB_FileIO_1_1* GetPPB_FileIO_1_1_Thunk() { 162 PPAPI_THUNK_EXPORT const PPB_FileIO_1_1* GetPPB_FileIO_1_1_Thunk() {
175 return &g_ppb_fileio_thunk_1_1; 163 return &g_ppb_fileio_thunk_1_1;
176 } 164 }
177 165
178 } // namespace thunk 166 } // namespace thunk
179 } // namespace ppapi 167 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_file_chooser_trusted_thunk.cc ('k') | ppapi/thunk/ppb_file_mapping_thunk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698