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

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

Issue 3522004: FBTF: Move ctors/dtors into implementation files. Adds ctors/dtors to non-POD structs. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 2 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
OLDNEW
1 // Copyright (c) 2010 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
(...skipping 30 matching lines...) Expand all
41 FAILURE // no response or error 41 FAILURE // no response or error
42 }; 42 };
43 43
44 URLFetcherProtectEntry(); 44 URLFetcherProtectEntry();
45 URLFetcherProtectEntry(int sliding_window_period, int max_send_threshold, 45 URLFetcherProtectEntry(int sliding_window_period, int max_send_threshold,
46 int max_retries, int initial_timeout, 46 int max_retries, int initial_timeout,
47 double multiplier, int constant_factor, 47 double multiplier, int constant_factor,
48 int maximum_timeout); 48 int maximum_timeout);
49 49
50 50
51 virtual ~URLFetcherProtectEntry() { } 51 virtual ~URLFetcherProtectEntry();
52 52
53 // When a connection event happens, log it to the queue, and recalculate 53 // When a connection event happens, log it to the queue, and recalculate
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_;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // Registers a new entry in this service. If the entry already exists, 131 // Registers a new entry in this service. If the entry already exists,
132 // just returns it. Ownership of the return object remains with the manager. 132 // just returns it. Ownership of the return object remains with the manager.
133 URLFetcherProtectEntry* Register(const std::string& id); 133 URLFetcherProtectEntry* Register(const std::string& id);
134 // Always registers the entry even when it exists; any existing entry for this 134 // Always registers the entry even when it exists; any existing entry for this
135 // id will be deleted and existing references to it will become invalid. 135 // id will be deleted and existing references to it will become invalid.
136 // Ownership of the return object remains with the manager. 136 // Ownership of the return object remains with the manager.
137 URLFetcherProtectEntry* Register(const std::string& id, 137 URLFetcherProtectEntry* Register(const std::string& id,
138 URLFetcherProtectEntry* entry); 138 URLFetcherProtectEntry* entry);
139 139
140 private: 140 private:
141 URLFetcherProtectManager() { } 141 URLFetcherProtectManager();
142 142
143 typedef std::map<const std::string, URLFetcherProtectEntry*> ProtectService; 143 typedef std::map<const std::string, URLFetcherProtectEntry*> ProtectService;
144 144
145 static Lock lock_; 145 static Lock lock_;
146 static scoped_ptr<URLFetcherProtectManager> protect_manager_; 146 static scoped_ptr<URLFetcherProtectManager> protect_manager_;
147 ProtectService services_; 147 ProtectService services_;
148 148
149 DISALLOW_COPY_AND_ASSIGN(URLFetcherProtectManager); 149 DISALLOW_COPY_AND_ASSIGN(URLFetcherProtectManager);
150 }; 150 };
151 151
152 #endif // CHROME_COMMON_NET_URL_FETCHER_PROTECT_H_ 152 #endif // CHROME_COMMON_NET_URL_FETCHER_PROTECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698