| OLD | NEW |
| 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 #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 "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 #include "ppapi/c/pp_completion_callback.h" | 9 #include "ppapi/c/pp_completion_callback.h" |
| 10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 void PPB_URLLoader_Impl::RunCallback(int32_t result) { | 423 void PPB_URLLoader_Impl::RunCallback(int32_t result) { |
| 424 // This may be null only when this is a main document loader. | 424 // This may be null only when this is a main document loader. |
| 425 if (!pending_callback_.get()) { | 425 if (!pending_callback_.get()) { |
| 426 CHECK(main_document_loader_); | 426 CHECK(main_document_loader_); |
| 427 return; | 427 return; |
| 428 } | 428 } |
| 429 | 429 |
| 430 // If |user_buffer_| was set as part of registering the callback, ensure | 430 // If |user_buffer_| was set as part of registering the callback, ensure |
| 431 // it got cleared since the callback is now free to delete it. | 431 // it got cleared since the callback is now free to delete it. |
| 432 DCHECK(!user_buffer_); | 432 DCHECK(!user_buffer_); |
| 433 TrackedCallback::ClearAndRun(&pending_callback_, result); | 433 pending_callback_->Run(result); |
| 434 } | 434 } |
| 435 | 435 |
| 436 size_t PPB_URLLoader_Impl::FillUserBuffer() { | 436 size_t PPB_URLLoader_Impl::FillUserBuffer() { |
| 437 DCHECK(user_buffer_); | 437 DCHECK(user_buffer_); |
| 438 DCHECK(user_buffer_size_); | 438 DCHECK(user_buffer_size_); |
| 439 | 439 |
| 440 size_t bytes_to_copy = std::min(buffer_.size(), user_buffer_size_); | 440 size_t bytes_to_copy = std::min(buffer_.size(), user_buffer_size_); |
| 441 std::copy(buffer_.begin(), buffer_.begin() + bytes_to_copy, user_buffer_); | 441 std::copy(buffer_.begin(), buffer_.begin() + bytes_to_copy, user_buffer_); |
| 442 buffer_.erase(buffer_.begin(), buffer_.begin() + bytes_to_copy); | 442 buffer_.erase(buffer_.begin(), buffer_.begin() + bytes_to_copy); |
| 443 | 443 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 bool PPB_URLLoader_Impl::RecordDownloadProgress() const { | 482 bool PPB_URLLoader_Impl::RecordDownloadProgress() const { |
| 483 return request_data_.record_download_progress; | 483 return request_data_.record_download_progress; |
| 484 } | 484 } |
| 485 | 485 |
| 486 bool PPB_URLLoader_Impl::RecordUploadProgress() const { | 486 bool PPB_URLLoader_Impl::RecordUploadProgress() const { |
| 487 return request_data_.record_upload_progress; | 487 return request_data_.record_upload_progress; |
| 488 } | 488 } |
| 489 | 489 |
| 490 } // namespace ppapi | 490 } // namespace ppapi |
| 491 } // namespace webkit | 491 } // namespace webkit |
| OLD | NEW |