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

Unified Diff: components/offline_pages/background/request_coordinator.h

Issue 2119613002: Adds a prerenderer watchdog timer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/background/request_coordinator.h
diff --git a/components/offline_pages/background/request_coordinator.h b/components/offline_pages/background/request_coordinator.h
index 624808c3962a529b4d05aed882a32eca670abbd2..18c25bd40f484f081f72d54490f39f13890e06a4 100644
--- a/components/offline_pages/background/request_coordinator.h
+++ b/components/offline_pages/background/request_coordinator.h
@@ -10,6 +10,7 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/timer/timer.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/offline_pages/background/device_conditions.h"
#include "components/offline_pages/background/offliner.h"
@@ -117,6 +118,10 @@ class RequestCoordinator : public KeyedService {
// if needed.
void GetOffliner();
+ void SetOfflinerTimeoutForTest(long timeout) {
+ offliner_timeout_ = timeout;
+ }
+
friend class RequestCoordinatorTest;
// The offliner can only handle one request at a time - if the offliner is
@@ -125,6 +130,8 @@ class RequestCoordinator : public KeyedService {
bool is_busy_;
// True if the current request has been canceled.
bool is_canceled_;
+ // How long to wait for an offliner before giving up.
dougarnett 2016/06/30 19:16:48 ... an offliner request ... ?
Pete Williamson 2016/07/01 17:16:55 Done.
+ long offliner_timeout_;
dewittj 2016/06/30 20:38:33 Please use base::TimeDelta here so the units are u
Pete Williamson 2016/07/01 17:16:55 Done.
// Unowned pointer to the current offliner, if any.
Offliner* offliner_;
// RequestCoordinator takes over ownership of the policy
@@ -143,6 +150,8 @@ class RequestCoordinator : public KeyedService {
base::Callback<void(bool)> scheduler_callback_;
// Logger to record events.
RequestCoordinatorEventLogger event_logger_;
+ // Timer to watch for pre-render attempts running too long.
+ base::OneShotTimer watchdog_timer_;
// Allows us to pass a weak pointer to callbacks.
base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698