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

Unified Diff: chrome/browser/chromeos/gdata/gdata_contacts_service.h

Issue 10823182: contacts: Rate-limit GData photo requests and handle 404s. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_contacts_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/gdata_contacts_service.h
diff --git a/chrome/browser/chromeos/gdata/gdata_contacts_service.h b/chrome/browser/chromeos/gdata/gdata_contacts_service.h
index faf4434ead919d37ceb8a11e4b3dc0fbf5d83dcd..a6995c55aa907522e4bb5005c912fbd1a4466b00 100644
--- a/chrome/browser/chromeos/gdata/gdata_contacts_service.h
+++ b/chrome/browser/chromeos/gdata/gdata_contacts_service.h
@@ -68,8 +68,11 @@ class GDataContactsService : public GDataContactsServiceInterface {
GDataAuthService* auth_service_for_testing();
- void set_max_simultaneous_photo_downloads_for_testing(int max_downloads) {
- max_simultaneous_photo_downloads_ = max_downloads;
+ void set_max_photo_downloads_per_second_for_testing(int max_downloads) {
+ max_photo_downloads_per_second_ = max_downloads;
+ }
+ void set_photo_download_timer_interval_for_testing(base::TimeDelta interval) {
+ photo_download_timer_interval_ = interval;
}
void set_feed_url_for_testing(const GURL& url) {
feed_url_for_testing_ = url;
@@ -98,15 +101,20 @@ class GDataContactsService : public GDataContactsServiceInterface {
// In-progress download requests. Pointers are owned by this class.
std::set<DownloadContactsRequest*> requests_;
+ // Maximum number of photos we'll try to download per second (per
+ // DownloadContacts() request).
+ int max_photo_downloads_per_second_;
+
+ // Amount of time that we'll wait between waves of photo download requests.
+ // This is usually one second (see |max_photo_downloads_per_second_|) but can
+ // be set to a lower value for tests to make them complete more quickly.
+ base::TimeDelta photo_download_timer_interval_;
+
// If non-empty, URL that will be used to fetch the feed. URLs contained
// within the feed will also be modified to use the host and port from this
// member.
GURL feed_url_for_testing_;
- // Maximum number of photos we'll try to download at once (per
- // DownloadContacts() request).
- int max_simultaneous_photo_downloads_;
-
// Callback that's invoked to rewrite photo URLs for tests.
// This is needed for tests that serve static feed data from a host/port
// that's only known at runtime.
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_contacts_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698