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

Side by Side Diff: components/offline_pages/core/prefetch/prefetch_item.h

Issue 2879013002: Create skeleton for the Prefetching store and initial pipeline step. (Closed)
Patch Set: Made construction params a cost&. Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_ITEM_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_ITEM_H_
6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_ITEM_H_ 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_ITEM_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "components/offline_pages/core/client_id.h"
11 #include "components/offline_pages/core/prefetch/prefetch_types.h" 12 #include "components/offline_pages/core/prefetch/prefetch_types.h"
12 #include "url/gurl.h" 13 #include "url/gurl.h"
13 14
14 namespace offline_pages { 15 namespace offline_pages {
15 16
16 // Data object representing an item progressing through the prefetching process 17 // Data object representing an item progressing through the prefetching process
17 // from the moment a URL is requested by a client until its processing is done, 18 // from the moment a URL is requested by a client until its processing is done,
18 // successfully or not. 19 // successfully or not.
19 // Instances of this class are in-memory representations of items in (or to be 20 // Instances of this class are in-memory representations of items in (or to be
20 // inserted into) the persistent prefetching data store. 21 // inserted into) the persistent prefetching data store.
21 struct PrefetchItem { 22 struct PrefetchItem {
22 PrefetchItem(); 23 PrefetchItem();
23 explicit PrefetchItem(const PrefetchItem& other); 24 explicit PrefetchItem(const PrefetchItem& other);
24 25
25 ~PrefetchItem(); 26 ~PrefetchItem();
26 27
27 bool operator==(const PrefetchItem& other) const; 28 bool operator==(const PrefetchItem& other) const;
28 bool operator!=(const PrefetchItem& other) const; 29 bool operator!=(const PrefetchItem& other) const;
29 30
30 // Primary key/ID for this prefetch item (See |base::GenerateGUID()|). This 31 // Primary key/ID for this prefetch item (See |base::GenerateGUID()|). This
31 // value will be reused when communicating with other systems accepting GUID 32 // value will be reused when communicating with other systems accepting GUID
32 // identifiers for operations linked to this item. 33 // identifiers for operations linked to this item.
33 std::string guid; 34 std::string guid;
34 35
35 // Externally provided namespace and id values so that this item can be 36 // Data composed of a namespace and an uid values to allow this item to be
36 // uniquely identified by the client requesting it. It is the client's 37 // uniquely identified by the client that requested it.
37 // responsibility to make sure the id is unique within the context of its 38 ClientId client_id;
38 // assigned namespace.
39 std::string client_name_space;
40 std::string client_id;
41 39
42 // Current prefetching progress state. 40 // Current prefetching progress state.
43 PrefetchItemState state = PrefetchItemState::NEW_REQUEST; 41 PrefetchItemState state = PrefetchItemState::NEW_REQUEST;
44 42
45 // The URL of the page the client requested to be prefetched. 43 // The URL of the page the client requested to be prefetched.
46 GURL url; 44 GURL url;
47 45
48 // The final URL whose page was actually included in a successfully created 46 // The final URL whose page was actually included in a successfully created
49 // archive after redirects, if it was different than the |url|. It will be 47 // archive after redirects, if it was different than the |url|. It will be
50 // left empty if they are the same. 48 // left empty if they are the same.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 base::Time freshness_time; 81 base::Time freshness_time;
84 82
85 // The reason why the item was set to the FINISHED state. Should be 83 // The reason why the item was set to the FINISHED state. Should be
86 // disregarded until reaching that state. 84 // disregarded until reaching that state.
87 PrefetchItemErrorCode error_code = PrefetchItemErrorCode::SUCCESS; 85 PrefetchItemErrorCode error_code = PrefetchItemErrorCode::SUCCESS;
88 }; 86 };
89 87
90 } // namespace offline_pages 88 } // namespace offline_pages
91 89
92 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_ITEM_H_ 90 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698