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

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

Issue 8404049: Added member data to classes to support download resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DownloadSaveInfo::offset is now int64. Created 9 years, 1 month 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/base_file.h
diff --git a/content/browser/download/base_file.h b/content/browser/download/base_file.h
index 2a0994358055c89d9f84c59b1fca13c4f5076f5e..493099630bbd7e32aa130e46132ccde32a6cea47 100644
--- a/content/browser/download/base_file.h
+++ b/content/browser/download/base_file.h
@@ -33,6 +33,7 @@ class CONTENT_EXPORT BaseFile {
const GURL& source_url,
const GURL& referrer_url,
int64 received_bytes,
+ const std::string& hash_state,
const linked_ptr<net::FileStream>& file_stream);
virtual ~BaseFile();
@@ -65,10 +66,16 @@ class CONTENT_EXPORT BaseFile {
bool in_progress() const { return file_stream_ != NULL; }
int64 bytes_so_far() const { return bytes_so_far_; }
- // Set |hash| with sha256 digest for the file.
+ // Fills |hash| with the sha256 digest for the file.
// Returns true if digest is successfully calculated.
virtual bool GetSha256Hash(std::string* hash);
+ // Returns the current (intermediate) state of the hash as a byte string.
+ virtual std::string GetSha256HashState();
+
+ // Resets the current state of the hash to the contents of |hash_state_bytes|.
+ virtual bool SetSha256HashState(const std::string& hash_state_bytes);
+
// Returns true if the given hash is considered empty. An empty hash is
// a string of size kSha256HashLen that contains only zeros (initial value
// for the hash).
@@ -114,6 +121,9 @@ class CONTENT_EXPORT BaseFile {
// is set.
scoped_ptr<crypto::SecureHash> secure_hash_;
+ // The hash state is stored here on creation.
+ std::string initial_hash_state_;
+
unsigned char sha256_hash_[kSha256HashLen];
// Indicates that this class no longer owns the associated file, and so

Powered by Google App Engine
This is Rietveld 408576698