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

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.cc

Issue 8770023: Break FileIO and URLLoader tests down into individual cases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Break FileIO and URLLoader tests down into individual cases. Created 9 years 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 | « chrome/test/ui/ppapi_uitest.cc ('k') | ppapi/tests/test_url_loader.h » ('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 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.h" 5 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "native_client/src/include/nacl_scoped_ptr.h" 10 #include "native_client/src/include/nacl_scoped_ptr.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 int32_t Read(PP_Resource file_io, 152 int32_t Read(PP_Resource file_io,
153 int64_t offset, 153 int64_t offset,
154 char* buffer, 154 char* buffer,
155 int32_t bytes_to_read, 155 int32_t bytes_to_read,
156 struct PP_CompletionCallback callback) { 156 struct PP_CompletionCallback callback) {
157 DebugPrintf("PPB_FileIO::Read: file_io=%"NACL_PRIu32", " 157 DebugPrintf("PPB_FileIO::Read: file_io=%"NACL_PRIu32", "
158 "offset=%"NACL_PRId64", bytes_to_read=%"NACL_PRId32"\n", file_io, 158 "offset=%"NACL_PRId64", bytes_to_read=%"NACL_PRId32"\n", file_io,
159 offset, bytes_to_read); 159 offset, bytes_to_read);
160 160
161 if (bytes_to_read < 0) 161 if (bytes_to_read < 0)
162 bytes_to_read = 0; 162 return PP_ERROR_FAILED;
163 nacl_abi_size_t buffer_size = bytes_to_read; 163 nacl_abi_size_t buffer_size = static_cast<nacl_abi_size_t>(bytes_to_read);
164 164
165 int32_t callback_id = 165 int32_t callback_id =
166 CompletionCallbackTable::Get()->AddCallback(callback, buffer); 166 CompletionCallbackTable::Get()->AddCallback(callback, buffer);
167 if (callback_id == 0) // Just like Chrome, for now disallow blocking calls. 167 if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
168 return PP_ERROR_BLOCKS_MAIN_THREAD; 168 return PP_ERROR_BLOCKS_MAIN_THREAD;
169 169
170 int32_t pp_error_or_bytes; 170 int32_t pp_error_or_bytes;
171 NaClSrpcError srpc_result = 171 NaClSrpcError srpc_result =
172 PpbFileIORpcClient::PPB_FileIO_Read( 172 PpbFileIORpcClient::PPB_FileIO_Read(
173 GetMainSrpcChannel(), 173 GetMainSrpcChannel(),
(...skipping 15 matching lines...) Expand all
189 int32_t Write(PP_Resource file_io, 189 int32_t Write(PP_Resource file_io,
190 int64_t offset, 190 int64_t offset,
191 const char* buffer, 191 const char* buffer,
192 int32_t bytes_to_write, 192 int32_t bytes_to_write,
193 struct PP_CompletionCallback callback) { 193 struct PP_CompletionCallback callback) {
194 DebugPrintf("PPB_FileIO::Write: file_io=%"NACL_PRIu32", offset=" 194 DebugPrintf("PPB_FileIO::Write: file_io=%"NACL_PRIu32", offset="
195 "%"NACL_PRId64", bytes_to_write=%"NACL_PRId32"\n", file_io, 195 "%"NACL_PRId64", bytes_to_write=%"NACL_PRId32"\n", file_io,
196 offset, bytes_to_write); 196 offset, bytes_to_write);
197 197
198 if (bytes_to_write < 0) 198 if (bytes_to_write < 0)
199 bytes_to_write = 0; 199 return PP_ERROR_FAILED;
200 nacl_abi_size_t buffer_size = static_cast<nacl_abi_size_t>(bytes_to_write); 200 nacl_abi_size_t buffer_size = static_cast<nacl_abi_size_t>(bytes_to_write);
201 201
202 int32_t callback_id = 202 int32_t callback_id =
203 CompletionCallbackTable::Get()->AddCallback(callback); 203 CompletionCallbackTable::Get()->AddCallback(callback);
204 if (callback_id == 0) // Just like Chrome, for now disallow blocking calls. 204 if (callback_id == 0) // Just like Chrome, for now disallow blocking calls.
205 return PP_ERROR_BLOCKS_MAIN_THREAD; 205 return PP_ERROR_BLOCKS_MAIN_THREAD;
206 206
207 int32_t pp_error_or_bytes = PP_ERROR_FAILED; 207 int32_t pp_error_or_bytes = PP_ERROR_FAILED;
208 NaClSrpcError srpc_result = PpbFileIORpcClient::PPB_FileIO_Write( 208 NaClSrpcError srpc_result = PpbFileIORpcClient::PPB_FileIO_Write(
209 GetMainSrpcChannel(), 209 GetMainSrpcChannel(),
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 Read, 294 Read,
295 Write, 295 Write,
296 SetLength, 296 SetLength,
297 Flush, 297 Flush,
298 Close 298 Close
299 }; 299 };
300 return &file_io_interface; 300 return &file_io_interface;
301 } 301 }
302 302
303 } // namespace ppapi_proxy 303 } // namespace ppapi_proxy
OLDNEW
« no previous file with comments | « chrome/test/ui/ppapi_uitest.cc ('k') | ppapi/tests/test_url_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698