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

Side by Side Diff: chrome/browser/geolocation/backoff_manager.h

Issue 555148: Add more gears geolocaiton files into chromium: locaiton provider, network lo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/geolocation/backoff_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright 2008, Google Inc.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are met:
5 //
6 // 1. Redistributions of source code must retain the above copyright notice,
7 // this list of conditions and the following disclaimer.
8 // 2. Redistributions in binary form must reproduce the above copyright notice,
9 // this list of conditions and the following disclaimer in the documentation
10 // and/or other materials provided with the distribution.
11 // 3. Neither the name of Google Inc. nor the names of its contributors may be
12 // used to endorse or promote products derived from this software without
13 // specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
18 // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 // The BackoffManager class is used to implement exponential back-off for
27 // network requests in case of sever errors. Users report to the BackoffManager
28 // class when they make a request to or receive a response from a given url. The
29 // BackoffManager class provides the earliest time at which subsequent requests
30 // should be made.
31
32 #ifndef GEARS_GEOLOCATION_BACKOFF_MANAGER_H__
33 #define GEARS_GEOLOCATION_BACKOFF_MANAGER_H__
34
35 // TODO(joth): port to chromium
36 #if 0
37
38 #include "gears/base/common/common.h"
39 #include "gears/base/common/mutex.h"
40 #include "gears/base/common/stopwatch.h" // For GetCurrentTimeMillis
41 #include <map>
42
43 class BackoffManager {
44 public:
45 static void ReportRequest(const std::string16 &url);
46 static int64 ReportResponse(const std::string16 &url, bool server_error);
47
48 private:
49 // A map from server URL to a pair of integers representing the last request
50 // time and the current minimum interval between requests, both in
51 // milliseconds.
52 typedef std::map<std::string16, std::pair<int64, int64> > ServerMap;
53 static ServerMap servers_;
54
55 // The mutex used to protect the map.
56 static Mutex servers_mutex_;
57
58 DISALLOW_EVIL_CONSTRUCTORS(BackoffManager);
59 };
60
61 #endif // if 0
62
63 #endif // GEARS_GEOLOCATION_BACKOFF_MANAGER_H__
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/geolocation/backoff_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698