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

Unified Diff: chrome/browser/renderer_host/download_throttling_resource_handler.cc

Issue 7237034: sql::MetaTable.next_download_id, DownloadManager::GetNextId() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: " 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: chrome/browser/renderer_host/download_throttling_resource_handler.cc
diff --git a/chrome/browser/renderer_host/download_throttling_resource_handler.cc b/chrome/browser/renderer_host/download_throttling_resource_handler.cc
index 34d90aee6376ad7696c04b3086fde073d21a3117..a455e5b899a287cb72bb517f2783909656eddb4b 100644
--- a/chrome/browser/renderer_host/download_throttling_resource_handler.cc
+++ b/chrome/browser/renderer_host/download_throttling_resource_handler.cc
@@ -5,9 +5,12 @@
#include "chrome/browser/renderer_host/download_throttling_resource_handler.h"
#include "base/logging.h"
+#include "chrome/browser/download/download_id.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/renderer_host/download_resource_handler.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
+#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
+#include "content/browser/resource_context.h"
#include "content/common/resource_response.h"
#include "net/base/io_buffer.h"
#include "net/base/mime_sniffer.h"
@@ -173,12 +176,29 @@ void DownloadThrottlingResourceHandler::CancelDownload() {
void DownloadThrottlingResourceHandler::ContinueDownload() {
DCHECK(!download_handler_.get());
if (!request_closed_) {
+ ResourceDispatcherHostRequestInfo* info =
+ ResourceDispatcherHost::InfoForRequest(request_);
+ // TODO(benjhayden) next_download_id_thunk can be a field in ResourceContext
+ // when DownloadManager is moved to content.
+ DownloadManager::GetNextIdThunkType* next_download_id_thunk =
+ reinterpret_cast<DownloadManager::GetNextIdThunkType*>(info->context()
+ ->GetUserData(reinterpret_cast<void*>(BASE_HASH_NAMESPACE::
+#if defined(COMPILER_GCC)
+ hash<std::string>()
+#elif defined(COMPILER_MSVC)
+ hash_value
+#endif
+ ("next_download_id_thunk"))));
+ CHECK(next_download_id_thunk);
+ CHECK(!next_download_id_thunk->is_null());
+ DownloadId dl_id = next_download_id_thunk->Run();
download_handler_ =
new DownloadResourceHandler(host_,
render_process_host_id_,
render_view_id_,
request_id_,
url_,
+ dl_id,
host_->download_file_manager(),
request_,
false,

Powered by Google App Engine
This is Rietveld 408576698