| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "net/proxy/mock_proxy_resolver.h" | 5 #include "net/proxy/mock_proxy_resolver.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 9 | 11 |
| 10 namespace net { | 12 namespace net { |
| 11 | 13 |
| 12 MockAsyncProxyResolver::Request::Request(MockAsyncProxyResolver* resolver, | 14 MockAsyncProxyResolver::Request::Request(MockAsyncProxyResolver* resolver, |
| 13 const GURL& url, | 15 const GURL& url, |
| 14 ProxyInfo* results, | 16 ProxyInfo* results, |
| 15 const CompletionCallback& callback) | 17 const CompletionCallback& callback) |
| 16 : resolver_(resolver), | 18 : resolver_(resolver), |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 resolver_(resolver), | 81 resolver_(resolver), |
| 80 callback_(callback) { | 82 callback_(callback) { |
| 81 } | 83 } |
| 82 | 84 |
| 83 MockAsyncProxyResolverFactory::Request::~Request() { | 85 MockAsyncProxyResolverFactory::Request::~Request() { |
| 84 } | 86 } |
| 85 | 87 |
| 86 void MockAsyncProxyResolverFactory::Request::CompleteNow( | 88 void MockAsyncProxyResolverFactory::Request::CompleteNow( |
| 87 int rv, | 89 int rv, |
| 88 scoped_ptr<ProxyResolver> resolver) { | 90 scoped_ptr<ProxyResolver> resolver) { |
| 89 *resolver_ = resolver.Pass(); | 91 *resolver_ = std::move(resolver); |
| 90 | 92 |
| 91 // RemovePendingRequest may remove the last external reference to |this|. | 93 // RemovePendingRequest may remove the last external reference to |this|. |
| 92 scoped_refptr<MockAsyncProxyResolverFactory::Request> keep_alive(this); | 94 scoped_refptr<MockAsyncProxyResolverFactory::Request> keep_alive(this); |
| 93 factory_->RemovePendingRequest(this); | 95 factory_->RemovePendingRequest(this); |
| 94 factory_ = nullptr; | 96 factory_ = nullptr; |
| 95 callback_.Run(rv); | 97 callback_.Run(rv); |
| 96 } | 98 } |
| 97 | 99 |
| 98 void MockAsyncProxyResolverFactory::Request::CompleteNowWithForwarder( | 100 void MockAsyncProxyResolverFactory::Request::CompleteNowWithForwarder( |
| 99 int rv, | 101 int rv, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 172 |
| 171 void ForwardingProxyResolver::CancelRequest(RequestHandle request) { | 173 void ForwardingProxyResolver::CancelRequest(RequestHandle request) { |
| 172 impl_->CancelRequest(request); | 174 impl_->CancelRequest(request); |
| 173 } | 175 } |
| 174 | 176 |
| 175 LoadState ForwardingProxyResolver::GetLoadState(RequestHandle request) const { | 177 LoadState ForwardingProxyResolver::GetLoadState(RequestHandle request) const { |
| 176 return impl_->GetLoadState(request); | 178 return impl_->GetLoadState(request); |
| 177 } | 179 } |
| 178 | 180 |
| 179 } // namespace net | 181 } // namespace net |
| OLD | NEW |