| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 user_buffer_(NULL), | 79 user_buffer_(NULL), |
| 80 user_buffer_size_(0), | 80 user_buffer_size_(0), |
| 81 done_status_(PP_OK_COMPLETIONPENDING), | 81 done_status_(PP_OK_COMPLETIONPENDING), |
| 82 is_streaming_to_file_(false), | 82 is_streaming_to_file_(false), |
| 83 is_asynchronous_load_suspended_(false), | 83 is_asynchronous_load_suspended_(false), |
| 84 has_universal_access_(false), | 84 has_universal_access_(false), |
| 85 status_callback_(NULL) { | 85 status_callback_(NULL) { |
| 86 } | 86 } |
| 87 | 87 |
| 88 PPB_URLLoader_Impl::~PPB_URLLoader_Impl() { | 88 PPB_URLLoader_Impl::~PPB_URLLoader_Impl() { |
| 89 // There is a path whereby the destructor for the loader_ member can | 89 // Removes the resource from the ResourceTracker's tables. This normally |
| 90 // invoke InstanceWasDeleted() upon this PPB_URLLoader_Impl, thereby | 90 // happens as part of Resource destruction, but if a subclass destructor |
| 91 // re-entering the scoped_ptr destructor with the same scoped_ptr object | 91 // has a risk of re-entering destruction via the ResourceTracker, it can |
| 92 // via loader_.reset(). Be sure that loader_ is first NULL then destroy | 92 // call this explicitly to get rid of the table entry before continuing |
| 93 // the scoped_ptr. See http://crbug.com/159429. | 93 // with the destruction. If the resource is not in the ResourceTracker's |
| 94 scoped_ptr<WebKit::WebURLLoader> for_destruction_only(loader_.release()); | 94 // tables, silently does nothing. See http://crbug.com/159429. |
| 95 RemoveFromResourceTracker(); |
| 95 } | 96 } |
| 96 | 97 |
| 97 PPB_URLLoader_API* PPB_URLLoader_Impl::AsPPB_URLLoader_API() { | 98 PPB_URLLoader_API* PPB_URLLoader_Impl::AsPPB_URLLoader_API() { |
| 98 return this; | 99 return this; |
| 99 } | 100 } |
| 100 | 101 |
| 101 void PPB_URLLoader_Impl::InstanceWasDeleted() { | 102 void PPB_URLLoader_Impl::InstanceWasDeleted() { |
| 102 loader_.reset(); | 103 loader_.reset(); |
| 103 } | 104 } |
| 104 | 105 |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 bool PPB_URLLoader_Impl::RecordDownloadProgress() const { | 542 bool PPB_URLLoader_Impl::RecordDownloadProgress() const { |
| 542 return request_data_.record_download_progress; | 543 return request_data_.record_download_progress; |
| 543 } | 544 } |
| 544 | 545 |
| 545 bool PPB_URLLoader_Impl::RecordUploadProgress() const { | 546 bool PPB_URLLoader_Impl::RecordUploadProgress() const { |
| 546 return request_data_.record_upload_progress; | 547 return request_data_.record_upload_progress; |
| 547 } | 548 } |
| 548 | 549 |
| 549 } // namespace ppapi | 550 } // namespace ppapi |
| 550 } // namespace webkit | 551 } // namespace webkit |
| OLD | NEW |