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

Unified Diff: src/platform/update_engine/download_action.h

Issue 466036: AU: Beginnings of delta support (Closed)
Patch Set: Created 11 years 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: src/platform/update_engine/download_action.h
diff --git a/src/platform/update_engine/download_action.h b/src/platform/update_engine/download_action.h
index 9abbdcf9cc04f53e239ce0c3df6bddfdf8133923..e6939e125e231bc43b9e567753781080a352dc88 100644
--- a/src/platform/update_engine/download_action.h
+++ b/src/platform/update_engine/download_action.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UPDATE_ENGINE_DOWNLOAD_ACTION_H__
-#define UPDATE_ENGINE_DOWNLOAD_ACTION_H__
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__
#include <sys/types.h>
#include <sys/stat.h>
@@ -19,11 +19,11 @@
#include "update_engine/decompressing_file_writer.h"
#include "update_engine/file_writer.h"
#include "update_engine/http_fetcher.h"
+#include "update_engine/install_plan.h"
#include "update_engine/omaha_hash_calculator.h"
// The Download Action downloads a requested url to a specified path on disk.
-// It takes no input object, but if successful, passes the output path
-// to the output pipe.
+// The url and output path are determined by the InstallPlan passed in.
using std::map;
using std::string;
@@ -36,10 +36,9 @@ class NoneType;
template<>
class ActionTraits<DownloadAction> {
public:
- // Does not take an object for input
- typedef NoneType InputObjectType;
- // On success, puts the output path on output
- typedef std::string OutputObjectType;
+ // Takes and returns an InstallPlan
+ typedef InstallPlan InputObjectType;
+ typedef InstallPlan OutputObjectType;
};
class DownloadAction : public Action<DownloadAction>,
@@ -47,11 +46,8 @@ class DownloadAction : public Action<DownloadAction>,
public:
// Takes ownership of the passed in HttpFetcher. Useful for testing.
// A good calling pattern is:
- // DownloadAction(..., new WhateverHttpFetcher);
- DownloadAction(const std::string& url, const std::string& output_path,
- off_t size, const std::string& hash,
- const bool should_decompress,
- HttpFetcher* http_fetcher);
+ // DownloadAction(new WhateverHttpFetcher);
+ DownloadAction(HttpFetcher* http_fetcher);
virtual ~DownloadAction();
typedef ActionTraits<DownloadAction>::InputObjectType InputObjectType;
typedef ActionTraits<DownloadAction>::OutputObjectType OutputObjectType;
@@ -59,7 +55,8 @@ class DownloadAction : public Action<DownloadAction>,
void TerminateProcessing();
// Debugging/logging
- std::string Type() const { return "DownloadAction"; }
+ static std::string StaticType() { return "DownloadAction"; }
+ std::string Type() const { return StaticType(); }
// Delegate methods (see http_fetcher.h)
virtual void ReceivedBytes(HttpFetcher *fetcher,
@@ -71,17 +68,17 @@ class DownloadAction : public Action<DownloadAction>,
const size_t size_;
// URL to download
- const std::string url_;
+ std::string url_;
// Path to save URL to
- const std::string output_path_;
+ std::string output_path_;
// Expected hash of the file. The hash must match for this action to
// succeed.
- const std::string hash_;
+ std::string hash_;
// Whether the caller requested that we decompress the downloaded data.
- const bool should_decompress_;
+ bool should_decompress_;
// The FileWriter that downloaded data should be written to. It will
// either point to *decompressing_file_writer_ or *direct_file_writer_.
@@ -107,4 +104,4 @@ COMPILE_ASSERT(8 == sizeof(off_t), off_t_not_64_bit);
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DOWNLOAD_ACTION_H__
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__
« no previous file with comments | « src/platform/update_engine/decompressing_file_writer.cc ('k') | src/platform/update_engine/download_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698