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

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: Constant renaming per DewittJ 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
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e0ff976c5ac3ea9554bb518ee712e8fc4b74c379 100644
--- a/components/offline_pages/background/request_coordinator.h
+++ b/components/offline_pages/background/request_coordinator.h
@@ -10,6 +10,8 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/time/time.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 +119,10 @@ class RequestCoordinator : public KeyedService {
// if needed.
void GetOffliner();
+ void SetOfflinerTimeoutForTest(const base::TimeDelta& timeout) {
+ offliner_timeout_ = timeout;
+ }
+
friend class RequestCoordinatorTest;
// The offliner can only handle one request at a time - if the offliner is
@@ -125,6 +131,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 request before giving up.
+ base::TimeDelta offliner_timeout_;
// Unowned pointer to the current offliner, if any.
Offliner* offliner_;
// RequestCoordinator takes over ownership of the policy
@@ -143,6 +151,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_;
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698