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

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

Issue 2233493003: [Offline Pages] Remove expired requests from the queue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merging. Created 4 years, 4 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 #include "components/offline_pages/background/request_coordinator.h" 5 #include "components/offline_pages/background/request_coordinator.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 policy_(std::move(policy)), 63 policy_(std::move(policy)),
64 factory_(std::move(factory)), 64 factory_(std::move(factory)),
65 queue_(std::move(queue)), 65 queue_(std::move(queue)),
66 scheduler_(std::move(scheduler)), 66 scheduler_(std::move(scheduler)),
67 active_request_(nullptr), 67 active_request_(nullptr),
68 last_offlining_status_(Offliner::RequestStatus::UNKNOWN), 68 last_offlining_status_(Offliner::RequestStatus::UNKNOWN),
69 offliner_timeout_(base::TimeDelta::FromSeconds( 69 offliner_timeout_(base::TimeDelta::FromSeconds(
70 policy_->GetSinglePageTimeLimitInSeconds())), 70 policy_->GetSinglePageTimeLimitInSeconds())),
71 weak_ptr_factory_(this) { 71 weak_ptr_factory_(this) {
72 DCHECK(policy_ != nullptr); 72 DCHECK(policy_ != nullptr);
73 picker_.reset(new RequestPicker(queue_.get(), policy_.get())); 73 picker_.reset(new RequestPicker(queue_.get(), policy_.get(), this));
74 } 74 }
75 75
76 RequestCoordinator::~RequestCoordinator() {} 76 RequestCoordinator::~RequestCoordinator() {}
77 77
78 bool RequestCoordinator::SavePageLater( 78 bool RequestCoordinator::SavePageLater(
79 const GURL& url, const ClientId& client_id, bool user_requested) { 79 const GURL& url, const ClientId& client_id, bool user_requested) {
80 DVLOG(2) << "URL is " << url << " " << __func__; 80 DVLOG(2) << "URL is " << url << " " << __func__;
81 81
82 if (!OfflinePageModel::CanSaveURL(url)) { 82 if (!OfflinePageModel::CanSaveURL(url)) {
83 DVLOG(1) << "Not able to save page for requested url: " << url; 83 DVLOG(1) << "Not able to save page for requested url: " << url;
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 OnRemoved(request, SavePageStatus::REMOVED_BY_CLIENT)); 414 OnRemoved(request, SavePageStatus::REMOVED_BY_CLIENT));
415 } 415 }
416 416
417 void RequestCoordinator::GetOffliner() { 417 void RequestCoordinator::GetOffliner() {
418 if (!offliner_) { 418 if (!offliner_) {
419 offliner_ = factory_->GetOffliner(policy_.get()); 419 offliner_ = factory_->GetOffliner(policy_.get());
420 } 420 }
421 } 421 }
422 422
423 } // namespace offline_pages 423 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698