OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #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.
| |
6 #define COMPONENTS_DOWNLOAD_INTERNAL_DOWNLOAD_ENTRY_H_ | |
7 | |
8 #include "base/files/file_path.h" | |
9 #include "base/optional.h" | |
10 #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.
| |
11 #include "components/download/public/client.h" | |
12 #include "components/download/public/clients.h" | |
13 #include "components/download/public/download_params.h" | |
14 | |
15 namespace download { | |
16 | |
17 // An entry in the Model that represents a scheduled download. | |
18 struct Entry { | |
19 public: | |
20 enum class State { | |
21 // A newly added download. The Entry is not guaranteed to be persisted in | |
22 // the model yet. | |
23 NEW = 0, | |
24 | |
25 // The download has been persisted and is available to start, pending | |
26 // scheduler criteria. | |
27 AVAILABLE = 1, | |
28 | |
29 // The download is active. The DownloadDriver is aware of it and it is | |
30 // either being downloaded or suspended by the scheduler due to device | |
31 // characteristics or throttling. | |
32 ACTIVE = 2, | |
33 | |
34 // The download has been paused by the owning Client. The download will not | |
35 // be run until it is resumed by the Client. | |
36 PAUSED = 3, | |
37 | |
38 // The download is 'complete' by some definition of that term (could have | |
39 // failed, could have succeeded, etc.). It is ready to have UMA logs saved. | |
40 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
| |
41 | |
42 // The download is finished. We are leaving this entry around to make sure | |
43 // the files on disk are cleaned up. | |
44 WATCHDOG = 5, | |
45 }; | |
46 | |
47 Entry(); | |
48 Entry(const Entry& other); | |
49 ~Entry(); | |
50 | |
51 // The feature that is requesting this download. | |
52 DownloadClient client; | |
53 | |
54 // A unique GUID that represents this download. See | base::GenerateGUID()|. | |
55 std::string guid; | |
56 | |
57 // The parameters that determine under what device conditions this download | |
58 // will occur. | |
59 SchedulingParams scheduling_params; | |
60 | |
61 // The parameters that define the actual download request to make. | |
62 RequestParams request_params; | |
63 | |
64 // The state of the download to help the scheduler and loggers make the right | |
65 // decisions about the download object. | |
66 State state; | |
67 }; | |
68 | |
69 } // namespace download | |
70 | |
71 #endif // COMPONENTS_DOWNLOAD_INTERNAL_MODEL_H_ | |
OLD | NEW |