Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 460 | 460 |
| 461 PP_Resource resource_id = GetReferenceNoAddRef(); | 461 PP_Resource resource_id = GetReferenceNoAddRef(); |
| 462 CHECK(resource_id); | 462 CHECK(resource_id); |
| 463 pending_callback_ = new TrackedCompletionCallback( | 463 pending_callback_ = new TrackedCompletionCallback( |
| 464 instance()->module()->GetCallbackTracker(), resource_id, callback); | 464 instance()->module()->GetCallbackTracker(), resource_id, callback); |
| 465 } | 465 } |
| 466 | 466 |
| 467 void PPB_URLLoader_Impl::RunCallback(int32_t result) { | 467 void PPB_URLLoader_Impl::RunCallback(int32_t result) { |
| 468 // This may be null only when this is a main document loader. | 468 // This may be null only when this is a main document loader. |
| 469 if (!pending_callback_.get()) { | 469 if (!pending_callback_.get()) { |
| 470 CHECK(main_document_loader_); | 470 // TODO(vtl): put this CHECK back when the callback race condition is fixed: |
|
viettrungluu
2011/01/21 21:45:37
Silly nit: in Chromium code, I'm viettrungluu.
polina
2011/01/21 21:48:07
Done.
| |
| 471 // http://code.google.com/p/chromium/issues/detail?id=70347 | |
| 472 //CHECK(main_document_loader_); | |
| 471 return; | 473 return; |
| 472 } | 474 } |
| 473 | 475 |
| 474 scoped_refptr<TrackedCompletionCallback> callback; | 476 scoped_refptr<TrackedCompletionCallback> callback; |
| 475 callback.swap(pending_callback_); | 477 callback.swap(pending_callback_); |
| 476 callback->Run(result); // Will complete abortively if necessary. | 478 callback->Run(result); // Will complete abortively if necessary. |
| 477 } | 479 } |
| 478 | 480 |
| 479 size_t PPB_URLLoader_Impl::FillUserBuffer() { | 481 size_t PPB_URLLoader_Impl::FillUserBuffer() { |
| 480 DCHECK(user_buffer_); | 482 DCHECK(user_buffer_); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 534 bool PPB_URLLoader_Impl::RecordDownloadProgress() const { | 536 bool PPB_URLLoader_Impl::RecordDownloadProgress() const { |
| 535 return request_info_ && request_info_->record_download_progress(); | 537 return request_info_ && request_info_->record_download_progress(); |
| 536 } | 538 } |
| 537 | 539 |
| 538 bool PPB_URLLoader_Impl::RecordUploadProgress() const { | 540 bool PPB_URLLoader_Impl::RecordUploadProgress() const { |
| 539 return request_info_ && request_info_->record_upload_progress(); | 541 return request_info_ && request_info_->record_upload_progress(); |
| 540 } | 542 } |
| 541 | 543 |
| 542 } // namespace ppapi | 544 } // namespace ppapi |
| 543 } // namespace webkit | 545 } // namespace webkit |
| 544 | |
| OLD | NEW |