Chromium Code Reviews| Index: components/suggestions/suggestions_service.cc |
| diff --git a/components/suggestions/suggestions_service.cc b/components/suggestions/suggestions_service.cc |
| index 181a3d8c8c1865239df5419da5fb104e94db52ea..2ba5736958585642fc018d64834e6f47822c14e3 100644 |
| --- a/components/suggestions/suggestions_service.cc |
| +++ b/components/suggestions/suggestions_service.cc |
| @@ -313,6 +313,7 @@ void SuggestionsService::OnURLFetchComplete(const net::URLFetcher* source) { |
| } else if (suggestions.ParseFromString(suggestions_data)) { |
| LogResponseState(RESPONSE_VALID); |
| thumbnail_manager_->Initialize(suggestions); |
| + AddDefaultExpiryTimestamps(&suggestions); |
| suggestions_store_->StoreSuggestions(suggestions); |
| } else { |
| LogResponseState(RESPONSE_INVALID); |
| @@ -323,6 +324,25 @@ void SuggestionsService::OnURLFetchComplete(const net::URLFetcher* source) { |
| ScheduleBlacklistUpload(true); |
| } |
| + |
| +void SuggestionsService::AddDefaultExpiryTimestamps( |
| + SuggestionsProfile* suggestions){ |
|
manzagop (departed)
2014/07/31 15:31:50
Indent is wrong. You also want a space between ){
gayane -on leave until 09-2017
2014/08/04 13:46:30
Done.
|
| + |
| + // now + 72 hours |
|
manzagop (departed)
2014/07/31 15:31:50
I don't think the comment adds much.
gayane -on leave until 09-2017
2014/08/04 13:46:30
I have removed the comments and renamed default_ex
|
| + int64 now = (base::Time::NowFromSystemTime() |
|
manzagop (departed)
2014/07/31 15:31:50
now_usec?
gayane -on leave until 09-2017
2014/08/04 13:46:30
Done.
|
| + -base::Time::UnixEpoch()).ToInternalValue(); |
| + int64 default_expiry = 72; |
| + int64 timestamp = now + default_expiry * 60 * 60 * 1000 * 1000; |
|
manzagop (departed)
2014/07/31 15:31:50
expiry_timestamp_usec?
gayane -on leave until 09-2017
2014/08/04 13:46:30
Done.
|
| + |
| + for (int i = 0; i < suggestions->suggestions_size(); i++) { |
|
manzagop (departed)
2014/07/31 15:31:50
Preincrement i. See the other comment for details.
gayane -on leave until 09-2017
2014/08/04 13:46:30
Done.
|
| + auto* suggestion = suggestions->mutable_suggestions(i); |
|
manzagop (departed)
2014/07/31 15:31:50
No auto in chromium afaik.
gayane -on leave until 09-2017
2014/08/04 13:46:30
Done.
|
| + |
| + if (!suggestion->has_expiry_ts()){ |
| + suggestion->set_expiry_ts(timestamp); |
| + } |
| + } |
| +} |
| + |
| void SuggestionsService::Shutdown() { |
| // Cancel pending request and timeout closure, then serve existing requestors |
| // from cache. |