diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-01-25 11:39:07 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2016-01-25 15:20:42 +0000 |
commit | 6c91641271e536ffaa88a1dff5127e42ee99a91e (patch) | |
tree | 703d9dd49602377ddc90cbf886aad37913f2496b /chromium/net/proxy | |
parent | b145b7fafd36f0c260d6a768c81fc14e32578099 (diff) | |
download | qtwebengine-chromium-6c91641271e536ffaa88a1dff5127e42ee99a91e.tar.gz |
BASELINE: Update Chromium to 49.0.2623.23
Also adds missing printing sources.
Change-Id: I3726b8f0c7d6751c9fc846096c571fadca7108cd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'chromium/net/proxy')
74 files changed, 346 insertions, 260 deletions
diff --git a/chromium/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h b/chromium/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h index 5e5a691b7cc..e3699aa9c10 100644 --- a/chromium/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h +++ b/chromium/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h @@ -5,8 +5,11 @@ #ifndef NET_PROXY_DHCP_PROXY_SCRIPT_ADAPTER_FETCHER_WIN_H_ #define NET_PROXY_DHCP_PROXY_SCRIPT_ADAPTER_FETCHER_WIN_H_ +#include <stddef.h> + #include <string> +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" diff --git a/chromium/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc b/chromium/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc index fd227dfdded..5fae7a41fce 100644 --- a/chromium/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc +++ b/chromium/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc @@ -13,7 +13,7 @@ #include "net/base/test_completion_callback.h" #include "net/proxy/mock_proxy_script_fetcher.h" #include "net/proxy/proxy_script_fetcher_impl.h" -#include "net/test/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "net/url_request/url_request_test_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -283,14 +283,12 @@ class MockDhcpRealFetchProxyScriptAdapterFetcher }; TEST(DhcpProxyScriptAdapterFetcher, MockDhcpRealFetch) { - SpawnedTestServer test_server( - SpawnedTestServer::TYPE_HTTP, - SpawnedTestServer::kLocalhost, - base::FilePath( - FILE_PATH_LITERAL("net/data/proxy_script_fetcher_unittest"))); + EmbeddedTestServer test_server; + test_server.ServeFilesFromSourceDirectory( + "net/data/proxy_script_fetcher_unittest"); ASSERT_TRUE(test_server.Start()); - GURL configured_url = test_server.GetURL("files/downloadable.pac"); + GURL configured_url = test_server.GetURL("/downloadable.pac"); FetcherClient client; TestURLRequestContext url_request_context; diff --git a/chromium/net/proxy/dhcp_proxy_script_fetcher.h b/chromium/net/proxy/dhcp_proxy_script_fetcher.h index 85d4df845b4..2d33e2fe785 100644 --- a/chromium/net/proxy/dhcp_proxy_script_fetcher.h +++ b/chromium/net/proxy/dhcp_proxy_script_fetcher.h @@ -5,8 +5,8 @@ #ifndef NET_PROXY_DHCP_SCRIPT_FETCHER_H_ #define NET_PROXY_DHCP_SCRIPT_FETCHER_H_ -#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/strings/string16.h" #include "net/base/completion_callback.h" #include "net/base/net_export.h" diff --git a/chromium/net/proxy/dhcp_proxy_script_fetcher_factory.cc b/chromium/net/proxy/dhcp_proxy_script_fetcher_factory.cc index ab89118b2cb..75c0913cba1 100644 --- a/chromium/net/proxy/dhcp_proxy_script_fetcher_factory.cc +++ b/chromium/net/proxy/dhcp_proxy_script_fetcher_factory.cc @@ -29,7 +29,7 @@ scoped_ptr<DhcpProxyScriptFetcher> DhcpProxyScriptFetcherFactory::Create( ret.reset(new DhcpProxyScriptFetcherWin(context)); #endif DCHECK(ret); - return ret.Pass(); + return ret; } } diff --git a/chromium/net/proxy/dhcp_proxy_script_fetcher_factory.h b/chromium/net/proxy/dhcp_proxy_script_fetcher_factory.h index 1c315ad8138..b017bb63c65 100644 --- a/chromium/net/proxy/dhcp_proxy_script_fetcher_factory.h +++ b/chromium/net/proxy/dhcp_proxy_script_fetcher_factory.h @@ -5,7 +5,7 @@ #ifndef NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_ #define NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/singleton.h" #include "net/base/completion_callback.h" #include "net/base/net_export.h" diff --git a/chromium/net/proxy/dhcp_proxy_script_fetcher_win.cc b/chromium/net/proxy/dhcp_proxy_script_fetcher_win.cc index bf3e9d65836..263b50f1fbc 100644 --- a/chromium/net/proxy/dhcp_proxy_script_fetcher_win.cc +++ b/chromium/net/proxy/dhcp_proxy_script_fetcher_win.cc @@ -4,8 +4,11 @@ #include "net/proxy/dhcp_proxy_script_fetcher_win.h" +#include <vector> + #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/memory/scoped_ptr.h" #include "base/profiler/scoped_tracker.h" #include "base/threading/sequenced_worker_pool.h" #include "net/base/net_errors.h" @@ -173,11 +176,12 @@ void DhcpProxyScriptFetcherWin::OnGetCandidateAdapterNamesDone( for (std::set<std::string>::const_iterator it = adapter_names.begin(); it != adapter_names.end(); ++it) { - DhcpProxyScriptAdapterFetcher* fetcher(ImplCreateAdapterFetcher()); + scoped_ptr<DhcpProxyScriptAdapterFetcher> fetcher( + ImplCreateAdapterFetcher()); fetcher->Fetch( *it, base::Bind(&DhcpProxyScriptFetcherWin::OnFetcherDone, base::Unretained(this))); - fetchers_.push_back(fetcher); + fetchers_.push_back(std::move(fetcher)); } num_pending_fetchers_ = fetchers_.size(); } diff --git a/chromium/net/proxy/dhcp_proxy_script_fetcher_win.h b/chromium/net/proxy/dhcp_proxy_script_fetcher_win.h index decb795e96e..2620fc5f64d 100644 --- a/chromium/net/proxy/dhcp_proxy_script_fetcher_win.h +++ b/chromium/net/proxy/dhcp_proxy_script_fetcher_win.h @@ -7,9 +7,11 @@ #include <set> #include <string> +#include <vector> +#include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_vector.h" +#include "base/memory/scoped_ptr.h" #include "base/threading/non_thread_safe.h" #include "base/time/time.h" #include "base/timer/timer.h" @@ -142,7 +144,7 @@ class NET_EXPORT_PRIVATE DhcpProxyScriptFetcherWin // Vector, in Windows' network adapter preference order, of // DhcpProxyScriptAdapterFetcher objects that are or were attempting // to fetch a PAC file based on DHCP configuration. - typedef ScopedVector<DhcpProxyScriptAdapterFetcher> FetcherVector; + using FetcherVector = std::vector<scoped_ptr<DhcpProxyScriptAdapterFetcher>>; FetcherVector fetchers_; // Number of fetchers we are waiting for. diff --git a/chromium/net/proxy/in_process_mojo_proxy_resolver_factory.cc b/chromium/net/proxy/in_process_mojo_proxy_resolver_factory.cc index 3e58b011bc1..5e1574b92dd 100644 --- a/chromium/net/proxy/in_process_mojo_proxy_resolver_factory.cc +++ b/chromium/net/proxy/in_process_mojo_proxy_resolver_factory.cc @@ -4,6 +4,8 @@ #include "net/proxy/in_process_mojo_proxy_resolver_factory.h" +#include <utility> + #include "base/memory/singleton.h" #include "net/proxy/mojo_proxy_resolver_factory_impl.h" @@ -30,7 +32,7 @@ InProcessMojoProxyResolverFactory::CreateResolver( const mojo::String& pac_script, mojo::InterfaceRequest<interfaces::ProxyResolver> req, interfaces::ProxyResolverFactoryRequestClientPtr client) { - factory_->CreateResolver(pac_script, req.Pass(), client.Pass()); + factory_->CreateResolver(pac_script, std::move(req), std::move(client)); return nullptr; } diff --git a/chromium/net/proxy/mock_proxy_resolver.cc b/chromium/net/proxy/mock_proxy_resolver.cc index 9c5cb036107..21cac0026cb 100644 --- a/chromium/net/proxy/mock_proxy_resolver.cc +++ b/chromium/net/proxy/mock_proxy_resolver.cc @@ -4,6 +4,8 @@ #include "net/proxy/mock_proxy_resolver.h" +#include <utility> + #include "base/logging.h" #include "base/message_loop/message_loop.h" @@ -21,26 +23,23 @@ MockAsyncProxyResolver::Request::Request(MockAsyncProxyResolver* resolver, } void MockAsyncProxyResolver::Request::CompleteNow(int rv) { - CompletionCallback callback = callback_; + CompletionCallback callback = callback_; - // May delete |this|. - resolver_->RemovePendingRequest(this); + // May delete |this|. + resolver_->RemovePendingRequest(this); - callback.Run(rv); - } + callback.Run(rv); +} - MockAsyncProxyResolver::Request::~Request() { - } +MockAsyncProxyResolver::Request::~Request() {} - MockAsyncProxyResolver::~MockAsyncProxyResolver() { - } +MockAsyncProxyResolver::~MockAsyncProxyResolver() {} - int MockAsyncProxyResolver::GetProxyForURL( - const GURL& url, - ProxyInfo* results, - const CompletionCallback& callback, - RequestHandle* request_handle, - const BoundNetLog& /*net_log*/) { +int MockAsyncProxyResolver::GetProxyForURL(const GURL& url, + ProxyInfo* results, + const CompletionCallback& callback, + RequestHandle* request_handle, + const BoundNetLog& /*net_log*/) { scoped_refptr<Request> request = new Request(this, url, results, callback); pending_requests_.push_back(request); @@ -89,7 +88,7 @@ MockAsyncProxyResolverFactory::Request::~Request() { void MockAsyncProxyResolverFactory::Request::CompleteNow( int rv, scoped_ptr<ProxyResolver> resolver) { - *resolver_ = resolver.Pass(); + *resolver_ = std::move(resolver); // RemovePendingRequest may remove the last external reference to |this|. scoped_refptr<MockAsyncProxyResolverFactory::Request> keep_alive(this); diff --git a/chromium/net/proxy/mock_proxy_resolver.h b/chromium/net/proxy/mock_proxy_resolver.h index aec843227b9..9ed3348b3fa 100644 --- a/chromium/net/proxy/mock_proxy_resolver.h +++ b/chromium/net/proxy/mock_proxy_resolver.h @@ -7,6 +7,7 @@ #include <vector> +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "net/base/net_errors.h" #include "net/proxy/proxy_resolver.h" diff --git a/chromium/net/proxy/mock_proxy_script_fetcher.cc b/chromium/net/proxy/mock_proxy_script_fetcher.cc index 7604b5b34b1..e7cf7a3a444 100644 --- a/chromium/net/proxy/mock_proxy_script_fetcher.cc +++ b/chromium/net/proxy/mock_proxy_script_fetcher.cc @@ -30,7 +30,7 @@ int MockProxyScriptFetcher::Fetch(const GURL& url, base::string16* text, pending_request_text_ = text; if (waiting_for_fetch_) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); return ERR_IO_PENDING; } diff --git a/chromium/net/proxy/mojo_proxy_resolver_factory.h b/chromium/net/proxy/mojo_proxy_resolver_factory.h index 2163cb0cad3..98cb3475f8f 100644 --- a/chromium/net/proxy/mojo_proxy_resolver_factory.h +++ b/chromium/net/proxy/mojo_proxy_resolver_factory.h @@ -7,9 +7,9 @@ #include "base/callback_helpers.h" #include "base/memory/scoped_ptr.h" +#include "mojo/public/cpp/bindings/interface_request.h" #include "net/interfaces/host_resolver_service.mojom.h" #include "net/interfaces/proxy_resolver_service.mojom.h" -#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" namespace net { diff --git a/chromium/net/proxy/mojo_proxy_resolver_factory_impl.cc b/chromium/net/proxy/mojo_proxy_resolver_factory_impl.cc index a24edc22c47..49b23ea25fb 100644 --- a/chromium/net/proxy/mojo_proxy_resolver_factory_impl.cc +++ b/chromium/net/proxy/mojo_proxy_resolver_factory_impl.cc @@ -5,7 +5,9 @@ #include "net/proxy/mojo_proxy_resolver_factory_impl.h" #include <string> +#include <utility> +#include "base/macros.h" #include "base/stl_util.h" #include "net/base/net_errors.h" #include "net/proxy/mojo_proxy_resolver_impl.h" @@ -37,8 +39,8 @@ class MojoProxyResolverHolder { MojoProxyResolverHolder::MojoProxyResolverHolder( scoped_ptr<ProxyResolverV8Tracing> proxy_resolver_impl, mojo::InterfaceRequest<interfaces::ProxyResolver> request) - : mojo_proxy_resolver_(proxy_resolver_impl.Pass()), - binding_(&mojo_proxy_resolver_, request.Pass()) { + : mojo_proxy_resolver_(std::move(proxy_resolver_impl)), + binding_(&mojo_proxy_resolver_, std::move(request)) { binding_.set_connection_error_handler(base::Bind( &MojoProxyResolverHolder::OnConnectionError, base::Unretained(this))); } @@ -81,9 +83,9 @@ MojoProxyResolverFactoryImpl::Job::Job( mojo::InterfaceRequest<interfaces::ProxyResolver> request, interfaces::ProxyResolverFactoryRequestClientPtr client) : parent_(factory), - proxy_request_(request.Pass()), + proxy_request_(std::move(request)), factory_(proxy_resolver_factory), - client_ptr_(client.Pass()) { + client_ptr_(std::move(client)) { client_ptr_.set_connection_error_handler( base::Bind(&MojoProxyResolverFactoryImpl::Job::OnConnectionError, base::Unretained(this))); @@ -109,8 +111,8 @@ void MojoProxyResolverFactoryImpl::Job::OnProxyResolverCreated(int error) { if (error == OK) { // The MojoProxyResolverHolder will delete itself if |proxy_request_| // encounters a connection error. - new MojoProxyResolverHolder(proxy_resolver_impl_.Pass(), - proxy_request_.Pass()); + new MojoProxyResolverHolder(std::move(proxy_resolver_impl_), + std::move(proxy_request_)); } client_ptr_->ReportResult(error); parent_->RemoveJob(this); @@ -119,15 +121,13 @@ void MojoProxyResolverFactoryImpl::Job::OnProxyResolverCreated(int error) { MojoProxyResolverFactoryImpl::MojoProxyResolverFactoryImpl( scoped_ptr<ProxyResolverV8TracingFactory> proxy_resolver_factory, mojo::InterfaceRequest<interfaces::ProxyResolverFactory> request) - : proxy_resolver_impl_factory_(proxy_resolver_factory.Pass()), - binding_(this, request.Pass()) { -} + : proxy_resolver_impl_factory_(std::move(proxy_resolver_factory)), + binding_(this, std::move(request)) {} MojoProxyResolverFactoryImpl::MojoProxyResolverFactoryImpl( mojo::InterfaceRequest<interfaces::ProxyResolverFactory> request) : MojoProxyResolverFactoryImpl(ProxyResolverV8TracingFactory::Create(), - request.Pass()) { -} + std::move(request)) {} MojoProxyResolverFactoryImpl::~MojoProxyResolverFactoryImpl() { STLDeleteElements(&jobs_); @@ -141,7 +141,8 @@ void MojoProxyResolverFactoryImpl::CreateResolver( // finishes or |request| or |client| encounters a connection error. jobs_.insert(new Job( this, ProxyResolverScriptData::FromUTF8(pac_script.To<std::string>()), - proxy_resolver_impl_factory_.get(), request.Pass(), client.Pass())); + proxy_resolver_impl_factory_.get(), std::move(request), + std::move(client))); } void MojoProxyResolverFactoryImpl::RemoveJob(Job* job) { diff --git a/chromium/net/proxy/mojo_proxy_resolver_factory_impl.h b/chromium/net/proxy/mojo_proxy_resolver_factory_impl.h index dcc7b482bf6..44646e70148 100644 --- a/chromium/net/proxy/mojo_proxy_resolver_factory_impl.h +++ b/chromium/net/proxy/mojo_proxy_resolver_factory_impl.h @@ -8,8 +8,9 @@ #include <set> #include "base/callback.h" +#include "base/macros.h" +#include "mojo/public/cpp/bindings/strong_binding.h" #include "net/interfaces/proxy_resolver_service.mojom.h" -#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" namespace net { class HostResolver; diff --git a/chromium/net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc b/chromium/net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc index 0262d647cc1..c7fb51bcb8b 100644 --- a/chromium/net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc +++ b/chromium/net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc @@ -4,13 +4,15 @@ #include "net/proxy/mojo_proxy_resolver_factory_impl.h" +#include <utility> + #include "base/strings/utf_string_conversions.h" +#include "mojo/public/cpp/bindings/binding.h" #include "net/base/test_completion_callback.h" #include "net/proxy/mock_proxy_resolver.h" #include "net/proxy/proxy_resolver_v8_tracing.h" #include "net/test/event_waiter.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" namespace net { namespace { @@ -133,7 +135,8 @@ TEST_F(MojoProxyResolverFactoryImplTest, DisconnectProxyResolverClient) { mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( this, mojo::GetProxy(&client_ptr)); factory_->CreateResolver(mojo::String::From(kScriptData), - mojo::GetProxy(&proxy_resolver), client_ptr.Pass()); + mojo::GetProxy(&proxy_resolver), + std::move(client_ptr)); proxy_resolver.set_connection_error_handler( base::Bind(&MojoProxyResolverFactoryImplTest::OnConnectionError, base::Unretained(this))); @@ -160,7 +163,8 @@ TEST_F(MojoProxyResolverFactoryImplTest, Error) { mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( this, mojo::GetProxy(&client_ptr)); factory_->CreateResolver(mojo::String::From(kScriptData), - mojo::GetProxy(&proxy_resolver), client_ptr.Pass()); + mojo::GetProxy(&proxy_resolver), + std::move(client_ptr)); proxy_resolver.set_connection_error_handler( base::Bind(&MojoProxyResolverFactoryImplTest::OnConnectionError, base::Unretained(this))); @@ -181,7 +185,8 @@ TEST_F(MojoProxyResolverFactoryImplTest, mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( this, mojo::GetProxy(&client_ptr)); factory_->CreateResolver(mojo::String::From(kScriptData), - mojo::GetProxy(&proxy_resolver), client_ptr.Pass()); + mojo::GetProxy(&proxy_resolver), + std::move(client_ptr)); proxy_resolver.set_connection_error_handler( base::Bind(&MojoProxyResolverFactoryImplTest::OnConnectionError, base::Unretained(this))); @@ -199,7 +204,8 @@ TEST_F(MojoProxyResolverFactoryImplTest, mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( this, mojo::GetProxy(&client_ptr)); factory_->CreateResolver(mojo::String::From(kScriptData), - mojo::GetProxy(&proxy_resolver), client_ptr.Pass()); + mojo::GetProxy(&proxy_resolver), + std::move(client_ptr)); proxy_resolver.set_connection_error_handler( base::Bind(&MojoProxyResolverFactoryImplTest::OnConnectionError, base::Unretained(this))); diff --git a/chromium/net/proxy/mojo_proxy_resolver_impl.cc b/chromium/net/proxy/mojo_proxy_resolver_impl.cc index c5ae034040b..bbac2e72cca 100644 --- a/chromium/net/proxy/mojo_proxy_resolver_impl.cc +++ b/chromium/net/proxy/mojo_proxy_resolver_impl.cc @@ -4,6 +4,9 @@ #include "net/proxy/mojo_proxy_resolver_impl.h" +#include <utility> + +#include "base/macros.h" #include "base/stl_util.h" #include "mojo/common/url_type_converters.h" #include "net/base/net_errors.h" @@ -45,8 +48,7 @@ class MojoProxyResolverImpl::Job { MojoProxyResolverImpl::MojoProxyResolverImpl( scoped_ptr<ProxyResolverV8Tracing> resolver) - : resolver_(resolver.Pass()) { -} + : resolver_(std::move(resolver)) {} MojoProxyResolverImpl::~MojoProxyResolverImpl() { STLDeleteElements(&resolve_jobs_); @@ -56,7 +58,7 @@ void MojoProxyResolverImpl::GetProxyForUrl( const mojo::String& url, interfaces::ProxyResolverRequestClientPtr client) { DVLOG(1) << "GetProxyForUrl(" << url << ")"; - Job* job = new Job(client.Pass(), this, url.To<GURL>()); + Job* job = new Job(std::move(client), this, url.To<GURL>()); bool inserted = resolve_jobs_.insert(job).second; DCHECK(inserted); job->Start(); @@ -73,7 +75,7 @@ MojoProxyResolverImpl::Job::Job( MojoProxyResolverImpl* resolver, const GURL& url) : resolver_(resolver), - client_(client.Pass()), + client_(std::move(client)), url_(url), request_handle_(nullptr), done_(false) {} @@ -105,7 +107,7 @@ void MojoProxyResolverImpl::Job::GetProxyDone(int error) { result = mojo::Array<interfaces::ProxyServerPtr>::From( result_.proxy_list().GetAll()); } - client_->ReportResult(error, result.Pass()); + client_->ReportResult(error, std::move(result)); resolver_->DeleteJob(this); } diff --git a/chromium/net/proxy/mojo_proxy_resolver_impl.h b/chromium/net/proxy/mojo_proxy_resolver_impl.h index 479fcfca222..75280042f5e 100644 --- a/chromium/net/proxy/mojo_proxy_resolver_impl.h +++ b/chromium/net/proxy/mojo_proxy_resolver_impl.h @@ -9,6 +9,7 @@ #include <queue> #include <set> +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "net/interfaces/proxy_resolver_service.mojom.h" diff --git a/chromium/net/proxy/mojo_proxy_resolver_impl_unittest.cc b/chromium/net/proxy/mojo_proxy_resolver_impl_unittest.cc index bfc777325a7..b045b27b300 100644 --- a/chromium/net/proxy/mojo_proxy_resolver_impl_unittest.cc +++ b/chromium/net/proxy/mojo_proxy_resolver_impl_unittest.cc @@ -5,9 +5,11 @@ #include "net/proxy/mojo_proxy_resolver_impl.h" #include <string> +#include <utility> #include <vector> #include "base/run_loop.h" +#include "mojo/public/cpp/bindings/binding.h" #include "net/base/net_errors.h" #include "net/proxy/mock_proxy_resolver.h" #include "net/proxy/mojo_proxy_type_converters.h" @@ -16,7 +18,6 @@ #include "net/proxy/proxy_server.h" #include "net/test/event_waiter.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" namespace net { namespace { @@ -60,7 +61,7 @@ class TestRequestClient : public interfaces::ProxyResolverRequestClient { TestRequestClient::TestRequestClient( mojo::InterfaceRequest<interfaces::ProxyResolverRequestClient> request) - : binding_(this, request.Pass()) { + : binding_(this, std::move(request)) { binding_.set_connection_error_handler(base::Bind( &TestRequestClient::OnConnectionError, base::Unretained(this))); } @@ -79,7 +80,7 @@ void TestRequestClient::ReportResult( event_waiter_.NotifyEvent(RESULT_RECEIVED); ASSERT_FALSE(done_); error_ = static_cast<Error>(error); - results_ = results.Pass(); + results_ = std::move(results); done_ = true; } @@ -177,7 +178,7 @@ class MojoProxyResolverImplTest : public testing::Test { scoped_ptr<MockProxyResolverV8Tracing> mock_resolver( new MockProxyResolverV8Tracing); mock_proxy_resolver_ = mock_resolver.get(); - resolver_impl_.reset(new MojoProxyResolverImpl(mock_resolver.Pass())); + resolver_impl_.reset(new MojoProxyResolverImpl(std::move(mock_resolver))); resolver_ = resolver_impl_.get(); } @@ -191,7 +192,7 @@ TEST_F(MojoProxyResolverImplTest, GetProxyForUrl) { interfaces::ProxyResolverRequestClientPtr client_ptr; TestRequestClient client(mojo::GetProxy(&client_ptr)); - resolver_->GetProxyForUrl("http://example.com", client_ptr.Pass()); + resolver_->GetProxyForUrl("http://example.com", std::move(client_ptr)); ASSERT_EQ(1u, mock_proxy_resolver_->pending_requests().size()); const MockProxyResolverV8Tracing::Request& request = mock_proxy_resolver_->pending_requests()[0]; @@ -238,7 +239,7 @@ TEST_F(MojoProxyResolverImplTest, GetProxyForUrlFailure) { interfaces::ProxyResolverRequestClientPtr client_ptr; TestRequestClient client(mojo::GetProxy(&client_ptr)); - resolver_->GetProxyForUrl("http://example.com", client_ptr.Pass()); + resolver_->GetProxyForUrl("http://example.com", std::move(client_ptr)); ASSERT_EQ(1u, mock_proxy_resolver_->pending_requests().size()); const MockProxyResolverV8Tracing::Request& request = mock_proxy_resolver_->pending_requests()[0]; @@ -258,8 +259,8 @@ TEST_F(MojoProxyResolverImplTest, GetProxyForUrlMultiple) { interfaces::ProxyResolverRequestClientPtr client_ptr2; TestRequestClient client2(mojo::GetProxy(&client_ptr2)); - resolver_->GetProxyForUrl("http://example.com", client_ptr1.Pass()); - resolver_->GetProxyForUrl("https://example.com", client_ptr2.Pass()); + resolver_->GetProxyForUrl("http://example.com", std::move(client_ptr1)); + resolver_->GetProxyForUrl("https://example.com", std::move(client_ptr2)); ASSERT_EQ(2u, mock_proxy_resolver_->pending_requests().size()); const MockProxyResolverV8Tracing::Request& request1 = mock_proxy_resolver_->pending_requests()[0]; @@ -298,7 +299,7 @@ TEST_F(MojoProxyResolverImplTest, DestroyClient) { scoped_ptr<TestRequestClient> client( new TestRequestClient(mojo::GetProxy(&client_ptr))); - resolver_->GetProxyForUrl("http://example.com", client_ptr.Pass()); + resolver_->GetProxyForUrl("http://example.com", std::move(client_ptr)); ASSERT_EQ(1u, mock_proxy_resolver_->pending_requests().size()); const MockProxyResolverV8Tracing::Request& request = mock_proxy_resolver_->pending_requests()[0]; @@ -312,7 +313,7 @@ TEST_F(MojoProxyResolverImplTest, DestroyService) { interfaces::ProxyResolverRequestClientPtr client_ptr; TestRequestClient client(mojo::GetProxy(&client_ptr)); - resolver_->GetProxyForUrl("http://example.com", client_ptr.Pass()); + resolver_->GetProxyForUrl("http://example.com", std::move(client_ptr)); ASSERT_EQ(1u, mock_proxy_resolver_->pending_requests().size()); resolver_impl_.reset(); client.event_waiter().WaitForEvent(TestRequestClient::CONNECTION_ERROR); diff --git a/chromium/net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h b/chromium/net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h index 70ebe3c4983..e4b84bdae3a 100644 --- a/chromium/net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h +++ b/chromium/net/proxy/mojo_proxy_resolver_v8_tracing_bindings.h @@ -5,6 +5,8 @@ #ifndef NET_PROXY_MOJO_PROXY_RESOLVER_V8_TRACING_BINDINGS_H_ #define NET_PROXY_MOJO_PROXY_RESOLVER_V8_TRACING_BINDINGS_H_ +#include <utility> + #include "base/threading/thread_checker.h" #include "mojo/common/common_type_converters.h" #include "net/dns/host_resolver_mojo.h" @@ -54,7 +56,7 @@ class MojoProxyResolverV8TracingBindings void ResolveDns(interfaces::HostResolverRequestInfoPtr request_info, interfaces::HostResolverRequestClientPtr client) { DCHECK(thread_checker_.CalledOnValidThread()); - client_->ResolveDns(request_info.Pass(), client.Pass()); + client_->ResolveDns(std::move(request_info), std::move(client)); } base::ThreadChecker thread_checker_; diff --git a/chromium/net/proxy/mojo_proxy_resolver_v8_tracing_bindings_unittest.cc b/chromium/net/proxy/mojo_proxy_resolver_v8_tracing_bindings_unittest.cc index ce11b7108d7..60058a7be12 100644 --- a/chromium/net/proxy/mojo_proxy_resolver_v8_tracing_bindings_unittest.cc +++ b/chromium/net/proxy/mojo_proxy_resolver_v8_tracing_bindings_unittest.cc @@ -8,6 +8,7 @@ #include <utility> #include <vector> +#include "base/macros.h" #include "base/strings/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chromium/net/proxy/mojo_proxy_type_converters.cc b/chromium/net/proxy/mojo_proxy_type_converters.cc index 00aed7ab682..c927534d10b 100644 --- a/chromium/net/proxy/mojo_proxy_type_converters.cc +++ b/chromium/net/proxy/mojo_proxy_type_converters.cc @@ -70,7 +70,7 @@ TypeConverter<net::interfaces::ProxyServerPtr, net::ProxyServer>::Convert( server->host = obj.host_port_pair().host(); server->port = obj.host_port_pair().port(); } - return server.Pass(); + return server; } // static diff --git a/chromium/net/proxy/mojo_proxy_type_converters.h b/chromium/net/proxy/mojo_proxy_type_converters.h index 55ea69df919..51b0e380c66 100644 --- a/chromium/net/proxy/mojo_proxy_type_converters.h +++ b/chromium/net/proxy/mojo_proxy_type_converters.h @@ -5,8 +5,8 @@ #ifndef NET_PROXY_MOJO_PROXY_TYPE_CONVERTERS_H_ #define NET_PROXY_MOJO_PROXY_TYPE_CONVERTERS_H_ +#include "mojo/public/cpp/bindings/type_converter.h" #include "net/interfaces/proxy_resolver_service.mojom.h" -#include "third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h" namespace net { class ProxyInfo; diff --git a/chromium/net/proxy/multi_threaded_proxy_resolver.cc b/chromium/net/proxy/multi_threaded_proxy_resolver.cc index 6c6fa699534..5eae4f744e8 100644 --- a/chromium/net/proxy/multi_threaded_proxy_resolver.cc +++ b/chromium/net/proxy/multi_threaded_proxy_resolver.cc @@ -5,6 +5,7 @@ #include "net/proxy/multi_threaded_proxy_resolver.h" #include <deque> +#include <utility> #include <vector> #include "base/bind.h" @@ -64,7 +65,7 @@ class Executor : public base::RefCountedThreadSafe<Executor> { int thread_number() const { return thread_number_; } void set_resolver(scoped_ptr<ProxyResolver> resolver) { - resolver_ = resolver.Pass(); + resolver_ = std::move(resolver); } void set_coordinator(Coordinator* coordinator) { @@ -261,7 +262,7 @@ class CreateResolverJob : public Job { // The task may have been cancelled after it was started. if (!was_cancelled()) { DCHECK(executor()); - executor()->set_resolver(resolver_.Pass()); + executor()->set_resolver(std::move(resolver_)); } OnJobCompleted(); } @@ -305,7 +306,7 @@ class MultiThreadedProxyResolver::GetProxyForURLJob : public Job { net_log_.AddEvent( NetLog::TYPE_SUBMITTED_TO_RESOLVER_THREAD, - NetLog::IntegerCallback("thread_number", executor()->thread_number())); + NetLog::IntCallback("thread_number", executor()->thread_number())); } // Runs on the worker thread. @@ -422,7 +423,7 @@ MultiThreadedProxyResolver::MultiThreadedProxyResolver( size_t max_num_threads, const scoped_refptr<ProxyResolverScriptData>& script_data, scoped_refptr<Executor> executor) - : resolver_factory_(resolver_factory.Pass()), + : resolver_factory_(std::move(resolver_factory)), max_num_threads_(max_num_threads), script_data_(script_data) { DCHECK(script_data_); @@ -549,7 +550,7 @@ class MultiThreadedProxyResolverFactory::Job const CompletionCallback& callback) : factory_(factory), resolver_out_(resolver), - resolver_factory_(resolver_factory.Pass()), + resolver_factory_(std::move(resolver_factory)), max_num_threads_(max_num_threads), script_data_(script_data), executor_(new Executor(this, 0)), @@ -576,8 +577,8 @@ class MultiThreadedProxyResolverFactory::Job int error = OK; if (executor->resolver()) { resolver_out_->reset(new MultiThreadedProxyResolver( - resolver_factory_.Pass(), max_num_threads_, script_data_.Pass(), - executor_)); + std::move(resolver_factory_), max_num_threads_, + std::move(script_data_), executor_)); } else { error = ERR_PAC_SCRIPT_FAILED; executor_->Destroy(); @@ -619,7 +620,7 @@ int MultiThreadedProxyResolverFactory::CreateProxyResolver( CreateProxyResolverFactory(), max_num_threads_, callback)); jobs_.insert(job.get()); - *request = job.Pass(); + *request = std::move(job); return ERR_IO_PENDING; } diff --git a/chromium/net/proxy/multi_threaded_proxy_resolver.h b/chromium/net/proxy/multi_threaded_proxy_resolver.h index 30a7b1b1ee6..f00249f4fb2 100644 --- a/chromium/net/proxy/multi_threaded_proxy_resolver.h +++ b/chromium/net/proxy/multi_threaded_proxy_resolver.h @@ -5,9 +5,10 @@ #ifndef NET_PROXY_MULTI_THREADED_PROXY_RESOLVER_H_ #define NET_PROXY_MULTI_THREADED_PROXY_RESOLVER_H_ +#include <stddef.h> + #include <set> -#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "net/base/net_export.h" diff --git a/chromium/net/proxy/multi_threaded_proxy_resolver_unittest.cc b/chromium/net/proxy/multi_threaded_proxy_resolver_unittest.cc index dd30370a33a..29e49c34a80 100644 --- a/chromium/net/proxy/multi_threaded_proxy_resolver_unittest.cc +++ b/chromium/net/proxy/multi_threaded_proxy_resolver_unittest.cc @@ -4,6 +4,7 @@ #include "net/proxy/multi_threaded_proxy_resolver.h" +#include <utility> #include <vector> #include "base/message_loop/message_loop.h" @@ -179,11 +180,11 @@ class SingleShotMultiThreadedProxyResolverFactory size_t max_num_threads, scoped_ptr<ProxyResolverFactory> factory) : MultiThreadedProxyResolverFactory(max_num_threads, false), - factory_(factory.Pass()) {} + factory_(std::move(factory)) {} scoped_ptr<ProxyResolverFactory> CreateProxyResolverFactory() override { DCHECK(factory_); - return factory_.Pass(); + return std::move(factory_); } private: @@ -197,7 +198,7 @@ class MultiThreadedProxyResolverTest : public testing::Test { new BlockableProxyResolverFactory); factory_ = factory_owner.get(); resolver_factory_.reset(new SingleShotMultiThreadedProxyResolverFactory( - num_threads, factory_owner.Pass())); + num_threads, std::move(factory_owner))); TestCompletionCallback ready_callback; scoped_ptr<ProxyResolverFactory::Request> request; resolver_factory_->CreateProxyResolver( @@ -230,7 +231,13 @@ class MultiThreadedProxyResolverTest : public testing::Test { scoped_ptr<ProxyResolver> resolver_; }; -TEST_F(MultiThreadedProxyResolverTest, SingleThread_Basic) { +// Flaky on Android. See http://crbug.com/547786 +#if defined(OS_ANDROID) +#define MAYBE_SingleThread_Basic DISABLED_SingleThread_Basic +#else +#define MAYBE_SingleThread_Basic SingleThread_Basic +#endif +TEST_F(MultiThreadedProxyResolverTest, MAYBE_SingleThread_Basic) { const size_t kNumThreads = 1u; ASSERT_NO_FATAL_FAILURE(Init(kNumThreads)); diff --git a/chromium/net/proxy/network_delegate_error_observer.cc b/chromium/net/proxy/network_delegate_error_observer.cc index 1bb0537d6cd..b5d85c479ea 100644 --- a/chromium/net/proxy/network_delegate_error_observer.cc +++ b/chromium/net/proxy/network_delegate_error_observer.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/location.h" +#include "base/macros.h" #include "base/single_thread_task_runner.h" #include "net/base/net_errors.h" #include "net/base/network_delegate.h" diff --git a/chromium/net/proxy/network_delegate_error_observer.h b/chromium/net/proxy/network_delegate_error_observer.h index 2463913ff65..50a3f647e4c 100644 --- a/chromium/net/proxy/network_delegate_error_observer.h +++ b/chromium/net/proxy/network_delegate_error_observer.h @@ -6,6 +6,7 @@ #define NET_PROXY_NETWORK_DELEGATE_ERROR_OBSERVER_H_ #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "net/proxy/proxy_resolver_error_observer.h" diff --git a/chromium/net/proxy/polling_proxy_config_service.h b/chromium/net/proxy/polling_proxy_config_service.h index c8230561f7f..f4db0df6648 100644 --- a/chromium/net/proxy/polling_proxy_config_service.h +++ b/chromium/net/proxy/polling_proxy_config_service.h @@ -6,6 +6,7 @@ #define NET_PROXY_POLLING_PROXY_CONFIG_SERVICE_H_ #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/time/time.h" #include "net/proxy/proxy_config_service.h" diff --git a/chromium/net/proxy/proxy_bypass_rules.h b/chromium/net/proxy/proxy_bypass_rules.h index c8fe0693f5c..c7960743f81 100644 --- a/chromium/net/proxy/proxy_bypass_rules.h +++ b/chromium/net/proxy/proxy_bypass_rules.h @@ -8,6 +8,7 @@ #include <string> #include <vector> +#include "base/macros.h" #include "net/base/net_export.h" #include "url/gurl.h" diff --git a/chromium/net/proxy/proxy_config.cc b/chromium/net/proxy/proxy_config.cc index 2ac6de1b328..78d6ef3b9cf 100644 --- a/chromium/net/proxy/proxy_config.cc +++ b/chromium/net/proxy/proxy_config.cc @@ -4,9 +4,11 @@ #include "net/proxy/proxy_config.h" +#include <utility> + #include "base/logging.h" -#include "base/strings/string_util.h" #include "base/strings/string_tokenizer.h" +#include "base/strings/string_util.h" #include "base/values.h" #include "net/proxy/proxy_info.h" @@ -258,7 +260,7 @@ scoped_ptr<base::DictionaryValue> ProxyConfig::ToValue() const { AddProxyListToValue("ftp", proxy_rules_.proxies_for_ftp, dict2.get()); AddProxyListToValue("fallback", proxy_rules_.fallback_proxies, dict2.get()); - dict->Set("proxy_per_scheme", dict2.Pass()); + dict->Set("proxy_per_scheme", std::move(dict2)); break; } default: @@ -286,7 +288,7 @@ scoped_ptr<base::DictionaryValue> ProxyConfig::ToValue() const { // Output the source. dict->SetString("source", ProxyConfigSourceToString(source_)); - return dict.Pass(); + return dict; } } // namespace net diff --git a/chromium/net/proxy/proxy_config.h b/chromium/net/proxy/proxy_config.h index 303aa10b09a..2e91923a83c 100644 --- a/chromium/net/proxy/proxy_config.h +++ b/chromium/net/proxy/proxy_config.h @@ -37,8 +37,8 @@ class NET_EXPORT ProxyConfig { public: // ProxyRules describes the "manual" proxy settings. // TODO(eroman): Turn this into a class. - // TODO(marq): Update the enum names; "TYPE_SINGLE_PROXY" really means - // the same set of proxies are used for all requests. + // TODO(crbug.com/546383): Update the enum names; "TYPE_SINGLE_PROXY" really + // means the same set of proxies are used for all requests. struct NET_EXPORT ProxyRules { enum Type { TYPE_NO_RULES, diff --git a/chromium/net/proxy/proxy_config_service_android.cc b/chromium/net/proxy/proxy_config_service_android.cc index 66065fb1c66..990b614fb8b 100644 --- a/chromium/net/proxy/proxy_config_service_android.cc +++ b/chromium/net/proxy/proxy_config_service_android.cc @@ -6,14 +6,15 @@ #include <sys/system_properties.h> +#include "base/android/context_utils.h" #include "base/android/jni_array.h" #include "base/android/jni_string.h" -#include "base/basictypes.h" #include "base/bind.h" #include "base/callback.h" #include "base/compiler_specific.h" #include "base/location.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/observer_list.h" #include "base/sequenced_task_runner.h" @@ -59,8 +60,7 @@ ProxyServer ConstructProxyServer(ProxyServer::Scheme scheme, return ProxyServer(); DCHECK(port_as_int > 0); return ProxyServer( - scheme, - HostPortPair(proxy_host, static_cast<uint16>(port_as_int))); + scheme, HostPortPair(proxy_host, static_cast<uint16_t>(port_as_int))); } ProxyServer LookupProxy(const std::string& prefix, @@ -99,11 +99,6 @@ void AddBypassRules(const std::string& scheme, // http.nonProxyHosts property to *.android.com|*.kernel.org will cause // requests to http://developer.android.com to be made without a proxy. - // Force localhost to be on the proxy exclusion list; - // otherwise all localhost traffic is routed through - // the proxy which is not desired. - bypass_rules->AddRuleToBypassLocal(); - std::string non_proxy_hosts = get_property.Run(scheme + ".nonProxyHosts"); if (non_proxy_hosts.empty()) @@ -302,12 +297,13 @@ class ProxyConfigServiceAndroid::Delegate explicit JNIDelegateImpl(Delegate* delegate) : delegate_(delegate) {} // ProxyConfigServiceAndroid::JNIDelegate overrides. - void ProxySettingsChangedTo(JNIEnv* env, - jobject jself, - jstring jhost, - jint jport, - jstring jpac_url, - jobjectArray jexclusion_list) override { + void ProxySettingsChangedTo( + JNIEnv* env, + const JavaParamRef<jobject>& jself, + const JavaParamRef<jstring>& jhost, + jint jport, + const JavaParamRef<jstring>& jpac_url, + const JavaParamRef<jobjectArray>& jexclusion_list) override { std::string host = ConvertJavaStringToUTF8(env, jhost); std::string pac_url; if (jpac_url) @@ -318,7 +314,8 @@ class ProxyConfigServiceAndroid::Delegate delegate_->ProxySettingsChangedTo(host, jport, pac_url, exclusion_list); } - void ProxySettingsChanged(JNIEnv* env, jobject self) override { + void ProxySettingsChanged(JNIEnv* env, + const JavaParamRef<jobject>& self) override { delegate_->ProxySettingsChanged(); } diff --git a/chromium/net/proxy/proxy_config_service_android.h b/chromium/net/proxy/proxy_config_service_android.h index 64e6b4939b6..1b45eb102de 100644 --- a/chromium/net/proxy/proxy_config_service_android.h +++ b/chromium/net/proxy/proxy_config_service_android.h @@ -8,9 +8,9 @@ #include <string> #include "base/android/jni_android.h" -#include "base/basictypes.h" #include "base/callback_forward.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "net/base/net_export.h" #include "net/proxy/proxy_config_service.h" @@ -43,16 +43,19 @@ class NET_EXPORT ProxyConfigServiceAndroid : public ProxyConfigService { // are either a host/port pair or ("", 0) to indicate "no proxy". // The third argument indicates the PAC url. // The fourth argument is the proxy exclusion list. - virtual void ProxySettingsChangedTo(JNIEnv*, - jobject, - jstring, - jint, - jstring, - jobjectArray) = 0; + virtual void ProxySettingsChangedTo( + JNIEnv*, + const base::android::JavaParamRef<jobject>&, + const base::android::JavaParamRef<jstring>&, + jint, + const base::android::JavaParamRef<jstring>&, + const base::android::JavaParamRef<jobjectArray>&) = 0; // Called from Java (on JNI thread) to signal that the proxy settings have // changed. New proxy settings are fetched from the system property store. - virtual void ProxySettingsChanged(JNIEnv*, jobject) = 0; + virtual void ProxySettingsChanged( + JNIEnv*, + const base::android::JavaParamRef<jobject>&) = 0; }; ProxyConfigServiceAndroid( diff --git a/chromium/net/proxy/proxy_config_service_ios.h b/chromium/net/proxy/proxy_config_service_ios.h index c79a6b6d84f..d239f37652a 100644 --- a/chromium/net/proxy/proxy_config_service_ios.h +++ b/chromium/net/proxy/proxy_config_service_ios.h @@ -5,6 +5,7 @@ #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_IOS_H_ #define NET_PROXY_PROXY_CONFIG_SERVICE_IOS_H_ +#include "base/macros.h" #include "net/proxy/polling_proxy_config_service.h" namespace net { diff --git a/chromium/net/proxy/proxy_config_service_linux.cc b/chromium/net/proxy/proxy_config_service_linux.cc index dc4f3d0d6c6..139e30840dd 100644 --- a/chromium/net/proxy/proxy_config_service_linux.cc +++ b/chromium/net/proxy/proxy_config_service_linux.cc @@ -5,7 +5,6 @@ #include "net/proxy/proxy_config_service_linux.h" #include <errno.h> -#include <fcntl.h> #if defined(USE_GCONF) #include <gconf/gconf-client.h> #endif // defined(USE_GCONF) @@ -25,6 +24,7 @@ #include "base/files/file_util.h" #include "base/files/scoped_file.h" #include "base/logging.h" +#include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/nix/xdg_util.h" #include "base/single_thread_task_runner.h" @@ -949,9 +949,8 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, PLOG(ERROR) << "inotify_init failed"; return false; } - int flags = fcntl(inotify_fd_, F_GETFL); - if (fcntl(inotify_fd_, F_SETFL, flags | O_NONBLOCK) < 0) { - PLOG(ERROR) << "fcntl failed"; + if (!base::SetNonBlocking(inotify_fd_)) { + PLOG(ERROR) << "base::SetNonBlocking failed"; close(inotify_fd_); inotify_fd_ = -1; return false; diff --git a/chromium/net/proxy/proxy_config_service_linux.h b/chromium/net/proxy/proxy_config_service_linux.h index 311f81f2f55..d6faab01cd9 100644 --- a/chromium/net/proxy/proxy_config_service_linux.h +++ b/chromium/net/proxy/proxy_config_service_linux.h @@ -5,12 +5,14 @@ #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_LINUX_H_ #define NET_PROXY_PROXY_CONFIG_SERVICE_LINUX_H_ +#include <stddef.h> + #include <string> #include <vector> -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/environment.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" diff --git a/chromium/net/proxy/proxy_config_service_mac.h b/chromium/net/proxy/proxy_config_service_mac.h index 01a0e26b0f3..b81ffa05731 100644 --- a/chromium/net/proxy/proxy_config_service_mac.h +++ b/chromium/net/proxy/proxy_config_service_mac.h @@ -5,8 +5,8 @@ #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_MAC_H_ #define NET_PROXY_PROXY_CONFIG_SERVICE_MAC_H_ -#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" diff --git a/chromium/net/proxy/proxy_config_source.cc b/chromium/net/proxy/proxy_config_source.cc index f3137ff57c5..6dd6071a653 100644 --- a/chromium/net/proxy/proxy_config_source.cc +++ b/chromium/net/proxy/proxy_config_source.cc @@ -4,7 +4,6 @@ #include "net/proxy/proxy_config_source.h" -#include "base/basictypes.h" #include "base/logging.h" namespace net { diff --git a/chromium/net/proxy/proxy_list.cc b/chromium/net/proxy/proxy_list.cc index 1d24b6d113b..a7b7aef82b1 100644 --- a/chromium/net/proxy/proxy_list.cc +++ b/chromium/net/proxy/proxy_list.cc @@ -146,7 +146,7 @@ scoped_ptr<base::ListValue> ProxyList::ToValue() const { scoped_ptr<base::ListValue> list(new base::ListValue()); for (size_t i = 0; i < proxies_.size(); ++i) list->AppendString(proxies_[i].ToURI()); - return list.Pass(); + return list; } bool ProxyList::Fallback(ProxyRetryInfoMap* proxy_retry_info, diff --git a/chromium/net/proxy/proxy_list.h b/chromium/net/proxy/proxy_list.h index 97e0af65ee1..82c637d0cc7 100644 --- a/chromium/net/proxy/proxy_list.h +++ b/chromium/net/proxy/proxy_list.h @@ -5,6 +5,8 @@ #ifndef NET_PROXY_PROXY_LIST_H_ #define NET_PROXY_PROXY_LIST_H_ +#include <stddef.h> + #include <string> #include <vector> diff --git a/chromium/net/proxy/proxy_resolver.h b/chromium/net/proxy/proxy_resolver.h index b303e2b1491..81efe0577ba 100644 --- a/chromium/net/proxy/proxy_resolver.h +++ b/chromium/net/proxy/proxy_resolver.h @@ -7,6 +7,7 @@ #include "base/callback_forward.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/strings/string16.h" #include "net/base/completion_callback.h" diff --git a/chromium/net/proxy/proxy_resolver_error_observer.h b/chromium/net/proxy/proxy_resolver_error_observer.h index 190b78759ba..0212f829570 100644 --- a/chromium/net/proxy/proxy_resolver_error_observer.h +++ b/chromium/net/proxy/proxy_resolver_error_observer.h @@ -5,7 +5,7 @@ #ifndef NET_PROXY_PROXY_RESOLVER_ERROR_OBSERVER_H_ #define NET_PROXY_PROXY_RESOLVER_ERROR_OBSERVER_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "base/strings/string16.h" #include "net/base/net_export.h" diff --git a/chromium/net/proxy/proxy_resolver_factory.h b/chromium/net/proxy/proxy_resolver_factory.h index 282dd24a7e8..0cc98df91a7 100644 --- a/chromium/net/proxy/proxy_resolver_factory.h +++ b/chromium/net/proxy/proxy_resolver_factory.h @@ -7,6 +7,7 @@ #include <set> +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "net/base/completion_callback.h" diff --git a/chromium/net/proxy/proxy_resolver_factory_mojo.cc b/chromium/net/proxy/proxy_resolver_factory_mojo.cc index 32c1203e19b..4203eea39cd 100644 --- a/chromium/net/proxy/proxy_resolver_factory_mojo.cc +++ b/chromium/net/proxy/proxy_resolver_factory_mojo.cc @@ -5,14 +5,17 @@ #include "net/proxy/proxy_resolver_factory_mojo.h" #include <set> +#include <utility> #include "base/bind.h" #include "base/logging.h" +#include "base/macros.h" #include "base/stl_util.h" #include "base/threading/thread_checker.h" #include "base/values.h" #include "mojo/common/common_type_converters.h" #include "mojo/common/url_type_converters.h" +#include "mojo/public/cpp/bindings/binding.h" #include "net/base/load_states.h" #include "net/base/net_errors.h" #include "net/dns/mojo_host_resolver_impl.h" @@ -24,7 +27,6 @@ #include "net/proxy/proxy_resolver.h" #include "net/proxy/proxy_resolver_error_observer.h" #include "net/proxy/proxy_resolver_script_data.h" -#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" namespace net { namespace { @@ -36,7 +38,7 @@ scoped_ptr<base::Value> NetLogErrorCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("line_number", line_number); dict->SetString("message", *message); - return dict.Pass(); + return std::move(dict); } // A mixin that forwards logging to (Bound)NetLog and ProxyResolverErrorObserver @@ -75,7 +77,7 @@ class ClientMixin : public ClientInterface { void ResolveDns(interfaces::HostResolverRequestInfoPtr request_info, interfaces::HostResolverRequestClientPtr client) override { - host_resolver_.Resolve(request_info.Pass(), client.Pass()); + host_resolver_.Resolve(std::move(request_info), std::move(client)); } protected: @@ -196,13 +198,12 @@ ProxyResolverMojo::Job::Job(ProxyResolverMojo* resolver, results_(results), callback_(callback), binding_(this) { - binding_.set_connection_error_handler(base::Bind( - &ProxyResolverMojo::Job::OnConnectionError, base::Unretained(this))); - interfaces::ProxyResolverRequestClientPtr client_ptr; binding_.Bind(mojo::GetProxy(&client_ptr)); + binding_.set_connection_error_handler(base::Bind( + &ProxyResolverMojo::Job::OnConnectionError, base::Unretained(this))); resolver_->mojo_proxy_resolver_ptr_->GetProxyForUrl(mojo::String::From(url_), - client_ptr.Pass()); + std::move(client_ptr)); } ProxyResolverMojo::Job::~Job() { @@ -251,11 +252,11 @@ ProxyResolverMojo::ProxyResolverMojo( scoped_ptr<base::ScopedClosureRunner> on_delete_callback_runner, scoped_ptr<ProxyResolverErrorObserver> error_observer, NetLog* net_log) - : mojo_proxy_resolver_ptr_(resolver_ptr.Pass()), + : mojo_proxy_resolver_ptr_(std::move(resolver_ptr)), host_resolver_(host_resolver), - error_observer_(error_observer.Pass()), + error_observer_(std::move(error_observer)), net_log_(net_log), - on_delete_callback_runner_(on_delete_callback_runner.Pass()) { + on_delete_callback_runner_(std::move(on_delete_callback_runner)) { mojo_proxy_resolver_ptr_.set_connection_error_handler(base::Bind( &ProxyResolverMojo::OnConnectionError, base::Unretained(this))); } @@ -338,12 +339,12 @@ class ProxyResolverFactoryMojo::Job resolver_(resolver), callback_(callback), binding_(this), - error_observer_(error_observer.Pass()) { + error_observer_(std::move(error_observer)) { interfaces::ProxyResolverFactoryRequestClientPtr client_ptr; binding_.Bind(mojo::GetProxy(&client_ptr)); on_delete_callback_runner_ = factory_->mojo_proxy_factory_->CreateResolver( mojo::String::From(pac_script->utf16()), mojo::GetProxy(&resolver_ptr_), - client_ptr.Pass()); + std::move(client_ptr)); resolver_ptr_.set_connection_error_handler( base::Bind(&ProxyResolverFactoryMojo::Job::OnConnectionError, base::Unretained(this))); @@ -359,10 +360,10 @@ class ProxyResolverFactoryMojo::Job resolver_ptr_.set_connection_error_handler(mojo::Closure()); binding_.set_connection_error_handler(mojo::Closure()); if (error == OK) { - resolver_->reset( - new ProxyResolverMojo(resolver_ptr_.Pass(), factory_->host_resolver_, - on_delete_callback_runner_.Pass(), - error_observer_.Pass(), factory_->net_log_)); + resolver_->reset(new ProxyResolverMojo( + std::move(resolver_ptr_), factory_->host_resolver_, + std::move(on_delete_callback_runner_), std::move(error_observer_), + factory_->net_log_)); } on_delete_callback_runner_.reset(); callback_.Run(error); diff --git a/chromium/net/proxy/proxy_resolver_factory_mojo.h b/chromium/net/proxy/proxy_resolver_factory_mojo.h index 65e4866a99b..f3e8483c793 100644 --- a/chromium/net/proxy/proxy_resolver_factory_mojo.h +++ b/chromium/net/proxy/proxy_resolver_factory_mojo.h @@ -5,11 +5,12 @@ #ifndef NET_PROXY_PROXY_RESOLVER_FACTORY_MOJO_H_ #define NET_PROXY_PROXY_RESOLVER_FACTORY_MOJO_H_ +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" +#include "mojo/public/cpp/bindings/binding.h" #include "net/base/completion_callback.h" #include "net/proxy/proxy_resolver_factory.h" -#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" namespace net { class HostResolver; diff --git a/chromium/net/proxy/proxy_resolver_factory_mojo_unittest.cc b/chromium/net/proxy/proxy_resolver_factory_mojo_unittest.cc index d0fd4ec1e59..9fa4ef587ec 100644 --- a/chromium/net/proxy/proxy_resolver_factory_mojo_unittest.cc +++ b/chromium/net/proxy/proxy_resolver_factory_mojo_unittest.cc @@ -8,14 +8,16 @@ #include <map> #include <queue> #include <string> +#include <utility> +#include <vector> #include "base/bind.h" #include "base/memory/scoped_ptr.h" -#include "base/memory/scoped_vector.h" #include "base/run_loop.h" #include "base/stl_util.h" #include "base/values.h" #include "mojo/common/common_type_converters.h" +#include "mojo/public/cpp/bindings/binding.h" #include "net/base/load_states.h" #include "net/base/net_errors.h" #include "net/base/test_completion_callback.h" @@ -29,7 +31,6 @@ #include "net/proxy/proxy_resolver_script_data.h" #include "net/test/event_waiter.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" #include "url/gurl.h" namespace net { @@ -201,7 +202,8 @@ class MockMojoProxyResolver : public interfaces::ProxyResolver { base::Closure quit_closure_; - ScopedVector<interfaces::ProxyResolverRequestClientPtr> blocked_clients_; + std::vector<scoped_ptr<interfaces::ProxyResolverRequestClientPtr>> + blocked_clients_; mojo::Binding<interfaces::ProxyResolver> binding_; }; @@ -237,7 +239,7 @@ void MockMojoProxyResolver::AddConnection( mojo::InterfaceRequest<interfaces::ProxyResolver> req) { if (binding_.is_bound()) binding_.Close(); - binding_.Bind(req.Pass()); + binding_.Bind(std::move(req)); } void MockMojoProxyResolver::GetProxyForUrl( @@ -252,7 +254,7 @@ void MockMojoProxyResolver::GetProxyForUrl( client->OnError(12345, url); switch (action.action) { case GetProxyForUrlAction::COMPLETE: { - client->ReportResult(action.error, action.proxy_servers.Pass()); + client->ReportResult(action.error, std::move(action.proxy_servers)); break; } case GetProxyForUrlAction::DROP: { @@ -274,9 +276,9 @@ void MockMojoProxyResolver::GetProxyForUrl( request->port = 12345; interfaces::HostResolverRequestClientPtr dns_client; mojo::GetProxy(&dns_client); - client->ResolveDns(request.Pass(), dns_client.Pass()); - blocked_clients_.push_back( - new interfaces::ProxyResolverRequestClientPtr(client.Pass())); + client->ResolveDns(std::move(request), std::move(dns_client)); + blocked_clients_.push_back(make_scoped_ptr( + new interfaces::ProxyResolverRequestClientPtr(std::move(client)))); break; } } @@ -291,7 +293,6 @@ class Request { void Cancel(); int WaitForResult(); - int error() const { return error_; } const ProxyInfo& results() const { return results_; } LoadState load_state() { return resolver_->GetLoadState(handle_); } BoundTestNetLog& net_log() { return net_log_; } @@ -352,9 +353,9 @@ class MockMojoProxyResolverFactory : public interfaces::ProxyResolverFactory { base::Closure quit_closure_; - ScopedVector<interfaces::ProxyResolverFactoryRequestClientPtr> + std::vector<scoped_ptr<interfaces::ProxyResolverFactoryRequestClientPtr>> blocked_clients_; - ScopedVector<mojo::InterfaceRequest<interfaces::ProxyResolver>> + std::vector<scoped_ptr<mojo::InterfaceRequest<interfaces::ProxyResolver>>> blocked_resolver_requests_; mojo::Binding<interfaces::ProxyResolverFactory> binding_; }; @@ -362,8 +363,7 @@ class MockMojoProxyResolverFactory : public interfaces::ProxyResolverFactory { MockMojoProxyResolverFactory::MockMojoProxyResolverFactory( MockMojoProxyResolver* resolver, mojo::InterfaceRequest<interfaces::ProxyResolverFactory> req) - : resolver_(resolver), binding_(this, req.Pass()) { -} + : resolver_(resolver), binding_(this, std::move(req)) {} MockMojoProxyResolverFactory::~MockMojoProxyResolverFactory() { EXPECT_TRUE(create_resolver_actions_.empty()) @@ -405,21 +405,22 @@ void MockMojoProxyResolverFactory::CreateResolver( switch (action.action) { case CreateProxyResolverAction::COMPLETE: { if (action.error == OK) - resolver_->AddConnection(request.Pass()); + resolver_->AddConnection(std::move(request)); client->ReportResult(action.error); break; } case CreateProxyResolverAction::DROP_CLIENT: { // Save |request| so its pipe isn't closed. blocked_resolver_requests_.push_back( - new mojo::InterfaceRequest<interfaces::ProxyResolver>( - request.Pass())); + make_scoped_ptr(new mojo::InterfaceRequest<interfaces::ProxyResolver>( + std::move(request)))); break; } case CreateProxyResolverAction::DROP_RESOLVER: { // Save |client| so its pipe isn't closed. blocked_clients_.push_back( - new interfaces::ProxyResolverFactoryRequestClientPtr(client.Pass())); + make_scoped_ptr(new interfaces::ProxyResolverFactoryRequestClientPtr( + std::move(client)))); break; } case CreateProxyResolverAction::DROP_BOTH: { @@ -437,9 +438,10 @@ void MockMojoProxyResolverFactory::CreateResolver( request->port = 12345; interfaces::HostResolverRequestClientPtr dns_client; mojo::GetProxy(&dns_client); - client->ResolveDns(request.Pass(), dns_client.Pass()); + client->ResolveDns(std::move(request), std::move(dns_client)); blocked_clients_.push_back( - new interfaces::ProxyResolverFactoryRequestClientPtr(client.Pass())); + make_scoped_ptr(new interfaces::ProxyResolverFactoryRequestClientPtr( + std::move(client)))); break; } } @@ -524,7 +526,7 @@ class ProxyResolverFactoryMojoTest : public testing::Test, const mojo::String& pac_script, mojo::InterfaceRequest<interfaces::ProxyResolver> req, interfaces::ProxyResolverFactoryRequestClientPtr client) override { - factory_ptr_->CreateResolver(pac_script, req.Pass(), client.Pass()); + factory_ptr_->CreateResolver(pac_script, std::move(req), std::move(client)); return make_scoped_ptr( new base::ScopedClosureRunner(on_delete_callback_.closure())); } @@ -566,8 +568,8 @@ class ProxyResolverFactoryMojoTest : public testing::Test, scoped_ptr<ProxyResolverFactory> proxy_resolver_factory_mojo_; MockMojoProxyResolver mock_proxy_resolver_; - scoped_ptr<ProxyResolver> proxy_resolver_mojo_; TestClosure on_delete_callback_; + scoped_ptr<ProxyResolver> proxy_resolver_mojo_; }; TEST_F(ProxyResolverFactoryMojoTest, CreateProxyResolver) { diff --git a/chromium/net/proxy/proxy_resolver_mac.h b/chromium/net/proxy/proxy_resolver_mac.h index 6d89ef539d5..f8650212209 100644 --- a/chromium/net/proxy/proxy_resolver_mac.h +++ b/chromium/net/proxy/proxy_resolver_mac.h @@ -6,6 +6,7 @@ #define NET_PROXY_PROXY_RESOLVER_MAC_H_ #include "base/compiler_specific.h" +#include "base/macros.h" #include "net/base/net_export.h" #include "net/proxy/proxy_resolver_factory.h" #include "url/gurl.h" diff --git a/chromium/net/proxy/proxy_resolver_perftest.cc b/chromium/net/proxy/proxy_resolver_perftest.cc index 939018150bb..7aae5b21b38 100644 --- a/chromium/net/proxy/proxy_resolver_perftest.cc +++ b/chromium/net/proxy/proxy_resolver_perftest.cc @@ -2,9 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/base_paths.h" #include "base/compiler_specific.h" #include "base/files/file_util.h" +#include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/path_service.h" #include "base/strings/string_util.h" @@ -15,7 +18,7 @@ #include "net/proxy/proxy_resolver.h" #include "net/proxy/proxy_resolver_factory.h" #include "net/proxy/proxy_resolver_v8.h" -#include "net/test/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "testing/gtest/include/gtest/gtest.h" #if defined(OS_WIN) @@ -90,12 +93,10 @@ class PacPerfSuiteRunner { // |resolver_name| is the label used when logging the results. PacPerfSuiteRunner(ProxyResolverFactory* factory, const std::string& resolver_name) - : factory_(factory), - resolver_name_(resolver_name), - test_server_(SpawnedTestServer::TYPE_HTTP, - SpawnedTestServer::kLocalhost, - base::FilePath(FILE_PATH_LITERAL( - "net/data/proxy_resolver_perftest"))) {} + : factory_(factory), resolver_name_(resolver_name) { + test_server_.ServeFilesFromSourceDirectory( + "net/data/proxy_resolver_perftest"); + } void RunAllTests() { ASSERT_TRUE(test_server_.Start()); @@ -113,8 +114,7 @@ class PacPerfSuiteRunner { int queries_len) { scoped_ptr<ProxyResolver> resolver; if (!factory_->expects_pac_bytes()) { - GURL pac_url = - test_server_.GetURL(std::string("files/") + script_name); + GURL pac_url = test_server_.GetURL(std::string("/") + script_name); int rv = factory_->CreateProxyResolver( ProxyResolverScriptData::FromURL(pac_url), &resolver, CompletionCallback(), nullptr); @@ -189,7 +189,7 @@ class PacPerfSuiteRunner { ProxyResolverFactory* factory_; std::string resolver_name_; - SpawnedTestServer test_server_; + EmbeddedTestServer test_server_; }; #if defined(OS_WIN) @@ -229,7 +229,7 @@ class ProxyResolverV8Wrapper : public ProxyResolver { public: ProxyResolverV8Wrapper(scoped_ptr<ProxyResolverV8> resolver, scoped_ptr<MockJSBindings> bindings) - : resolver_(resolver.Pass()), bindings_(bindings.Pass()) {} + : resolver_(std::move(resolver)), bindings_(std::move(bindings)) {} int GetProxyForURL(const GURL& url, ProxyInfo* results, @@ -266,8 +266,8 @@ class ProxyResolverV8Factory : public ProxyResolverFactory { int result = ProxyResolverV8::Create(pac_script, js_bindings_.get(), &v8_resolver); if (result == OK) { - resolver->reset( - new ProxyResolverV8Wrapper(v8_resolver.Pass(), js_bindings_.Pass())); + resolver->reset(new ProxyResolverV8Wrapper(std::move(v8_resolver), + std::move(js_bindings_))); } return result; } diff --git a/chromium/net/proxy/proxy_resolver_v8.cc b/chromium/net/proxy/proxy_resolver_v8.cc index 73f0428a2cf..80ae06b7e55 100644 --- a/chromium/net/proxy/proxy_resolver_v8.cc +++ b/chromium/net/proxy/proxy_resolver_v8.cc @@ -6,13 +6,14 @@ #include <algorithm> #include <cstdio> +#include <utility> #include "base/auto_reset.h" -#include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/debug/leak_annotations.h" #include "base/lazy_instance.h" #include "base/logging.h" +#include "base/macros.h" #include "base/strings/string_tokenizer.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -97,7 +98,7 @@ class V8ExternalStringFromScriptData : script_data_(script_data) {} const uint16_t* data() const override { - return reinterpret_cast<const uint16*>(script_data_->utf16().data()); + return reinterpret_cast<const uint16_t*>(script_data_->utf16().data()); } size_t length() const override { return script_data_->utf16().size(); } @@ -372,8 +373,16 @@ class SharedIsolateFactory { gin::V8Initializer::LoadV8Natives(); #endif + // The performance of the proxy resolver is limited by DNS resolution, + // and not V8, so tune down V8 to use as little memory as possible. + static const char kOptimizeForSize[] = "--optimize_for_size"; + v8::V8::SetFlagsFromString(kOptimizeForSize, strlen(kOptimizeForSize)); + static const char kNoOpt[] = "--noopt"; + v8::V8::SetFlagsFromString(kNoOpt, strlen(kNoOpt)); + gin::IsolateHolder::Initialize( gin::IsolateHolder::kNonStrictMode, + gin::IsolateHolder::kStableV8Extras, gin::ArrayBufferAllocator::SharedInstance()); has_initialized_v8_ = true; @@ -825,7 +834,7 @@ class ProxyResolverV8::Context { // ProxyResolverV8 ------------------------------------------------------------ ProxyResolverV8::ProxyResolverV8(scoped_ptr<Context> context) - : context_(context.Pass()) { + : context_(std::move(context)) { DCHECK(context_); } @@ -853,7 +862,7 @@ int ProxyResolverV8::Create( new Context(g_isolate_factory.Get().GetSharedIsolate())); int rv = context->InitV8(script_data, js_bindings); if (rv == OK) - resolver->reset(new ProxyResolverV8(context.Pass())); + resolver->reset(new ProxyResolverV8(std::move(context))); return rv; } diff --git a/chromium/net/proxy/proxy_resolver_v8.h b/chromium/net/proxy/proxy_resolver_v8.h index 98746ac0279..abd2e94a413 100644 --- a/chromium/net/proxy/proxy_resolver_v8.h +++ b/chromium/net/proxy/proxy_resolver_v8.h @@ -5,7 +5,10 @@ #ifndef NET_PROXY_PROXY_RESOLVER_V8_H_ #define NET_PROXY_PROXY_RESOLVER_V8_H_ +#include <stddef.h> + #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" diff --git a/chromium/net/proxy/proxy_resolver_v8_tracing.cc b/chromium/net/proxy/proxy_resolver_v8_tracing.cc index 27cf5f7b788..94ad9f0d6c4 100644 --- a/chromium/net/proxy/proxy_resolver_v8_tracing.cc +++ b/chromium/net/proxy/proxy_resolver_v8_tracing.cc @@ -6,9 +6,11 @@ #include <map> #include <string> +#include <utility> #include <vector> #include "base/bind.h" +#include "base/macros.h" #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" #include "base/synchronization/cancellation_flag.h" @@ -331,7 +333,7 @@ Job::Job(const Job::Params* params, scoped_ptr<ProxyResolverV8Tracing::Bindings> bindings) : origin_runner_(base::ThreadTaskRunnerHandle::Get()), params_(params), - bindings_(bindings.Pass()), + bindings_(std::move(bindings)), event_(true, false), last_num_dns_(0), pending_dns_(NULL) { @@ -553,7 +555,7 @@ int Job::ExecuteProxyResolver() { scoped_ptr<ProxyResolverV8> resolver; result = ProxyResolverV8::Create(script_data_, this, &resolver); if (result == OK) - *resolver_out_ = resolver.Pass(); + *resolver_out_ = std::move(resolver); break; } case GET_PROXY_FOR_URL: { @@ -916,9 +918,9 @@ ProxyResolverV8TracingImpl::ProxyResolverV8TracingImpl( scoped_ptr<base::Thread> thread, scoped_ptr<ProxyResolverV8> resolver, scoped_ptr<Job::Params> job_params) - : thread_(thread.Pass()), - v8_resolver_(resolver.Pass()), - job_params_(job_params.Pass()), + : thread_(std::move(thread)), + v8_resolver_(std::move(resolver)), + job_params_(std::move(job_params)), num_outstanding_callbacks_(0) { job_params_->num_outstanding_callbacks = &num_outstanding_callbacks_; } @@ -941,7 +943,7 @@ void ProxyResolverV8TracingImpl::GetProxyForURL( DCHECK(CalledOnValidThread()); DCHECK(!callback.is_null()); - scoped_refptr<Job> job = new Job(job_params_.get(), bindings.Pass()); + scoped_refptr<Job> job = new Job(job_params_.get(), std::move(bindings)); if (request) *request = job.get(); @@ -1002,7 +1004,7 @@ class ProxyResolverV8TracingFactoryImpl::CreateJob CHECK(thread_->StartWithOptions(options)); job_params_.reset( new Job::Params(thread_->task_runner(), &num_outstanding_callbacks_)); - create_resolver_job_ = new Job(job_params_.get(), bindings.Pass()); + create_resolver_job_ = new Job(job_params_.get(), std::move(bindings)); create_resolver_job_->StartCreateV8Resolver( pac_script, &v8_resolver_, base::Bind( @@ -1033,7 +1035,7 @@ class ProxyResolverV8TracingFactoryImpl::CreateJob if (error == OK) { job_params_->v8_resolver = v8_resolver_.get(); resolver_out_->reset(new ProxyResolverV8TracingImpl( - thread_.Pass(), v8_resolver_.Pass(), job_params_.Pass())); + std::move(thread_), std::move(v8_resolver_), std::move(job_params_))); } else { StopWorkerThread(); } @@ -1078,9 +1080,9 @@ void ProxyResolverV8TracingFactoryImpl::CreateProxyResolverV8Tracing( const CompletionCallback& callback, scoped_ptr<ProxyResolverFactory::Request>* request) { scoped_ptr<CreateJob> job( - new CreateJob(this, bindings.Pass(), pac_script, resolver, callback)); + new CreateJob(this, std::move(bindings), pac_script, resolver, callback)); jobs_.insert(job.get()); - *request = job.Pass(); + *request = std::move(job); } void ProxyResolverV8TracingFactoryImpl::RemoveJob( diff --git a/chromium/net/proxy/proxy_resolver_v8_tracing.h b/chromium/net/proxy/proxy_resolver_v8_tracing.h index cd9ae6c8eff..f5f66cf7486 100644 --- a/chromium/net/proxy/proxy_resolver_v8_tracing.h +++ b/chromium/net/proxy/proxy_resolver_v8_tracing.h @@ -5,7 +5,7 @@ #ifndef NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ #define NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "net/base/net_export.h" diff --git a/chromium/net/proxy/proxy_resolver_v8_tracing_unittest.cc b/chromium/net/proxy/proxy_resolver_v8_tracing_unittest.cc index 3bec37031d8..888dd18af57 100644 --- a/chromium/net/proxy/proxy_resolver_v8_tracing_unittest.cc +++ b/chromium/net/proxy/proxy_resolver_v8_tracing_unittest.cc @@ -5,6 +5,7 @@ #include "net/proxy/proxy_resolver_v8_tracing.h" #include <string> +#include <utility> #include "base/files/file_util.h" #include "base/path_service.h" @@ -142,11 +143,11 @@ scoped_ptr<ProxyResolverV8Tracing> CreateResolver( TestCompletionCallback callback; scoped_ptr<ProxyResolverFactory::Request> request; factory->CreateProxyResolverV8Tracing(LoadScriptData(filename), - bindings.Pass(), &resolver, + std::move(bindings), &resolver, callback.callback(), &request); EXPECT_EQ(OK, callback.WaitForResult()); EXPECT_TRUE(resolver); - return resolver.Pass(); + return resolver; } TEST_F(ProxyResolverV8TracingTest, Simple) { @@ -688,7 +689,7 @@ class BlockableHostResolver : public HostResolver { // Indicate to the caller that a request was received. EXPECT_TRUE(waiting_for_resolve_); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); // This line is intentionally after action_.Run(), since one of the // tests does a cancellation inside of Resolve(), and it is more diff --git a/chromium/net/proxy/proxy_resolver_v8_tracing_wrapper.cc b/chromium/net/proxy/proxy_resolver_v8_tracing_wrapper.cc index 01dde664872..25144b61813 100644 --- a/chromium/net/proxy/proxy_resolver_v8_tracing_wrapper.cc +++ b/chromium/net/proxy/proxy_resolver_v8_tracing_wrapper.cc @@ -5,8 +5,10 @@ #include "net/proxy/proxy_resolver_v8_tracing_wrapper.h" #include <string> +#include <utility> #include "base/bind.h" +#include "base/macros.h" #include "base/values.h" #include "net/base/net_errors.h" #include "net/log/net_log.h" @@ -23,7 +25,7 @@ scoped_ptr<base::Value> NetLogErrorCallback( scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetInteger("line_number", line_number); dict->SetString("message", *message); - return dict.Pass(); + return std::move(dict); } class BindingsImpl : public ProxyResolverV8Tracing::Bindings { @@ -107,11 +109,10 @@ ProxyResolverV8TracingWrapper::ProxyResolverV8TracingWrapper( NetLog* net_log, HostResolver* host_resolver, scoped_ptr<ProxyResolverErrorObserver> error_observer) - : resolver_impl_(resolver_impl.Pass()), + : resolver_impl_(std::move(resolver_impl)), net_log_(net_log), host_resolver_(host_resolver), - error_observer_(error_observer.Pass()) { -} + error_observer_(std::move(error_observer)) {} int ProxyResolverV8TracingWrapper::GetProxyForURL( const GURL& url, @@ -185,7 +186,8 @@ void ProxyResolverFactoryV8TracingWrapper::OnProxyResolverCreated( int error) { if (error == OK) { resolver->reset(new ProxyResolverV8TracingWrapper( - v8_resolver->Pass(), net_log_, host_resolver_, error_observer.Pass())); + std::move(*v8_resolver), net_log_, host_resolver_, + std::move(error_observer))); } callback.Run(error); } diff --git a/chromium/net/proxy/proxy_resolver_v8_tracing_wrapper.h b/chromium/net/proxy/proxy_resolver_v8_tracing_wrapper.h index 28343d80736..000f94db1c3 100644 --- a/chromium/net/proxy/proxy_resolver_v8_tracing_wrapper.h +++ b/chromium/net/proxy/proxy_resolver_v8_tracing_wrapper.h @@ -5,7 +5,7 @@ #ifndef NET_PROXY_PROXY_RESOLVER_V8_TRACING_WRAPPER_H_ #define NET_PROXY_PROXY_RESOLVER_V8_TRACING_WRAPPER_H_ -#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "net/base/net_export.h" diff --git a/chromium/net/proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc b/chromium/net/proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc index c83f6553796..946d4bf47a3 100644 --- a/chromium/net/proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc +++ b/chromium/net/proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc @@ -84,7 +84,7 @@ scoped_ptr<ProxyResolver> CreateResolver( EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(OK, callback.WaitForResult()); EXPECT_TRUE(resolver); - return resolver.Pass(); + return resolver; } class MockErrorObserver : public ProxyResolverErrorObserver { @@ -774,7 +774,7 @@ class BlockableHostResolver : public HostResolver { // Indicate to the caller that a request was received. EXPECT_TRUE(waiting_for_resolve_); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); // This line is intentionally after action_.Run(), since one of the // tests does a cancellation inside of Resolve(), and it is more diff --git a/chromium/net/proxy/proxy_resolver_winhttp.cc b/chromium/net/proxy/proxy_resolver_winhttp.cc index bfdce33252f..7dccbf0b93c 100644 --- a/chromium/net/proxy/proxy_resolver_winhttp.cc +++ b/chromium/net/proxy/proxy_resolver_winhttp.cc @@ -7,6 +7,7 @@ #include <windows.h> #include <winhttp.h> +#include "base/macros.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "net/base/net_errors.h" diff --git a/chromium/net/proxy/proxy_resolver_winhttp.h b/chromium/net/proxy/proxy_resolver_winhttp.h index 843711caca1..c6e8ac5ebdb 100644 --- a/chromium/net/proxy/proxy_resolver_winhttp.h +++ b/chromium/net/proxy/proxy_resolver_winhttp.h @@ -6,6 +6,7 @@ #define NET_PROXY_PROXY_RESOLVER_WINHTTP_H_ #include "base/compiler_specific.h" +#include "base/macros.h" #include "net/base/net_export.h" #include "net/proxy/proxy_resolver_factory.h" #include "url/gurl.h" diff --git a/chromium/net/proxy/proxy_script_decider.cc b/chromium/net/proxy/proxy_script_decider.cc index f30c162a06b..d131725cc8f 100644 --- a/chromium/net/proxy/proxy_script_decider.cc +++ b/chromium/net/proxy/proxy_script_decider.cc @@ -4,6 +4,8 @@ #include "net/proxy/proxy_script_decider.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/compiler_specific.h" @@ -72,7 +74,7 @@ scoped_ptr<base::Value> ProxyScriptDecider::PacSource::NetLogCallback( break; } dict->SetString("source", source); - return dict.Pass(); + return std::move(dict); } ProxyScriptDecider::ProxyScriptDecider( diff --git a/chromium/net/proxy/proxy_script_decider.h b/chromium/net/proxy/proxy_script_decider.h index cf5edff54f4..60cb24b0806 100644 --- a/chromium/net/proxy/proxy_script_decider.h +++ b/chromium/net/proxy/proxy_script_decider.h @@ -5,9 +5,12 @@ #ifndef NET_PROXY_PROXY_SCRIPT_DECIDER_H_ #define NET_PROXY_PROXY_SCRIPT_DECIDER_H_ +#include <stddef.h> + #include <string> #include <vector> +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/strings/string16.h" #include "base/time/time.h" diff --git a/chromium/net/proxy/proxy_script_decider_unittest.cc b/chromium/net/proxy/proxy_script_decider_unittest.cc index cc320a432af..33e8aa505d7 100644 --- a/chromium/net/proxy/proxy_script_decider_unittest.cc +++ b/chromium/net/proxy/proxy_script_decider_unittest.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/location.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" diff --git a/chromium/net/proxy/proxy_script_fetcher_impl.h b/chromium/net/proxy/proxy_script_fetcher_impl.h index b02c9fc5db7..fe0bf33d772 100644 --- a/chromium/net/proxy/proxy_script_fetcher_impl.h +++ b/chromium/net/proxy/proxy_script_fetcher_impl.h @@ -5,10 +5,12 @@ #ifndef NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_ #define NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_ +#include <stddef.h> + #include <string> -#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" diff --git a/chromium/net/proxy/proxy_script_fetcher_impl_unittest.cc b/chromium/net/proxy/proxy_script_fetcher_impl_unittest.cc index 62a332bdcf8..a230ab34ae8 100644 --- a/chromium/net/proxy/proxy_script_fetcher_impl_unittest.cc +++ b/chromium/net/proxy/proxy_script_fetcher_impl_unittest.cc @@ -5,9 +5,11 @@ #include "net/proxy/proxy_script_fetcher_impl.h" #include <string> +#include <utility> #include "base/compiler_specific.h" #include "base/files/file_path.h" +#include "base/macros.h" #include "base/path_service.h" #include "base/single_thread_task_runner.h" #include "base/strings/utf_string_conversions.h" @@ -24,7 +26,7 @@ #include "net/http/http_server_properties_impl.h" #include "net/http/transport_security_state.h" #include "net/ssl/ssl_config_service_defaults.h" -#include "net/test/spawned_test_server/spawned_test_server.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "net/url_request/url_request_context_storage.h" #include "net/url_request/url_request_file_job.h" #include "net/url_request/url_request_job_factory_impl.h" @@ -76,12 +78,11 @@ class RequestContext : public URLRequestContext { params.proxy_service = proxy_service(); params.ssl_config_service = ssl_config_service(); params.http_server_properties = http_server_properties(); - scoped_refptr<HttpNetworkSession> network_session( - new HttpNetworkSession(params)); - storage_.set_http_transaction_factory( - make_scoped_ptr(new HttpCache(network_session.get(), - HttpCache::DefaultBackend::InMemory(0))) - .Pass()); + storage_.set_http_network_session( + make_scoped_ptr(new HttpNetworkSession(params))); + storage_.set_http_transaction_factory(make_scoped_ptr( + new HttpCache(storage_.http_network_session(), + HttpCache::DefaultBackend::InMemory(0), false))); scoped_ptr<URLRequestJobFactoryImpl> job_factory = make_scoped_ptr(new URLRequestJobFactoryImpl()); #if !defined(DISABLE_FILE_SUPPORT) @@ -89,7 +90,7 @@ class RequestContext : public URLRequestContext { make_scoped_ptr(new FileProtocolHandler( base::ThreadTaskRunnerHandle::Get()))); #endif - storage_.set_job_factory(job_factory.Pass()); + storage_.set_job_factory(std::move(job_factory)); } ~RequestContext() override { AssertNoURLRequests(); } @@ -187,15 +188,13 @@ class BasicNetworkDelegate : public NetworkDelegateImpl { class ProxyScriptFetcherImplTest : public PlatformTest { public: - ProxyScriptFetcherImplTest() - : test_server_(SpawnedTestServer::TYPE_HTTP, - SpawnedTestServer::kLocalhost, - base::FilePath(kDocRoot)) { + ProxyScriptFetcherImplTest() { + test_server_.AddDefaultHandlers(base::FilePath(kDocRoot)); context_.set_network_delegate(&network_delegate_); } protected: - SpawnedTestServer test_server_; + EmbeddedTestServer test_server_; BasicNetworkDelegate network_delegate_; RequestContext context_; }; @@ -233,7 +232,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpMimeType) { ProxyScriptFetcherImpl pac_fetcher(&context_); { // Fetch a PAC with mime type "text/plain" - GURL url(test_server_.GetURL("files/pac.txt")); + GURL url(test_server_.GetURL("/pac.txt")); base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); @@ -242,7 +241,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpMimeType) { EXPECT_EQ(ASCIIToUTF16("-pac.txt-\n"), text); } { // Fetch a PAC with mime type "text/html" - GURL url(test_server_.GetURL("files/pac.html")); + GURL url(test_server_.GetURL("/pac.html")); base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); @@ -251,7 +250,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpMimeType) { EXPECT_EQ(ASCIIToUTF16("-pac.html-\n"), text); } { // Fetch a PAC with mime type "application/x-ns-proxy-autoconfig" - GURL url(test_server_.GetURL("files/pac.nsproxy")); + GURL url(test_server_.GetURL("/pac.nsproxy")); base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); @@ -267,7 +266,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpStatusCode) { ProxyScriptFetcherImpl pac_fetcher(&context_); { // Fetch a PAC which gives a 500 -- FAIL - GURL url(test_server_.GetURL("files/500.pac")); + GURL url(test_server_.GetURL("/500.pac")); base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); @@ -276,7 +275,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpStatusCode) { EXPECT_TRUE(text.empty()); } { // Fetch a PAC which gives a 404 -- FAIL - GURL url(test_server_.GetURL("files/404.pac")); + GURL url(test_server_.GetURL("/404.pac")); base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); @@ -293,7 +292,7 @@ TEST_F(ProxyScriptFetcherImplTest, ContentDisposition) { // Fetch PAC scripts via HTTP with a Content-Disposition header -- should // have no effect. - GURL url(test_server_.GetURL("files/downloadable.pac")); + GURL url(test_server_.GetURL("/downloadable.pac")); base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); @@ -309,7 +308,7 @@ TEST_F(ProxyScriptFetcherImplTest, NoCache) { ProxyScriptFetcherImpl pac_fetcher(&context_); // Fetch a PAC script whose HTTP headers make it cacheable for 1 hour. - GURL url(test_server_.GetURL("files/cacheable_1hr.pac")); + GURL url(test_server_.GetURL("/cacheable_1hr.pac")); { base::string16 text; TestCompletionCallback callback; @@ -320,7 +319,7 @@ TEST_F(ProxyScriptFetcherImplTest, NoCache) { } // Kill the HTTP server. - ASSERT_TRUE(test_server_.Stop()); + ASSERT_TRUE(test_server_.ShutdownAndWaitUntilComplete()); // Try to fetch the file again. Since the server is not running anymore, the // call should fail, thus indicating that the file was not fetched from the @@ -346,7 +345,7 @@ TEST_F(ProxyScriptFetcherImplTest, TooLarge) { // These two URLs are the same file, but are http:// vs file:// GURL urls[] = { - test_server_.GetURL("files/large-pac.nsproxy"), + test_server_.GetURL("/large-pac.nsproxy"), #if !defined(DISABLE_FILE_SUPPORT) GetTestFileUrl("large-pac.nsproxy") #endif @@ -368,7 +367,7 @@ TEST_F(ProxyScriptFetcherImplTest, TooLarge) { pac_fetcher.SetSizeConstraint(prev_size); { // Make sure we can still fetch regular URLs. - GURL url(test_server_.GetURL("files/pac.nsproxy")); + GURL url(test_server_.GetURL("/pac.nsproxy")); base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); @@ -390,7 +389,7 @@ TEST_F(ProxyScriptFetcherImplTest, Hang) { // Try fetching a URL which takes 1.2 seconds. We should abort the request // after 500 ms, and fail with a timeout error. { - GURL url(test_server_.GetURL("slow/proxy.pac?1.2")); + GURL url(test_server_.GetURL("/slow/proxy.pac?1.2")); base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); @@ -403,7 +402,7 @@ TEST_F(ProxyScriptFetcherImplTest, Hang) { pac_fetcher.SetTimeoutConstraint(prev_timeout); { // Make sure we can still fetch regular URLs. - GURL url(test_server_.GetURL("files/pac.nsproxy")); + GURL url(test_server_.GetURL("/pac.nsproxy")); base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); @@ -423,7 +422,7 @@ TEST_F(ProxyScriptFetcherImplTest, Encodings) { // Test a response that is gzip-encoded -- should get inflated. { - GURL url(test_server_.GetURL("files/gzipped_pac")); + GURL url(test_server_.GetURL("/gzipped_pac")); base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); @@ -435,7 +434,7 @@ TEST_F(ProxyScriptFetcherImplTest, Encodings) { // Test a response that was served as UTF-16 (BE). It should // be converted to UTF8. { - GURL url(test_server_.GetURL("files/utf16be_pac")); + GURL url(test_server_.GetURL("/utf16be_pac")); base::string16 text; TestCompletionCallback callback; int result = pac_fetcher.Fetch(url, &text, callback.callback()); diff --git a/chromium/net/proxy/proxy_server.cc b/chromium/net/proxy/proxy_server.cc index e451265cbb9..d3ba5ba1e67 100644 --- a/chromium/net/proxy/proxy_server.cc +++ b/chromium/net/proxy/proxy_server.cc @@ -6,7 +6,6 @@ #include <algorithm> -#include "base/basictypes.h" #include "base/strings/string_util.h" #include "net/base/net_util.h" #include "net/http/http_util.h" @@ -236,7 +235,7 @@ ProxyServer ProxyServer::FromSchemeHostAndPort( if (port == -1) port = GetDefaultPortForScheme(scheme); - host_port_pair = HostPortPair(host, static_cast<uint16>(port)); + host_port_pair = HostPortPair(host, static_cast<uint16_t>(port)); } return ProxyServer(scheme, host_port_pair); diff --git a/chromium/net/proxy/proxy_server.h b/chromium/net/proxy/proxy_server.h index 1ff65367285..12ec217506e 100644 --- a/chromium/net/proxy/proxy_server.h +++ b/chromium/net/proxy/proxy_server.h @@ -12,6 +12,8 @@ #endif #include <string> +#include <tuple> + #include "net/base/host_port_pair.h" #include "net/base/net_export.h" @@ -149,9 +151,8 @@ class NET_EXPORT ProxyServer { // Comparator function so this can be placed in a std::map. bool operator<(const ProxyServer& other) const { - if (scheme_ != other.scheme_) - return scheme_ < other.scheme_; - return host_port_pair_ < other.host_port_pair_; + return std::tie(scheme_, host_port_pair_) < + std::tie(other.scheme_, other.host_port_pair_); } private: diff --git a/chromium/net/proxy/proxy_server_unittest.cc b/chromium/net/proxy/proxy_server_unittest.cc index 25ad4345c63..3589517b2d9 100644 --- a/chromium/net/proxy/proxy_server_unittest.cc +++ b/chromium/net/proxy/proxy_server_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/basictypes.h" +#include "base/macros.h" #include "net/proxy/proxy_server.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chromium/net/proxy/proxy_service.cc b/chromium/net/proxy/proxy_service.cc index 2beb7e8c816..2c30f745290 100644 --- a/chromium/net/proxy/proxy_service.cc +++ b/chromium/net/proxy/proxy_service.cc @@ -5,12 +5,14 @@ #include "net/proxy/proxy_service.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" #include "base/compiler_specific.h" #include "base/location.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/metrics/histogram_macros.h" #include "base/single_thread_task_runner.h" @@ -74,7 +76,7 @@ namespace { // set up. Network failures can happen at any time though, so we additionally // poll the PAC script for changes, which will allow us to recover from these // sorts of problems. -const int64 kDelayAfterNetworkChangesMs = 2000; +const int64_t kDelayAfterNetworkChangesMs = 2000; // This is the default policy for polling the PAC script. // @@ -302,7 +304,7 @@ scoped_ptr<base::Value> NetLogProxyConfigChangedCallback( if (old_config->is_valid()) dict->Set("old_config", old_config->ToValue()); dict->Set("new_config", new_config->ToValue()); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> NetLogBadProxyListCallback( @@ -316,7 +318,7 @@ scoped_ptr<base::Value> NetLogBadProxyListCallback( list->Append(new base::StringValue(iter->first)); } dict->Set("bad_proxy_list", list); - return dict.Pass(); + return std::move(dict); } // Returns NetLog parameters on a successfuly proxy resolution. @@ -325,7 +327,7 @@ scoped_ptr<base::Value> NetLogFinishedResolvingProxyCallback( NetLogCaptureMode /* capture_mode */) { scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); dict->SetString("pac_string", result->ToPacString()); - return dict.Pass(); + return std::move(dict); } #if defined(OS_CHROMEOS) @@ -922,7 +924,7 @@ class ProxyService::PacRequest ProxyService::ProxyService(scoped_ptr<ProxyConfigService> config_service, scoped_ptr<ProxyResolverFactory> resolver_factory, NetLog* net_log) - : resolver_factory_(resolver_factory.Pass()), + : resolver_factory_(std::move(resolver_factory)), next_config_id_(1), current_state_(STATE_NONE), net_log_(net_log), @@ -931,7 +933,7 @@ ProxyService::ProxyService(scoped_ptr<ProxyConfigService> config_service, quick_check_enabled_(true) { NetworkChangeNotifier::AddIPAddressObserver(this); NetworkChangeNotifier::AddDNSObserver(this); - ResetConfigService(config_service.Pass()); + ResetConfigService(std::move(config_service)); } // static @@ -943,14 +945,14 @@ scoped_ptr<ProxyService> ProxyService::CreateUsingSystemProxyResolver( if (!ProxyResolverFactoryForSystem::IsSupported()) { VLOG(1) << "PAC support disabled because there is no system implementation"; - return CreateWithoutProxyResolver(proxy_config_service.Pass(), net_log); + return CreateWithoutProxyResolver(std::move(proxy_config_service), net_log); } if (num_pac_threads == 0) num_pac_threads = kDefaultNumPacThreads; return make_scoped_ptr(new ProxyService( - proxy_config_service.Pass(), + std::move(proxy_config_service), make_scoped_ptr(new ProxyResolverFactoryForSystem(num_pac_threads)), net_log)); } @@ -960,7 +962,7 @@ scoped_ptr<ProxyService> ProxyService::CreateWithoutProxyResolver( scoped_ptr<ProxyConfigService> proxy_config_service, NetLog* net_log) { return make_scoped_ptr(new ProxyService( - proxy_config_service.Pass(), + std::move(proxy_config_service), make_scoped_ptr(new ProxyResolverFactoryForNullResolver), net_log)); } @@ -1000,7 +1002,7 @@ scoped_ptr<ProxyService> ProxyService::CreateFixedFromPacResult( new ProxyConfigServiceFixed(ProxyConfig::CreateAutoDetect())); return make_scoped_ptr(new ProxyService( - proxy_config_service.Pass(), + std::move(proxy_config_service), make_scoped_ptr(new ProxyResolverFactoryForPacResult(pac_string)), NULL)); } @@ -1391,13 +1393,17 @@ int ProxyService::DidFinishResolvingProxy(const GURL& url, if (network_delegate) network_delegate->NotifyResolveProxy(url, load_flags, *this, result); - // When logging all events is enabled, dump the proxy list. - if (net_log.IsCapturing()) { + net_log.AddEvent(NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, + base::Bind(&NetLogFinishedResolvingProxyCallback, result)); + + // This check is done to only log the NetLog event when necessary, it's + // not a performance optimization. + if (!proxy_retry_info_.empty()) { + result->DeprioritizeBadProxies(proxy_retry_info_); net_log.AddEvent( - NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, + NetLog::TYPE_PROXY_SERVICE_DEPRIORITIZED_BAD_PROXIES, base::Bind(&NetLogFinishedResolvingProxyCallback, result)); } - result->DeprioritizeBadProxies(proxy_retry_info_); } else { net_log.AddEventWithNetErrorCode( NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, result_code); @@ -1441,7 +1447,7 @@ void ProxyService::SetProxyScriptFetchers( DCHECK(CalledOnValidThread()); State previous_state = ResetProxyConfig(false); proxy_script_fetcher_.reset(proxy_script_fetcher); - dhcp_proxy_script_fetcher_ = dhcp_proxy_script_fetcher.Pass(); + dhcp_proxy_script_fetcher_ = std::move(dhcp_proxy_script_fetcher); if (previous_state != STATE_NONE) ApplyProxyConfigIfAvailable(); } @@ -1479,7 +1485,7 @@ void ProxyService::ResetConfigService( config_service_->RemoveObserver(this); // Set the new configuration service. - config_service_ = new_proxy_config_service.Pass(); + config_service_ = std::move(new_proxy_config_service); config_service_->AddObserver(this); if (previous_state != STATE_NONE) @@ -1524,7 +1530,7 @@ scoped_ptr<ProxyConfigService> ProxyService::CreateSystemProxyConfigService( linux_config_service->SetupAndFetchInitialConfig( glib_thread_task_runner, io_task_runner, file_task_runner); - return linux_config_service.Pass(); + return std::move(linux_config_service); #elif defined(OS_ANDROID) return make_scoped_ptr(new ProxyConfigServiceAndroid( io_task_runner, base::ThreadTaskRunnerHandle::Get())); diff --git a/chromium/net/proxy/proxy_service.h b/chromium/net/proxy/proxy_service.h index c8bf0adb673..e71fe9b9c0f 100644 --- a/chromium/net/proxy/proxy_service.h +++ b/chromium/net/proxy/proxy_service.h @@ -5,11 +5,14 @@ #ifndef NET_PROXY_PROXY_SERVICE_H_ #define NET_PROXY_PROXY_SERVICE_H_ +#include <stddef.h> + #include <set> #include <string> #include <vector> #include "base/gtest_prod_util.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/synchronization/waitable_event.h" @@ -286,8 +289,6 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver, quick_check_enabled_ = value; } - bool quick_check_enabled() const { return quick_check_enabled_; } - private: FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect); FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect); diff --git a/chromium/net/proxy/proxy_service_mojo.cc b/chromium/net/proxy/proxy_service_mojo.cc index b7910ad0208..41bbc3c2700 100644 --- a/chromium/net/proxy/proxy_service_mojo.cc +++ b/chromium/net/proxy/proxy_service_mojo.cc @@ -4,6 +4,8 @@ #include "net/proxy/proxy_service_mojo.h" +#include <utility> + #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/thread_task_runner_handle.h" @@ -34,7 +36,7 @@ scoped_ptr<ProxyService> CreateProxyServiceUsingMojoFactory( DCHECK(host_resolver); scoped_ptr<ProxyService> proxy_service(new ProxyService( - proxy_config_service.Pass(), + std::move(proxy_config_service), make_scoped_ptr(new ProxyResolverFactoryMojo( mojo_proxy_factory, host_resolver, base::Bind(&NetworkDelegateErrorObserver::Create, network_delegate, @@ -44,7 +46,7 @@ scoped_ptr<ProxyService> CreateProxyServiceUsingMojoFactory( // Configure fetchers to use for PAC script downloads and auto-detect. proxy_service->SetProxyScriptFetchers(proxy_script_fetcher, - dhcp_proxy_script_fetcher.Pass()); + std::move(dhcp_proxy_script_fetcher)); return proxy_service; } @@ -58,8 +60,8 @@ scoped_ptr<ProxyService> CreateProxyServiceUsingMojoInProcess( NetworkDelegate* network_delegate) { return CreateProxyServiceUsingMojoFactory( InProcessMojoProxyResolverFactory::GetInstance(), - proxy_config_service.Pass(), proxy_script_fetcher, - dhcp_proxy_script_fetcher.Pass(), host_resolver, net_log, + std::move(proxy_config_service), proxy_script_fetcher, + std::move(dhcp_proxy_script_fetcher), host_resolver, net_log, network_delegate); } diff --git a/chromium/net/proxy/proxy_service_mojo.h b/chromium/net/proxy/proxy_service_mojo.h index 8fc88c09432..a728337b28e 100644 --- a/chromium/net/proxy/proxy_service_mojo.h +++ b/chromium/net/proxy/proxy_service_mojo.h @@ -5,7 +5,6 @@ #ifndef NET_PROXY_PROXY_SERVICE_MOJO_H_ #define NET_PROXY_PROXY_SERVICE_MOJO_H_ -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "net/proxy/dhcp_proxy_script_fetcher.h" diff --git a/chromium/net/proxy/proxy_service_mojo_unittest.cc b/chromium/net/proxy/proxy_service_mojo_unittest.cc index 2d7ae076152..5dd94b00cfb 100644 --- a/chromium/net/proxy/proxy_service_mojo_unittest.cc +++ b/chromium/net/proxy/proxy_service_mojo_unittest.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <string> +#include <utility> #include "base/callback_helpers.h" #include "base/memory/scoped_ptr.h" @@ -138,7 +139,7 @@ class ProxyServiceMojoTest : public testing::Test, mojo::InterfaceRequest<interfaces::ProxyResolver> req, interfaces::ProxyResolverFactoryRequestClientPtr client) override { InProcessMojoProxyResolverFactory::GetInstance()->CreateResolver( - pac_script, req.Pass(), client.Pass()); + pac_script, std::move(req), std::move(client)); return make_scoped_ptr( new base::ScopedClosureRunner(on_delete_closure_.closure())); } @@ -147,8 +148,8 @@ class ProxyServiceMojoTest : public testing::Test, LoggingMockHostResolver mock_host_resolver_; MockProxyScriptFetcher* fetcher_; // Owned by |proxy_service_|. TestNetLog net_log_; - scoped_ptr<ProxyService> proxy_service_; TestClosure on_delete_closure_; + scoped_ptr<ProxyService> proxy_service_; }; TEST_F(ProxyServiceMojoTest, Basic) { diff --git a/chromium/net/proxy/proxy_service_unittest.cc b/chromium/net/proxy/proxy_service_unittest.cc index 6e8dcdb7db3..3d23b583345 100644 --- a/chromium/net/proxy/proxy_service_unittest.cc +++ b/chromium/net/proxy/proxy_service_unittest.cc @@ -9,6 +9,7 @@ #include "base/format_macros.h" #include "base/logging.h" +#include "base/macros.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "net/base/load_flags.h" diff --git a/chromium/net/proxy/proxy_service_v8.cc b/chromium/net/proxy/proxy_service_v8.cc index 358a244a11b..4c344921fea 100644 --- a/chromium/net/proxy/proxy_service_v8.cc +++ b/chromium/net/proxy/proxy_service_v8.cc @@ -4,6 +4,8 @@ #include "net/proxy/proxy_service_v8.h" +#include <utility> + #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/thread_task_runner_handle.h" @@ -30,7 +32,7 @@ scoped_ptr<ProxyService> CreateProxyServiceUsingV8ProxyResolver( DCHECK(host_resolver); scoped_ptr<ProxyService> proxy_service(new ProxyService( - proxy_config_service.Pass(), + std::move(proxy_config_service), make_scoped_ptr(new ProxyResolverFactoryV8TracingWrapper( host_resolver, net_log, base::Bind(&NetworkDelegateErrorObserver::Create, network_delegate, @@ -39,7 +41,7 @@ scoped_ptr<ProxyService> CreateProxyServiceUsingV8ProxyResolver( // Configure fetchers to use for PAC script downloads and auto-detect. proxy_service->SetProxyScriptFetchers(proxy_script_fetcher, - dhcp_proxy_script_fetcher.Pass()); + std::move(dhcp_proxy_script_fetcher)); return proxy_service; } diff --git a/chromium/net/proxy/proxy_service_v8.h b/chromium/net/proxy/proxy_service_v8.h index 88e7fcc0716..29195531b44 100644 --- a/chromium/net/proxy/proxy_service_v8.h +++ b/chromium/net/proxy/proxy_service_v8.h @@ -5,7 +5,6 @@ #ifndef NET_PROXY_PROXY_SERVICE_V8_H_ #define NET_PROXY_PROXY_SERVICE_V8_H_ -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "net/base/net_export.h" #include "net/proxy/dhcp_proxy_script_fetcher.h" |