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

Side by Side Diff: webkit/plugins/ppapi/ppb_url_loader_impl.cc

Issue 6711047: Fix up some types in the API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: static_cast and header order Created 9 years, 9 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 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" 5 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/c/pp_completion_callback.h" 8 #include "ppapi/c/pp_completion_callback.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/ppb_url_loader.h" 10 #include "ppapi/c/ppb_url_loader.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return 0; 115 return 0;
116 116
117 PPB_URLResponseInfo_Impl* response_info = loader->response_info(); 117 PPB_URLResponseInfo_Impl* response_info = loader->response_info();
118 if (!response_info) 118 if (!response_info)
119 return 0; 119 return 0;
120 120
121 return response_info->GetReference(); 121 return response_info->GetReference();
122 } 122 }
123 123
124 int32_t ReadResponseBody(PP_Resource loader_id, 124 int32_t ReadResponseBody(PP_Resource loader_id,
125 char* buffer, 125 void* buffer,
126 int32_t bytes_to_read, 126 int32_t bytes_to_read,
127 PP_CompletionCallback callback) { 127 PP_CompletionCallback callback) {
128 scoped_refptr<PPB_URLLoader_Impl> loader( 128 scoped_refptr<PPB_URLLoader_Impl> loader(
129 Resource::GetAs<PPB_URLLoader_Impl>(loader_id)); 129 Resource::GetAs<PPB_URLLoader_Impl>(loader_id));
130 if (!loader) 130 if (!loader)
131 return PP_ERROR_BADRESOURCE; 131 return PP_ERROR_BADRESOURCE;
132 132
133 return loader->ReadResponseBody(buffer, bytes_to_read, callback); 133 return loader->ReadResponseBody(buffer, bytes_to_read, callback);
134 } 134 }
135 135
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 if (!RecordDownloadProgress()) { 304 if (!RecordDownloadProgress()) {
305 *bytes_received = 0; 305 *bytes_received = 0;
306 *total_bytes_to_be_received = 0; 306 *total_bytes_to_be_received = 0;
307 return false; 307 return false;
308 } 308 }
309 *bytes_received = bytes_received_; 309 *bytes_received = bytes_received_;
310 *total_bytes_to_be_received = total_bytes_to_be_received_; 310 *total_bytes_to_be_received = total_bytes_to_be_received_;
311 return true; 311 return true;
312 } 312 }
313 313
314 int32_t PPB_URLLoader_Impl::ReadResponseBody(char* buffer, 314 int32_t PPB_URLLoader_Impl::ReadResponseBody(void* buffer,
315 int32_t bytes_to_read, 315 int32_t bytes_to_read,
316 PP_CompletionCallback callback) { 316 PP_CompletionCallback callback) {
317 int32_t rv = ValidateCallback(callback); 317 int32_t rv = ValidateCallback(callback);
318 if (rv != PP_OK) 318 if (rv != PP_OK)
319 return rv; 319 return rv;
320 if (!response_info_ || response_info_->body()) 320 if (!response_info_ || response_info_->body())
321 return PP_ERROR_FAILED; 321 return PP_ERROR_FAILED;
322 if (bytes_to_read <= 0 || !buffer) 322 if (bytes_to_read <= 0 || !buffer)
323 return PP_ERROR_BADARGUMENT; 323 return PP_ERROR_BADARGUMENT;
324 324
325 user_buffer_ = buffer; 325 user_buffer_ = static_cast<char*>(buffer);
326 user_buffer_size_ = bytes_to_read; 326 user_buffer_size_ = bytes_to_read;
327 327
328 if (!buffer_.empty()) 328 if (!buffer_.empty())
329 return FillUserBuffer(); 329 return FillUserBuffer();
330 330
331 // We may have already reached EOF. 331 // We may have already reached EOF.
332 if (done_status_ != PP_ERROR_WOULDBLOCK) { 332 if (done_status_ != PP_ERROR_WOULDBLOCK) {
333 user_buffer_ = NULL; 333 user_buffer_ = NULL;
334 user_buffer_size_ = 0; 334 user_buffer_size_ = 0;
335 return done_status_; 335 return done_status_;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 bool PPB_URLLoader_Impl::RecordDownloadProgress() const { 539 bool PPB_URLLoader_Impl::RecordDownloadProgress() const {
540 return request_info_ && request_info_->record_download_progress(); 540 return request_info_ && request_info_->record_download_progress();
541 } 541 }
542 542
543 bool PPB_URLLoader_Impl::RecordUploadProgress() const { 543 bool PPB_URLLoader_Impl::RecordUploadProgress() const {
544 return request_info_ && request_info_->record_upload_progress(); 544 return request_info_ && request_info_->record_upload_progress();
545 } 545 }
546 546
547 } // namespace ppapi 547 } // namespace ppapi
548 } // namespace webkit 548 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_url_loader_impl.h ('k') | webkit/plugins/ppapi/ppb_url_request_info_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698