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

Side by Side Diff: chrome/common/net/url_fetcher_protect.h

Issue 3171019: Reland r56483 - Monitor network change in GoogleURLTracker (Closed)
Patch Set: check Chrome Frame Created 10 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
« no previous file with comments | « chrome/common/net/url_fetcher.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // This file implements backoff in the suggest system so that we don't 5 // This file implements backoff in the suggest system so that we don't
6 // DOS the Suggest servers when using URLFetcher. 6 // DOS the Suggest servers when using URLFetcher.
7 7
8 #ifndef CHROME_COMMON_NET_URL_FETCHER_PROTECT_H_ 8 #ifndef CHROME_COMMON_NET_URL_FETCHER_PROTECT_H_
9 #define CHROME_COMMON_NET_URL_FETCHER_PROTECT_H_ 9 #define CHROME_COMMON_NET_URL_FETCHER_PROTECT_H_
10 #pragma once 10 #pragma once
11 11
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // the timeout period. It returns the backoff time, in milliseconds, that 54 // the timeout period. It returns the backoff time, in milliseconds, that
55 // indicates to the sender how long should it wait before sending the request. 55 // indicates to the sender how long should it wait before sending the request.
56 // If the request is allowed to be sent immediately, the backoff time is 0. 56 // If the request is allowed to be sent immediately, the backoff time is 0.
57 int64 UpdateBackoff(EventType event_type); 57 int64 UpdateBackoff(EventType event_type);
58 58
59 // Returns the max retries allowed. 59 // Returns the max retries allowed.
60 int max_retries() const { 60 int max_retries() const {
61 return max_retries_; 61 return max_retries_;
62 } 62 }
63 63
64 // Sets the max retries.
65 void SetMaxRetries(int max_retries) {
66 max_retries_ = max_retries;
67 }
68
64 private: 69 private:
65 // When a request comes, calculate the release time for it. 70 // When a request comes, calculate the release time for it.
66 // Returns the backoff time before sending. 71 // Returns the backoff time before sending.
67 base::TimeDelta AntiOverload(); 72 base::TimeDelta AntiOverload();
68 // Resets backoff when service is ok. 73 // Resets backoff when service is ok.
69 // Returns the backoff time before sending. 74 // Returns the backoff time before sending.
70 base::TimeDelta ResetBackoff(); 75 base::TimeDelta ResetBackoff();
71 // Calculates new backoff when encountering a failure. 76 // Calculates new backoff when encountering a failure.
72 // Returns the backoff time before sending. 77 // Returns the backoff time before sending.
73 base::TimeDelta IncreaseBackoff(); 78 base::TimeDelta IncreaseBackoff();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 typedef std::map<const std::string, URLFetcherProtectEntry*> ProtectService; 143 typedef std::map<const std::string, URLFetcherProtectEntry*> ProtectService;
139 144
140 static Lock lock_; 145 static Lock lock_;
141 static scoped_ptr<URLFetcherProtectManager> protect_manager_; 146 static scoped_ptr<URLFetcherProtectManager> protect_manager_;
142 ProtectService services_; 147 ProtectService services_;
143 148
144 DISALLOW_COPY_AND_ASSIGN(URLFetcherProtectManager); 149 DISALLOW_COPY_AND_ASSIGN(URLFetcherProtectManager);
145 }; 150 };
146 151
147 #endif // CHROME_COMMON_NET_URL_FETCHER_PROTECT_H_ 152 #endif // CHROME_COMMON_NET_URL_FETCHER_PROTECT_H_
OLDNEW
« no previous file with comments | « chrome/common/net/url_fetcher.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698