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

Unified Diff: components/ntp_snippets/ntp_snippets_service.h

Issue 2227973002: Add request throttler to thumbnail fetching for articles on mobile NTP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/ntp_snippets_service.h
diff --git a/components/ntp_snippets/ntp_snippets_service.h b/components/ntp_snippets/ntp_snippets_service.h
index de27dacdae614e0528620c4487b5e2b37f2a2cb8..72c866dd2ec1f556fd419689f01fb62a38394e79 100644
--- a/components/ntp_snippets/ntp_snippets_service.h
+++ b/components/ntp_snippets/ntp_snippets_service.h
@@ -26,6 +26,7 @@
#include "components/ntp_snippets/ntp_snippets_fetcher.h"
#include "components/ntp_snippets/ntp_snippets_scheduler.h"
#include "components/ntp_snippets/ntp_snippets_status_service.h"
+#include "components/ntp_snippets/request_throttler.h"
#include "components/suggestions/suggestions_service.h"
#include "components/sync_driver/sync_service_observer.h"
@@ -97,17 +98,17 @@ class NTPSnippetsService : public image_fetcher::ImageFetcherDelegate,
bool initialized() const { return ready() || state_ == State::DISABLED; }
// Fetches snippets from the server and adds them to the current ones.
- // Requests can be marked more important by setting |force_request| to true
- // (such request might circumvent the daily quota for requests, etc.) Useful
- // for requests triggered by the user.
- void FetchSnippets(bool force_request);
+ // Requests can be marked more important by setting |interactive_request| to
+ // true (such request might circumvent the daily quota for requests, etc.)
+ // Useful for requests triggered by the user.
+ void FetchSnippets(bool interactive_request);
// Fetches snippets from the server for specified hosts (overriding
// suggestions from the suggestion service) and adds them to the current ones.
// Only called from chrome://snippets-internals, DO NOT USE otherwise!
// Ignored while |loaded()| is false.
void FetchSnippetsFromHosts(const std::set<std::string>& hosts,
- bool force_request);
+ bool interactive_request);
// Available snippets.
const NTPSnippet::PtrVector& snippets() const { return snippets_; }
@@ -307,6 +308,9 @@ class NTPSnippetsService : public image_fetcher::ImageFetcherDelegate,
const Category provided_category_;
+ // Request throttler for limiting requests to thumbnail images.
+ RequestThrottler thumbnail_requests_throttler_;
+
DISALLOW_COPY_AND_ASSIGN(NTPSnippetsService);
};

Powered by Google App Engine
This is Rietveld 408576698