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

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

Issue 10074001: Initial implementation of the ByteStream refactor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Checkpoint and merge to LKGR. Created 8 years, 8 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 | « content/browser/download/download_file.h ('k') | content/browser/download/download_file_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_file_impl.h
diff --git a/content/browser/download/download_file_impl.h b/content/browser/download/download_file_impl.h
index ab39c1402c06d752583309f246044335d0912f84..c6bfba1a982b026afbe42afb5e85fd2b13e559b3 100644
--- a/content/browser/download/download_file_impl.h
+++ b/content/browser/download/download_file_impl.h
@@ -10,9 +10,12 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "base/timer.h"
#include "content/browser/download/base_file.h"
+#include "content/browser/download/byte_stream.h"
#include "content/browser/download/download_request_handle.h"
+#include "net/base/net_log.h"
class PowerSaveBlocker;
@@ -36,12 +39,9 @@ class CONTENT_EXPORT DownloadFileImpl : virtual public content::DownloadFile {
// DownloadFile functions.
virtual net::Error Initialize() OVERRIDE;
- virtual net::Error AppendDataToFile(const char* data,
- size_t data_len) OVERRIDE;
virtual net::Error Rename(const FilePath& full_path) OVERRIDE;
virtual void Detach() OVERRIDE;
virtual void Cancel() OVERRIDE;
- virtual void Finish() OVERRIDE;
virtual void AnnotateWithSourceInformation() OVERRIDE;
virtual FilePath FullPath() const OVERRIDE;
virtual bool InProgress() const OVERRIDE;
@@ -55,13 +55,26 @@ class CONTENT_EXPORT DownloadFileImpl : virtual public content::DownloadFile {
virtual const content::DownloadId& GlobalId() const OVERRIDE;
virtual std::string DebugString() const OVERRIDE;
+ protected: // For test class overrides.
+ virtual net::Error AppendDataToFile(const char* data,
+ size_t data_len);
+
private:
+ // Called when there's some activity on input_pipe_ that needs to be
+ // handled.
+ void PipeActive();
+
// Send updates on our progress.
void SendUpdate();
// The base file instance.
BaseFile file_;
+ // The pipe through which data comes.
+ // TODO(rdsmith): Move this into BaseFile; requires using the same
+ // pipe semantics in SavePackage.
+ scoped_refptr<content::ByteStream> input_pipe_;
+
// The unique identifier for this download, assigned at creation by
// the DownloadFileManager for its internal record keeping.
content::DownloadId id_;
@@ -76,6 +89,10 @@ class CONTENT_EXPORT DownloadFileImpl : virtual public content::DownloadFile {
// DownloadManager this download belongs to.
scoped_refptr<content::DownloadManager> download_manager_;
+ net::BoundNetLog bound_net_log_;
+
+ base::WeakPtrFactory<DownloadFileImpl> weak_factory_;
+
// RAII handle to keep the system from sleeping while we're downloading.
scoped_ptr<PowerSaveBlocker> power_save_blocker_;
« no previous file with comments | « content/browser/download/download_file.h ('k') | content/browser/download/download_file_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698