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

Issue 7793003: Revert 98656 - Make a new integer field in sql::MetaTable (a per-profile db) containing a counter... (Closed)

Created:
9 years, 3 months ago by dmac
Modified:
9 years, 3 months ago
Reviewers:
benjhayden
CC:
chromium-reviews, jam, brettw-cc_chromium.org, achuith+watch_chromium.org, joi+watch-content_chromium.org, rginda+watch_chromium.org, darin-cc_chromium.org, rdsmith+dwatch_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

Revert 98656 - Make a new integer field in sql::MetaTable (a per-profile db) containing a counter for the next download id, so that this id is unique across sessions. This id will allow us to merge download id with db_handle and merge most/all of the maps in DownloadManager in future CLs. Make DownloadManager read this field to initialize its next_id_ counter in Init(). Put a fine-grained mutex in DownloadManager::GetNextId() so that it can be called directly from any thread. Define a thunk wrapping DM::GNI() to be passed around between threads to guard against other threads calling any other DM methods. This thunk owns a scoped_refptr<DM> to manage life-time issues. This pattern is implemented for DM elsewhere. Store this thunk in ResourceContext to be called by ResourceDispatchHost/DownloadThrottlingResourceHandler on the IO thread. Pass the returned DownloadId into DownloadResourceHandler. The alternative way to obtain ids on the IO thread is to jump over to the UI thread and back. This way would add significant latency to a critical path. GetNextId() should be fast and easily accessible from any thread. Now that ids are per-profile, define a class DownloadId containing a per-profile id and an indication of which profile, currently the DownloadManager*. DownloadIds are hashable, comparable, globally unique, not persistent, and are used by DownloadFileManager. When the download is added to the history, MetaTable.next_download_id will be set to the new download's id +1 if that number is greater than MT.next_download_id. Increasing this counter at the same time as the download is added to the db prevents the counter from desyncing from the db, which was the primary concern re storing the counter in the BrowserPrefs. See also http://codereview.chromium.org/7192016 LMK what to write a test for if anything. Review URL: http://codereview.chromium.org/7237034 TBR=benjhayden@chromium.org Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=98660

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+111 lines, -379 lines) Patch
M chrome/browser/download/chrome_download_manager_delegate.cc View 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/browser/download/download_history.h View 1 chunk +0 lines, -5 lines 0 comments Download
M chrome/browser/download/download_history.cc View 1 chunk +0 lines, -11 lines 0 comments Download
M chrome/browser/download/download_manager_unittest.cc View 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/download/download_throttling_resource_handler.cc View 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/download/download_util.h View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/history/download_database.h View 3 chunks +0 lines, -6 lines 0 comments Download
M chrome/browser/history/download_database.cc View 3 chunks +3 lines, -14 lines 0 comments Download
M chrome/browser/history/history.h View 1 chunk +0 lines, -7 lines 0 comments Download
M chrome/browser/history/history.cc View 1 chunk +0 lines, -7 lines 0 comments Download
M chrome/browser/history/history_backend.h View 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/history/history_backend.cc View 1 chunk +0 lines, -11 lines 0 comments Download
M chrome/browser/history/history_marshaling.h View 1 chunk +0 lines, -5 lines 0 comments Download
M chrome/browser/profiles/profile_io_data.h View 2 chunks +0 lines, -2 lines 0 comments Download
M chrome/browser/profiles/profile_io_data.cc View 3 chunks +1 line, -4 lines 0 comments Download
M content/browser/download/download_file_manager.h View 4 chunks +16 lines, -11 lines 0 comments Download
M content/browser/download/download_file_manager.cc View 17 chunks +50 lines, -47 lines 0 comments Download
D content/browser/download/download_id.h View 1 chunk +0 lines, -87 lines 0 comments Download
D content/browser/download/download_id.cc View 1 chunk +0 lines, -9 lines 0 comments Download
M content/browser/download/download_item.h View 4 chunks +1 line, -4 lines 0 comments Download
M content/browser/download/download_item.cc View 5 chunks +7 lines, -11 lines 0 comments Download
M content/browser/download/download_manager.h View 5 chunks +0 lines, -28 lines 0 comments Download
M content/browser/download/download_manager.cc View 6 chunks +9 lines, -38 lines 0 comments Download
M content/browser/download/download_resource_handler.h View 3 chunks +10 lines, -13 lines 0 comments Download
M content/browser/download/download_resource_handler.cc View 6 chunks +5 lines, -6 lines 0 comments Download
M content/browser/download/save_package.cc View 1 chunk +4 lines, -1 line 0 comments Download
M content/browser/renderer_host/buffered_resource_handler.cc View 2 chunks +0 lines, -4 lines 0 comments Download
M content/browser/renderer_host/resource_dispatcher_host.cc View 4 chunks +2 lines, -5 lines 0 comments Download
M content/browser/renderer_host/resource_dispatcher_host_unittest.cc View 4 chunks +0 lines, -12 lines 0 comments Download
M content/browser/resource_context.h View 3 chunks +0 lines, -7 lines 0 comments Download
M content/browser/resource_context.cc View 1 chunk +0 lines, -12 lines 0 comments Download
M content/content_browser.gypi View 1 chunk +0 lines, -2 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
dmac
9 years, 3 months ago (2011-08-29 18:43:44 UTC) #1
benjhayden
Thanks!
9 years, 3 months ago (2011-08-29 18:58:21 UTC) #2
benjhayden
9 years, 3 months ago (2011-08-29 18:58:31 UTC) #3
LGTM

Powered by Google App Engine
This is Rietveld 408576698