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

Unified Diff: content/browser/download/download_item.cc

Issue 8401001: Fix history importing by delaying DownloadManager creation. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: comments Created 9 years, 2 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: content/browser/download/download_item.cc
diff --git a/content/browser/download/download_item.cc b/content/browser/download/download_item.cc
index 84387b667353a3727d369273445e656fed360f2b..c6ceb62c7c6324fb7bfbe89df57cec9859291569 100644
--- a/content/browser/download/download_item.cc
+++ b/content/browser/download/download_item.cc
@@ -14,10 +14,9 @@
#include "base/stringprintf.h"
#include "base/timer.h"
#include "base/utf_string_conversions.h"
-#include "net/base/net_util.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/download/download_file.h"
#include "content/browser/download/download_create_info.h"
+#include "content/browser/download/download_file.h"
#include "content/browser/download/download_file_manager.h"
#include "content/browser/download/download_id.h"
#include "content/browser/download/download_manager.h"
@@ -27,6 +26,7 @@
#include "content/browser/download/interrupt_reasons.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/download_manager_delegate.h"
+#include "net/base/net_util.h"
// A DownloadItem normally goes through the following states:
// * Created (when download starts)
@@ -121,7 +121,7 @@ const int DownloadItem::kUninitializedHandle = 0;
// Constructor for reading from the history service.
DownloadItem::DownloadItem(DownloadManager* download_manager,
const DownloadPersistentStoreInfo& info)
- : download_id_(-1),
+ : download_id_(download_manager->GetNextId()),
full_path_(info.path),
url_chain_(1, info.url),
referrer_url_(info.referrer_url),
@@ -198,7 +198,7 @@ DownloadItem::DownloadItem(DownloadManager* download_manager,
const GURL& url,
bool is_otr,
DownloadId download_id)
- : download_id_(download_id.local()),
+ : download_id_(download_id),
full_path_(path),
url_chain_(1, url),
referrer_url_(GURL()),
@@ -232,10 +232,6 @@ DownloadItem::~DownloadItem() {
download_manager_->AssertQueueStateConsistent(this);
}
-DownloadId DownloadItem::global_id() const {
- return DownloadId(download_manager_, id());
-}
-
void DownloadItem::AddObserver(Observer* observer) {
// TODO(rdsmith): Change to DCHECK after http://crbug.com/85408 resolved.
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -774,7 +770,7 @@ std::string DownloadItem::DebugString(bool verbose) const {
std::string description =
base::StringPrintf("{ id = %d"
" state = %s",
- download_id_,
+ download_id_.local(),
DebugDownloadStateString(state()));
// Construct a string of the URL chain.

Powered by Google App Engine
This is Rietveld 408576698