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

Side by Side Diff: components/offline_pages/core/background/save_page_request.h

Issue 2804543003: [Offline Pages] Remove activation time for background loading. (Closed)
Patch Set: Keep schema. Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_BACKGROUND_SAVE_PAGE_REQUEST_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_SAVE_PAGE_REQUEST_H_
6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_SAVE_PAGE_REQUEST_H_ 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_SAVE_PAGE_REQUEST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 10 matching lines...) Expand all
21 AVAILABLE = 0, // Request can be scheduled when preconditions are met. 21 AVAILABLE = 0, // Request can be scheduled when preconditions are met.
22 PAUSED = 1, // Request is not available until it is unpaused. 22 PAUSED = 1, // Request is not available until it is unpaused.
23 OFFLINING = 2, // Request is actively offlining. 23 OFFLINING = 2, // Request is actively offlining.
24 }; 24 };
25 25
26 SavePageRequest(int64_t request_id, 26 SavePageRequest(int64_t request_id,
27 const GURL& url, 27 const GURL& url,
28 const ClientId& client_id, 28 const ClientId& client_id,
29 const base::Time& creation_time, 29 const base::Time& creation_time,
30 const bool user_requested); 30 const bool user_requested);
31 SavePageRequest(int64_t request_id,
32 const GURL& url,
33 const ClientId& client_id,
34 const base::Time& creation_time,
35 const base::Time& activation_time,
36 const bool user_requested);
37 SavePageRequest(const SavePageRequest& other); 31 SavePageRequest(const SavePageRequest& other);
38 ~SavePageRequest(); 32 ~SavePageRequest();
39 33
40 bool operator==(const SavePageRequest& other) const; 34 bool operator==(const SavePageRequest& other) const;
41 35
42 // Updates the |last_attempt_time_| and increments |attempt_count_|. 36 // Updates the |last_attempt_time_| and increments |attempt_count_|.
43 void MarkAttemptStarted(const base::Time& start_time); 37 void MarkAttemptStarted(const base::Time& start_time);
44 38
45 // Marks attempt as completed and clears |last_attempt_time_|. 39 // Marks attempt as completed and clears |last_attempt_time_|.
46 void MarkAttemptCompleted(); 40 void MarkAttemptCompleted();
(...skipping 10 matching lines...) Expand all
57 51
58 const GURL& url() const { return url_; } 52 const GURL& url() const { return url_; }
59 53
60 const ClientId& client_id() const { return client_id_; } 54 const ClientId& client_id() const { return client_id_; }
61 55
62 RequestState request_state() const { return state_; } 56 RequestState request_state() const { return state_; }
63 void set_request_state(RequestState new_state) { state_ = new_state; } 57 void set_request_state(RequestState new_state) { state_ = new_state; }
64 58
65 const base::Time& creation_time() const { return creation_time_; } 59 const base::Time& creation_time() const { return creation_time_; }
66 60
67 const base::Time& activation_time() const { return activation_time_; }
68
69 int64_t started_attempt_count() const { return started_attempt_count_; } 61 int64_t started_attempt_count() const { return started_attempt_count_; }
70 void set_started_attempt_count(int64_t started_attempt_count) { 62 void set_started_attempt_count(int64_t started_attempt_count) {
71 started_attempt_count_ = started_attempt_count; 63 started_attempt_count_ = started_attempt_count;
72 } 64 }
73 65
74 int64_t completed_attempt_count() const { return completed_attempt_count_; } 66 int64_t completed_attempt_count() const { return completed_attempt_count_; }
75 void set_completed_attempt_count(int64_t completed_attempt_count) { 67 void set_completed_attempt_count(int64_t completed_attempt_count) {
76 completed_attempt_count_ = completed_attempt_count; 68 completed_attempt_count_ = completed_attempt_count;
77 } 69 }
78 70
(...skipping 20 matching lines...) Expand all
99 // Online URL of a page to be offlined. 91 // Online URL of a page to be offlined.
100 GURL url_; 92 GURL url_;
101 93
102 // Client ID related to the request. Contains namespace and ID assigned by the 94 // Client ID related to the request. Contains namespace and ID assigned by the
103 // requester. 95 // requester.
104 ClientId client_id_; 96 ClientId client_id_;
105 97
106 // Time when this request was created. (Alternative 2). 98 // Time when this request was created. (Alternative 2).
107 base::Time creation_time_; 99 base::Time creation_time_;
108 100
109 // Time when this request will become active.
110 base::Time activation_time_;
111
112 // Number of attempts started to get the page. This may be different than the 101 // Number of attempts started to get the page. This may be different than the
113 // number of attempts completed because we could crash. 102 // number of attempts completed because we could crash.
114 int started_attempt_count_; 103 int started_attempt_count_;
115 104
116 // Number of attempts we actually completed to get the page. 105 // Number of attempts we actually completed to get the page.
117 int completed_attempt_count_; 106 int completed_attempt_count_;
118 107
119 // Timestamp of the last request starting. 108 // Timestamp of the last request starting.
120 base::Time last_attempt_time_; 109 base::Time last_attempt_time_;
121 110
122 // Whether the user specifically requested this page (as opposed to a client 111 // Whether the user specifically requested this page (as opposed to a client
123 // like AGSA or Now.) 112 // like AGSA or Now.)
124 bool user_requested_; 113 bool user_requested_;
125 114
126 // The current state of this request 115 // The current state of this request
127 RequestState state_; 116 RequestState state_;
128 117
129 // The original URL of the page to be offlined. Empty if no redirect occurs. 118 // The original URL of the page to be offlined. Empty if no redirect occurs.
130 GURL original_url_; 119 GURL original_url_;
131 }; 120 };
132 121
133 } // namespace offline_pages 122 } // namespace offline_pages
134 123
135 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_SAVE_PAGE_REQUEST_H_ 124 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_SAVE_PAGE_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698