summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 05:35:09 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 05:35:09 +0000
commit1de458277d15d706c81c1bdf233223d981da1de1 (patch)
tree97730f599fea0ad6d92b00a6de8253855c9946a0 /webkit
parent581d298790029fdc74bc5db4b60c08c0d2f5d238 (diff)
downloadchromium_src-1de458277d15d706c81c1bdf233223d981da1de1.zip
chromium_src-1de458277d15d706c81c1bdf233223d981da1de1.tar.gz
chromium_src-1de458277d15d706c81c1bdf233223d981da1de1.tar.bz2
Remove record_upload_progress and record_download_progress flags from the URL
loader since these flags are now available on the request info structure associated with the loader. TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/4692003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65906 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/plugins/pepper_url_loader.cc26
-rw-r--r--webkit/glue/plugins/pepper_url_loader.h11
2 files changed, 23 insertions, 14 deletions
diff --git a/webkit/glue/plugins/pepper_url_loader.cc b/webkit/glue/plugins/pepper_url_loader.cc
index 20be805..2d94172 100644
--- a/webkit/glue/plugins/pepper_url_loader.cc
+++ b/webkit/glue/plugins/pepper_url_loader.cc
@@ -194,8 +194,6 @@ URLLoader::URLLoader(PluginInstance* instance, bool main_document_loader)
user_buffer_(NULL),
user_buffer_size_(0),
done_status_(PP_ERROR_WOULDBLOCK),
- record_download_progress_(false),
- record_upload_progress_(false),
has_universal_access_(false),
status_callback_(NULL) {
instance->AddObserver(this);
@@ -250,8 +248,6 @@ int32_t URLLoader::Open(URLRequestInfo* request,
request_info_ = scoped_refptr<URLRequestInfo>(request);
pending_callback_ = callback;
- record_download_progress_ = request->record_download_progress();
- record_upload_progress_ = request->record_upload_progress();
// Notify completion when we receive a redirect or response headers.
return PP_ERROR_WOULDBLOCK;
@@ -278,7 +274,7 @@ int32_t URLLoader::FollowRedirect(PP_CompletionCallback callback) {
bool URLLoader::GetUploadProgress(int64_t* bytes_sent,
int64_t* total_bytes_to_be_sent) {
- if (!record_upload_progress_) {
+ if (!RecordUploadProgress()) {
*bytes_sent = 0;
*total_bytes_to_be_sent = 0;
return false;
@@ -290,7 +286,7 @@ bool URLLoader::GetUploadProgress(int64_t* bytes_sent,
bool URLLoader::GetDownloadProgress(int64_t* bytes_received,
int64_t* total_bytes_to_be_received) {
- if (!record_download_progress_) {
+ if (!RecordDownloadProgress()) {
*bytes_received = 0;
*total_bytes_to_be_received = 0;
return false;
@@ -503,7 +499,7 @@ int32_t URLLoader::CanRequest(const WebKit::WebFrame* frame,
void URLLoader::UpdateStatus() {
if (status_callback_ &&
- (record_download_progress_ || record_upload_progress_)) {
+ (RecordDownloadProgress() || RecordUploadProgress())) {
PP_Resource pp_resource = GetReferenceNoAddRef();
if (pp_resource) {
// The PP_Resource on the plugin will be NULL if the plugin has no
@@ -517,12 +513,20 @@ void URLLoader::UpdateStatus() {
// flag.
status_callback_(
instance_->pp_instance(), pp_resource,
- record_upload_progress_ ? bytes_sent_ : -1,
- record_upload_progress_ ? total_bytes_to_be_sent_ : -1,
- record_download_progress_ ? bytes_received_ : -1,
- record_download_progress_ ? total_bytes_to_be_received_ : -1);
+ RecordUploadProgress() ? bytes_sent_ : -1,
+ RecordUploadProgress() ? total_bytes_to_be_sent_ : -1,
+ RecordDownloadProgress() ? bytes_received_ : -1,
+ RecordDownloadProgress() ? total_bytes_to_be_received_ : -1);
}
}
}
+bool URLLoader::RecordDownloadProgress() const {
+ return request_info_ && request_info_->record_download_progress();
+}
+
+bool URLLoader::RecordUploadProgress() const {
+ return request_info_ && request_info_->record_upload_progress();
+}
+
} // namespace pepper
diff --git a/webkit/glue/plugins/pepper_url_loader.h b/webkit/glue/plugins/pepper_url_loader.h
index 22adb6c..ee8ddd7 100644
--- a/webkit/glue/plugins/pepper_url_loader.h
+++ b/webkit/glue/plugins/pepper_url_loader.h
@@ -100,6 +100,14 @@ class URLLoader : public Resource,
// synchronize an out-of-process plugin's state.
void UpdateStatus();
+ // Returns true if the plugin has requested we record download or upload
+ // progress. When false, we don't need to update the counters. We go out of
+ // our way not to allow access to this information unless it's requested,
+ // even when it would be easier just to return it and not check, so that
+ // plugins don't depend on access without setting the flag.
+ bool RecordDownloadProgress() const;
+ bool RecordUploadProgress() const;
+
// This will be NULL if the instance has been deleted but this URLLoader was
// somehow leaked. In general, you should not need to check this for NULL.
// However, if you see a NULL pointer crash, that means somebody is holding
@@ -122,9 +130,6 @@ class URLLoader : public Resource,
size_t user_buffer_size_;
int32_t done_status_;
- bool record_download_progress_;
- bool record_upload_progress_;
-
bool has_universal_access_;
PP_URLLoaderTrusted_StatusCallback status_callback_;