Chromium Code Reviews| Index: components/download/internal/entry.h |
| diff --git a/components/download/internal/entry.h b/components/download/internal/entry.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..df64c9472152287a7b9a1b5876c3530d213d0d9f |
| --- /dev/null |
| +++ b/components/download/internal/entry.h |
| @@ -0,0 +1,71 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_DOWNLOAD_INTERNAL_DOWNLOAD_ENTRY_H_ |
|
xingliu
2017/05/09 06:11:41
INTERNAL_ENTRY_H_.
David Trainor- moved to gerrit
2017/05/15 15:59:51
Done.
|
| +#define COMPONENTS_DOWNLOAD_INTERNAL_DOWNLOAD_ENTRY_H_ |
| + |
| +#include "base/files/file_path.h" |
| +#include "base/optional.h" |
| +#include "base/time/time.h" |
|
xingliu
2017/05/09 06:11:41
nit: Maybe we can remove the above 3 headers.
David Trainor- moved to gerrit
2017/05/15 15:59:51
Done.
|
| +#include "components/download/public/client.h" |
| +#include "components/download/public/clients.h" |
| +#include "components/download/public/download_params.h" |
| + |
| +namespace download { |
| + |
| +// An entry in the Model that represents a scheduled download. |
| +struct Entry { |
| + public: |
| + enum class State { |
| + // A newly added download. The Entry is not guaranteed to be persisted in |
| + // the model yet. |
| + NEW = 0, |
| + |
| + // The download has been persisted and is available to start, pending |
| + // scheduler criteria. |
| + AVAILABLE = 1, |
| + |
| + // The download is active. The DownloadDriver is aware of it and it is |
| + // either being downloaded or suspended by the scheduler due to device |
| + // characteristics or throttling. |
| + ACTIVE = 2, |
| + |
| + // The download has been paused by the owning Client. The download will not |
| + // be run until it is resumed by the Client. |
| + PAUSED = 3, |
| + |
| + // The download is 'complete' by some definition of that term (could have |
| + // failed, could have succeeded, etc.). It is ready to have UMA logs saved. |
| + DUMP_STATS = 4, |
|
xingliu
2017/05/09 06:11:41
optional nit: not sure, but do we really like to m
David Trainor- moved to gerrit
2017/05/09 15:59:26
Probably not. I do want all logging for all possi
Peter Beverloo
2017/05/10 12:44:45
If you want to validate state transitions, maybe j
David Trainor- moved to gerrit
2017/05/15 15:59:51
Yeah the plan was to pretty much immediately trans
|
| + |
| + // The download is finished. We are leaving this entry around to make sure |
| + // the files on disk are cleaned up. |
| + WATCHDOG = 5, |
| + }; |
| + |
| + Entry(); |
| + Entry(const Entry& other); |
| + ~Entry(); |
| + |
| + // The feature that is requesting this download. |
| + DownloadClient client; |
| + |
| + // A unique GUID that represents this download. See | base::GenerateGUID()|. |
| + std::string guid; |
| + |
| + // The parameters that determine under what device conditions this download |
| + // will occur. |
| + SchedulingParams scheduling_params; |
| + |
| + // The parameters that define the actual download request to make. |
| + RequestParams request_params; |
| + |
| + // The state of the download to help the scheduler and loggers make the right |
| + // decisions about the download object. |
| + State state; |
| +}; |
| + |
| +} // namespace download |
| + |
| +#endif // COMPONENTS_DOWNLOAD_INTERNAL_MODEL_H_ |