Add signalSyncPoint to the WebGraphicsContext3D command buffer impls.
[chromium-blink-merge.git] / net / dns / mapped_host_resolver.cc
blobc905b3481ceec6465203e75df8599bedf5318640
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "net/dns/mapped_host_resolver.h"
7 #include "base/string_util.h"
8 #include "net/base/host_port_pair.h"
9 #include "net/base/net_errors.h"
10 #include "net/base/net_util.h"
12 namespace net {
14 MappedHostResolver::MappedHostResolver(scoped_ptr<HostResolver> impl)
15 : impl_(impl.Pass()) {
18 MappedHostResolver::~MappedHostResolver() {
21 int MappedHostResolver::Resolve(const RequestInfo& original_info,
22 AddressList* addresses,
23 const CompletionCallback& callback,
24 RequestHandle* out_req,
25 const BoundNetLog& net_log) {
26 RequestInfo info = original_info;
27 int rv = ApplyRules(&info);
28 if (rv != OK)
29 return rv;
31 return impl_->Resolve(info, addresses, callback, out_req, net_log);
34 int MappedHostResolver::ResolveFromCache(const RequestInfo& original_info,
35 AddressList* addresses,
36 const BoundNetLog& net_log) {
37 RequestInfo info = original_info;
38 int rv = ApplyRules(&info);
39 if (rv != OK)
40 return rv;
42 return impl_->ResolveFromCache(info, addresses, net_log);
45 void MappedHostResolver::CancelRequest(RequestHandle req) {
46 impl_->CancelRequest(req);
49 void MappedHostResolver::ProbeIPv6Support() {
50 impl_->ProbeIPv6Support();
53 HostCache* MappedHostResolver::GetHostCache() {
54 return impl_->GetHostCache();
57 int MappedHostResolver::ApplyRules(RequestInfo* info) const {
58 HostPortPair host_port(info->host_port_pair());
59 if (rules_.RewriteHost(&host_port)) {
60 if (host_port.host() == "~NOTFOUND")
61 return ERR_NAME_NOT_RESOLVED;
62 info->set_host_port_pair(host_port);
64 return OK;
67 } // namespace net