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

Unified Diff: webkit/plugins/ppapi/ppb_url_loader_impl.cc

Issue 7629017: Add a unified resource tracker shared between the proxy and the impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: webkit/plugins/ppapi/ppb_url_loader_impl.cc
diff --git a/webkit/plugins/ppapi/ppb_url_loader_impl.cc b/webkit/plugins/ppapi/ppb_url_loader_impl.cc
index 6fb46ef43b8299f0c7b7f86aae2b685793477be2..95349b7a433fd6b407fbb14f5694e894e45cd2a2 100644
--- a/webkit/plugins/ppapi/ppb_url_loader_impl.cc
+++ b/webkit/plugins/ppapi/ppb_url_loader_impl.cc
@@ -76,8 +76,8 @@ PPB_URLLoader_API* PPB_URLLoader_Impl::AsPPB_URLLoader_API() {
return this;
}
-void PPB_URLLoader_Impl::ClearInstance() {
- Resource::ClearInstance();
+void PPB_URLLoader_Impl::InstanceWasDeleted() {
+ Resource::InstanceWasDeleted();
loader_.reset();
}
@@ -362,10 +362,8 @@ void PPB_URLLoader_Impl::RegisterCallback(PP_CompletionCallback callback) {
DCHECK(callback.func);
DCHECK(!pending_callback_.get() || pending_callback_->completed());
- PP_Resource resource_id = GetReferenceNoAddRef();
- CHECK(resource_id);
pending_callback_ = new TrackedCompletionCallback(
- instance()->module()->GetCallbackTracker(), resource_id, callback);
+ instance()->module()->GetCallbackTracker(), pp_resource(), callback);
}
void PPB_URLLoader_Impl::RunCallback(int32_t result) {
@@ -414,24 +412,17 @@ void PPB_URLLoader_Impl::SaveResponse(const WebURLResponse& response) {
void PPB_URLLoader_Impl::UpdateStatus() {
if (status_callback_ &&
(RecordDownloadProgress() || RecordUploadProgress())) {
- PP_Resource pp_resource = GetReferenceNoAddRef();
- if (pp_resource) {
- // The PP_Resource on the plugin will be NULL if the plugin has no
- // reference to this object. That's fine, because then we don't need to
- // call UpdateStatus.
- //
- // Here we go through some effort to only send the exact information that
- // the requestor wanted in the request flags. It would be just as
- // efficient to send all of it, but we don't want people to rely on
- // getting download progress when they happen to set the upload progress
- // flag.
- status_callback_(
- instance()->pp_instance(), pp_resource,
- RecordUploadProgress() ? bytes_sent_ : -1,
- RecordUploadProgress() ? total_bytes_to_be_sent_ : -1,
- RecordDownloadProgress() ? bytes_received_ : -1,
- RecordDownloadProgress() ? total_bytes_to_be_received_ : -1);
- }
+ // Here we go through some effort to only send the exact information that
+ // the requestor wanted in the request flags. It would be just as
+ // efficient to send all of it, but we don't want people to rely on
+ // getting download progress when they happen to set the upload progress
+ // flag.
+ status_callback_(
+ instance()->pp_instance(), pp_resource(),
+ RecordUploadProgress() ? bytes_sent_ : -1,
+ RecordUploadProgress() ? total_bytes_to_be_sent_ : -1,
+ RecordDownloadProgress() ? bytes_received_ : -1,
+ RecordDownloadProgress() ? total_bytes_to_be_received_ : -1);
}
}

Powered by Google App Engine
This is Rietveld 408576698