summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-26 16:19:44 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-26 16:19:44 +0000
commit7c19b87b028f32ccb4664699fc3386f1ba97d083 (patch)
treeeb0f3310fd62301f628e08e4e2a322e2913c6815 /net
parent33d710276f0195db9c56cb5d785f54eb7c371556 (diff)
downloadchromium_src-7c19b87b028f32ccb4664699fc3386f1ba97d083.zip
chromium_src-7c19b87b028f32ccb4664699fc3386f1ba97d083.tar.gz
chromium_src-7c19b87b028f32ccb4664699fc3386f1ba97d083.tar.bz2
Reverting 8627,8625.
Review URL: http://codereview.chromium.org/18598 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8628 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/host_resolver.h9
-rw-r--r--net/base/scoped_host_mapper.h25
2 files changed, 8 insertions, 26 deletions
diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h
index fa07708..1f649f8 100644
--- a/net/base/host_resolver.h
+++ b/net/base/host_resolver.h
@@ -41,9 +41,10 @@ class HostResolver {
//
// When callback is null, the operation completes synchronously.
//
- // When callback is non-null, the operation will be performed asynchronously.
- // ERR_IO_PENDING is returned if it has been scheduled successfully. Real
- // result code will be passed to the completion callback.
+ // When callback is non-null, ERR_IO_PENDING is returned if the operation
+ // could not be completed synchronously, in which case the result code will
+ // be passed to the callback when available.
+ //
int Resolve(const std::string& hostname, int port,
AddressList* addresses, CompletionCallback* callback);
@@ -73,7 +74,7 @@ class HostMapper {
// function while there are no outstanding HostResolver instances.
//
// NOTE: In most cases, you should use ScopedHostMapper instead, which is
-// defined in scoped_host_resolver.h.
+// defined in host_resolver_unittest.h
//
HostMapper* SetHostMapper(HostMapper* host_mapper);
#endif
diff --git a/net/base/scoped_host_mapper.h b/net/base/scoped_host_mapper.h
index 8b623b9..836cb34 100644
--- a/net/base/scoped_host_mapper.h
+++ b/net/base/scoped_host_mapper.h
@@ -39,7 +39,6 @@
#include <list>
#include "base/string_util.h"
-#include "base/platform_thread.h"
#include "net/base/host_resolver.h"
#include "net/base/net_errors.h"
@@ -64,22 +63,12 @@ class ScopedHostMapper : public HostMapper {
rules_.push_back(Rule(host_pattern, replacement));
}
- void AddRuleWithLatency(const char* host_pattern, const char* replacement,
- int latency) {
- rules_.push_back(Rule(host_pattern, replacement, latency));
- }
-
private:
std::string Map(const std::string& host) {
- RuleList::iterator r;
+ RuleList::const_iterator r;
for (r = rules_.begin(); r != rules_.end(); ++r) {
- if (MatchPattern(host, r->host_pattern)) {
- if (r->latency != 0) {
- PlatformThread::Sleep(r->latency);
- r->latency = 1; // Simulate cache warmup.
- }
+ if (MatchPattern(host, r->host_pattern))
return r->replacement;
- }
}
return previous_host_mapper_ ? previous_host_mapper_->Map(host) : host;
}
@@ -87,15 +76,7 @@ class ScopedHostMapper : public HostMapper {
struct Rule {
std::string host_pattern;
std::string replacement;
- int latency; // in milliseconds
- Rule(const char* h, const char* r)
- : host_pattern(h),
- replacement(r),
- latency(0) {}
- Rule(const char* h, const char* r, const int l)
- : host_pattern(h),
- replacement(r),
- latency(l) {}
+ Rule(const char* h, const char* r) : host_pattern(h), replacement(r) {}
};
typedef std::list<Rule> RuleList;