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

Side by Side Diff: components/offline_pages/background/offliner_policy_utils.cc

Issue 2543093002: Split the RequestPicker task into two separate tasks. (Closed)
Patch Set: CR feedback per FGorski and DougArnett Created 4 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/offline_pages/background/offliner_policy_utils.h"
6
7 #include "components/offline_pages/background/offliner_policy.h"
8 #include "components/offline_pages/background/save_page_request.h"
9
10 namespace offline_pages {
11
12 // static function to check request expiration or cleanup status.
13 OfflinerPolicyUtils::RequestExpirationStatus
14 OfflinerPolicyUtils::CheckRequestExpirationStatus(SavePageRequest* request,
15 OfflinerPolicy* policy) {
fgorski 2016/12/05 21:05:37 Could you dcheck parameters here? Also, is there
Pete Williamson 2016/12/06 00:25:38 Done.
16 if (base::Time::Now() - request->creation_time() >=
17 base::TimeDelta::FromSeconds(
18 policy->GetRequestExpirationTimeInSeconds())) {
19 return RequestExpirationStatus::EXPIRED;
20 }
21 if (request->started_attempt_count() >= policy->GetMaxStartedTries())
22 return RequestExpirationStatus::START_COUNT_EXCEEDED;
23
24 if (request->completed_attempt_count() >= policy->GetMaxCompletedTries())
25 return RequestExpirationStatus::COMPLETION_COUNT_EXCEEDED;
26
27 return RequestExpirationStatus::VALID;
28 }
29
30 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698