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

Unified Diff: chrome/browser/download/download_file_manager.h

Issue 3245005: GTTF: Clean up DownloadFileManager (Closed)
Patch Set: fixes Created 10 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
« no previous file with comments | « chrome/browser/download/download_file.cc ('k') | chrome/browser/download/download_file_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_file_manager.h
diff --git a/chrome/browser/download/download_file_manager.h b/chrome/browser/download/download_file_manager.h
index 15e7d21ef279e7dcfeca8f34e7721343b3efbf31..d51d35f811a7508f6dce0688f753ffb6933ec7e5 100644
--- a/chrome/browser/download/download_file_manager.h
+++ b/chrome/browser/download/download_file_manager.h
@@ -44,7 +44,6 @@
#include "base/basictypes.h"
#include "base/hash_tables.h"
-#include "base/lock.h"
#include "base/ref_counted.h"
#include "base/timer.h"
#include "gfx/native_widget_types.h"
@@ -75,16 +74,17 @@ class DownloadFileManager
// Called on the IO thread
int GetNextId();
+ // Called on UI thread to make DownloadFileManager start the download.
+ void StartDownload(DownloadCreateInfo* info);
+
// Handlers for notifications sent from the IO thread and run on the
// download thread.
- void StartDownload(DownloadCreateInfo* info);
void UpdateDownload(int id, DownloadBuffer* buffer);
void CancelDownload(int id);
void DownloadFinished(int id, DownloadBuffer* buffer);
- // Called on the UI thread to remove a download item or manager.
- void RemoveDownloadManager(DownloadManager* manager);
- void RemoveDownload(int id, DownloadManager* manager);
+ // Called on FILE thread by DownloadManager at the beginning of its shutdown.
+ void OnDownloadManagerShutdown(DownloadManager* manager);
#if !defined(OS_MACOSX)
// The open and show methods run on the file thread, which does not work on
@@ -125,22 +125,14 @@ class DownloadFileManager
// Clean up helper that runs on the download thread.
void OnShutdown();
- // Handlers for notifications sent from the download thread and run on
- // the UI thread.
- void OnStartDownload(DownloadCreateInfo* info);
- void OnDownloadFinished(int id, int64 bytes_so_far);
-
- // Called only on UI thread to get the DownloadManager for a tab's profile.
- static DownloadManager* DownloadManagerFromRenderIds(int render_process_id,
- int review_view_id);
- DownloadManager* GetDownloadManager(int download_id);
+ // Creates DownloadFile on FILE thread and continues starting the download
+ // process.
+ void CreateDownloadFile(DownloadCreateInfo* info,
+ DownloadManager* download_manager);
// Called only on the download thread.
DownloadFile* GetDownloadFile(int id);
- // Called on the UI thread to remove a download from the UI progress table.
- void RemoveDownloadFromUIProgress(int id);
-
// Called only from OnFinalDownloadName or OnIntermediateDownloadName
// on the FILE thread.
void CancelDownloadOnRename(int id);
@@ -152,28 +144,12 @@ class DownloadFileManager
typedef base::hash_map<int, DownloadFile*> DownloadFileMap;
DownloadFileMap downloads_;
- // Throttle updates to the UI thread.
+ // Schedule periodic updates of the download progress. This timer
+ // is controlled from the FILE thread, and posts updates to the UI thread.
base::RepeatingTimer<DownloadFileManager> update_timer_;
ResourceDispatcherHost* resource_dispatcher_host_;
- // Tracking which DownloadManager to send data to, called only on UI thread.
- // DownloadManagerMap maps download IDs to their DownloadManager.
- typedef base::hash_map<int, DownloadManager*> DownloadManagerMap;
- DownloadManagerMap managers_;
-
- // RequestMap maps a DownloadManager to all in-progress download IDs.
- // Called only on the UI thread.
- typedef base::hash_set<int> DownloadRequests;
- typedef std::map<DownloadManager*, DownloadRequests> RequestMap;
- RequestMap requests_;
-
- // Used for progress updates on the UI thread, mapping download->id() to bytes
- // received so far. Written to by the file thread and read by the UI thread.
- typedef base::hash_map<int, int64> ProgressMap;
- ProgressMap ui_progress_;
- Lock progress_lock_;
-
DISALLOW_COPY_AND_ASSIGN(DownloadFileManager);
};
« no previous file with comments | « chrome/browser/download/download_file.cc ('k') | chrome/browser/download/download_file_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698