summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/save_package.h
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-16 15:22:48 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-16 15:22:48 +0000
commitad59ef3d47e885120966b07ebaef96440ef1ec3d (patch)
tree46ff8f94d73cfb4c46b33a602f25fec3543a7b4f /chrome/browser/download/save_package.h
parentbc1e07c777d31055c22cc4a498a0267097063a97 (diff)
downloadchromium_src-ad59ef3d47e885120966b07ebaef96440ef1ec3d.zip
chromium_src-ad59ef3d47e885120966b07ebaef96440ef1ec3d.tar.gz
chromium_src-ad59ef3d47e885120966b07ebaef96440ef1ec3d.tar.bz2
Fixes two crashers in saving page:
1. GetTabID was being called AFTER the process was destroyed, which means we could try and deref NULL. By caching the value we don't have to worry about whether the web contents goes away or not. 2. A PostTask was done, then we assumed the SaveItem still exists. That isn't the case if the user canceled the save. BUG=2206 TEST=none, just make sure save page as still works correctly. Review URL: http://codereview.chromium.org/3034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2261 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download/save_package.h')
-rw-r--r--chrome/browser/download/save_package.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/chrome/browser/download/save_package.h b/chrome/browser/download/save_package.h
index 8c12190..7b6edcd 100644
--- a/chrome/browser/download/save_package.h
+++ b/chrome/browser/download/save_package.h
@@ -127,7 +127,7 @@ class SavePackage : public base::RefCountedThreadSafe<SavePackage> {
// Since for one tab, it can only have one SavePackage in same time.
// Now we actually use render_process_id as tab's unique id.
- int GetTabId();
+ int tab_id() const { return tab_id_; }
// Helper function for preparing suggested name for the SaveAs Dialog. The
// suggested name is composed of the default save path and the web document's
@@ -303,6 +303,9 @@ class SavePackage : public base::RefCountedThreadSafe<SavePackage> {
// from outside.
WaitState wait_state_;
+ // Unique id for this SavePackage.
+ const int tab_id_;
+
DISALLOW_EVIL_CONSTRUCTORS(SavePackage);
};