diff options
author | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-08 22:26:15 +0000 |
---|---|---|
committer | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-08 22:26:15 +0000 |
commit | f0a151f7ea0a377decbdeef9d362a02a16dc1c30 (patch) | |
tree | 4036e565e8d8e0dad5b6696b7b55e900899bea3e /chrome/browser/download | |
parent | 5acd0eb50f25f59bd685dc1999e083c09ead4567 (diff) | |
download | chromium_src-f0a151f7ea0a377decbdeef9d362a02a16dc1c30.zip chromium_src-f0a151f7ea0a377decbdeef9d362a02a16dc1c30.tar.gz chromium_src-f0a151f7ea0a377decbdeef9d362a02a16dc1c30.tar.bz2 |
Usage fixes per Coverity. Add checks for tab contents wrapper, profile check,
return values. Update download manager callsite to take const ref.
Update request handle objects to reflect const-ness.
Coverity CID=17238,16334,8852,12877
BUG=
TEST=
Review URL: http://codereview.chromium.org/7218016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r-- | chrome/browser/download/download_manager.cc | 2 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.h | 4 | ||||
-rw-r--r-- | chrome/browser/download/download_request_handle.cc | 8 | ||||
-rw-r--r-- | chrome/browser/download/download_request_handle.h | 6 |
4 files changed, 9 insertions, 11 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index 43d76a9..bdac293 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -841,7 +841,7 @@ void DownloadManager::DownloadCancelled(int32 download_id) { } void DownloadManager::DownloadCancelledInternal( - int download_id, DownloadRequestHandle request_handle) { + int download_id, const DownloadRequestHandle& request_handle) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); request_handle.CancelRequest(); diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h index 241c894..828c83c 100644 --- a/chrome/browser/download/download_manager.h +++ b/chrome/browser/download/download_manager.h @@ -325,10 +325,8 @@ class DownloadManager const FilePath& chosen_file); // Download cancel helper function. - // |request_handle| is passed by value because it is ultimately passed to - // other threads, and this way we don't have to worry about object lifetimes. void DownloadCancelledInternal(int download_id, - DownloadRequestHandle request_handle); + const DownloadRequestHandle& request_handle); // All data has been downloaded. // |hash| is sha256 hash for the downloaded file. It is empty when the hash diff --git a/chrome/browser/download/download_request_handle.cc b/chrome/browser/download/download_request_handle.cc index 9e7f581..aaf66e9 100644 --- a/chrome/browser/download/download_request_handle.cc +++ b/chrome/browser/download/download_request_handle.cc @@ -51,7 +51,7 @@ DownloadRequestHandle::DownloadRequestHandle(ResourceDispatcherHost* rdh, DCHECK(rdh); } -TabContents* DownloadRequestHandle::GetTabContents() const{ +TabContents* DownloadRequestHandle::GetTabContents() const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return tab_util::GetTabContentsByID(child_id_, render_view_id_); } @@ -68,7 +68,7 @@ DownloadManager* DownloadRequestHandle::GetDownloadManager() const { return profile->GetDownloadManager(); } -void DownloadRequestHandle::PauseRequest() { +void DownloadRequestHandle::PauseRequest() const { // The post is safe because ResourceDispatcherHost is guaranteed // to outlive the IO thread. if (rdh_) { @@ -79,7 +79,7 @@ void DownloadRequestHandle::PauseRequest() { } } -void DownloadRequestHandle::ResumeRequest() { +void DownloadRequestHandle::ResumeRequest() const { // The post is safe because ResourceDispatcherHost is guaranteed // to outlive the IO thread. if (rdh_) { @@ -90,7 +90,7 @@ void DownloadRequestHandle::ResumeRequest() { } } -void DownloadRequestHandle::CancelRequest() { +void DownloadRequestHandle::CancelRequest() const { // The post is safe because ResourceDispatcherHost is guaranteed // to outlive the IO thread. if (rdh_) { diff --git a/chrome/browser/download/download_request_handle.h b/chrome/browser/download/download_request_handle.h index e591cb8..0f26697 100644 --- a/chrome/browser/download/download_request_handle.h +++ b/chrome/browser/download/download_request_handle.h @@ -38,11 +38,11 @@ class DownloadRequestHandle { DownloadManager* GetDownloadManager() const; // Pause or resume the matching URL request. - void PauseRequest(); - void ResumeRequest(); + void PauseRequest() const; + void ResumeRequest() const; // Cancel the request - void CancelRequest(); + void CancelRequest() const; std::string DebugString() const; |