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

Unified Diff: content/browser/download/download_resource_handler.h

Issue 8404049: Added member data to classes to support download resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk 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_resource_handler.h
diff --git a/content/browser/download/download_resource_handler.h b/content/browser/download/download_resource_handler.h
index a7dc77cfec5653e1c54c2738e481863667ca77d4..0b1d035b864f5090809c307ddec05ff2688b549f 100644
--- a/content/browser/download/download_resource_handler.h
+++ b/content/browser/download/download_resource_handler.h
@@ -11,10 +11,11 @@
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "base/timer.h"
-#include "content/browser/download/download_file.h"
#include "content/browser/download/download_id.h"
+#include "content/browser/download/download_types.h"
#include "content/browser/renderer_host/global_request_id.h"
#include "content/browser/renderer_host/resource_handler.h"
+#include "net/base/net_errors.h"
class DownloadFileManager;
class ResourceDispatcherHost;
@@ -77,6 +78,14 @@ class DownloadResourceHandler : public ResourceHandler {
void set_content_disposition(const std::string& content_disposition);
+ // Request had a network error, and a new request must be issued. Should be
+ // used only by |ResourceDispatcherHost::BeginDownload()|.
+ void set_was_interrupted(bool interrupted) { was_interrupted_ = interrupted; }
+
+ // How many bytes were read before this request was interrupted. Should be
+ // used only by |ResourceDispatcherHost::BeginDownload()|.
+ void set_interrupted_bytes(int64 bytes) { interrupted_bytes_ = bytes; }
+
void CheckWriteProgress();
std::string DebugString() const;
@@ -103,6 +112,8 @@ class DownloadResourceHandler : public ResourceHandler {
bool is_paused_;
base::OneShotTimer<DownloadResourceHandler> pause_timer_;
base::TimeTicks download_start_time_; // used to collect stats.
+ bool was_interrupted_;
+ int64 interrupted_bytes_;
static const int kReadBufSize = 32768; // bytes
static const size_t kLoadsToWrite = 100; // number of data buffers queued
static const int kThrottleTimeMs = 200; // milliseconds

Powered by Google App Engine
This is Rietveld 408576698