From 0cf7454d4ba359dbb57d0fd6d8ccc3ec4d2b4ab9 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Sun, 10 Jul 2016 13:12:33 +0200 Subject: [PATCH] Modernize to C++11 : use auto. --- brightray/browser/devtools_embedder_message_dispatcher.cc | 4 ++-- brightray/browser/devtools_file_system_indexer.cc | 2 +- brightray/browser/inspectable_web_contents_impl.cc | 6 +++--- brightray/browser/media/media_capture_devices_dispatcher.cc | 4 ++-- brightray/browser/net/devtools_network_controller.cc | 2 +- brightray/browser/net_log.cc | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/brightray/browser/devtools_embedder_message_dispatcher.cc b/brightray/browser/devtools_embedder_message_dispatcher.cc index f45d90d753..9df6a08b6d 100644 --- a/brightray/browser/devtools_embedder_message_dispatcher.cc +++ b/brightray/browser/devtools_embedder_message_dispatcher.cc @@ -121,7 +121,7 @@ class DispatcherImpl : public DevToolsEmbedderMessageDispatcher { bool Dispatch(const DispatchCallback& callback, const std::string& method, const base::ListValue* params) override { - HandlerMap::iterator it = handlers_.find(method); + auto it = handlers_.find(method); return it != handlers_.end() && it->second.Run(callback, *params); } @@ -156,7 +156,7 @@ class DispatcherImpl : public DevToolsEmbedderMessageDispatcher { DevToolsEmbedderMessageDispatcher* DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend( Delegate* delegate) { - DispatcherImpl* d = new DispatcherImpl(); + auto* d = new DispatcherImpl(); d->RegisterHandler("bringToFront", &Delegate::ActivateWindow, delegate); d->RegisterHandler("closeWindow", &Delegate::CloseWindow, delegate); diff --git a/brightray/browser/devtools_file_system_indexer.cc b/brightray/browser/devtools_file_system_indexer.cc index 788db1fa63..f9841441ad 100644 --- a/brightray/browser/devtools_file_system_indexer.cc +++ b/brightray/browser/devtools_file_system_indexer.cc @@ -160,7 +160,7 @@ void Index::SetTrigramsForFile(const FilePath& file_path, const Time& time) { DCHECK_CURRENTLY_ON(BrowserThread::FILE); FileId file_id = GetFileId(file_path); - vector::const_iterator it = index.begin(); + auto it = index.begin(); for (; it != index.end(); ++it) { Trigram trigram = *it; index_[trigram].push_back(file_id); diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 70119c1558..c6f6eb5b46 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -167,7 +167,7 @@ int ResponseWriter::Initialize(const net::CompletionCallback& callback) { int ResponseWriter::Write(net::IOBuffer* buffer, int num_bytes, const net::CompletionCallback& callback) { - base::FundamentalValue* id = new base::FundamentalValue(stream_id_); + auto* id = new base::FundamentalValue(stream_id_); base::StringValue* chunk = new base::StringValue(std::string(buffer->data(), num_bytes)); @@ -683,11 +683,11 @@ void InspectableWebContentsImpl::DidStartNavigationToPendingEntry( void InspectableWebContentsImpl::OnURLFetchComplete(const net::URLFetcher* source) { DCHECK(source); - PendingRequestsMap::iterator it = pending_requests_.find(source); + auto it = pending_requests_.find(source); DCHECK(it != pending_requests_.end()); base::DictionaryValue response; - base::DictionaryValue* headers = new base::DictionaryValue(); + auto* headers = new base::DictionaryValue(); net::HttpResponseHeaders* rh = source->GetResponseHeaders(); response.SetInteger("statusCode", rh ? rh->response_code() : 200); response.Set("headers", headers); diff --git a/brightray/browser/media/media_capture_devices_dispatcher.cc b/brightray/browser/media/media_capture_devices_dispatcher.cc index 535635159d..44b781fafa 100644 --- a/brightray/browser/media/media_capture_devices_dispatcher.cc +++ b/brightray/browser/media/media_capture_devices_dispatcher.cc @@ -20,7 +20,7 @@ namespace { const content::MediaStreamDevice* FindDeviceWithId( const content::MediaStreamDevices& devices, const std::string& device_id) { - content::MediaStreamDevices::const_iterator iter = devices.begin(); + auto iter = devices.begin(); for (; iter != devices.end(); ++iter) { if (iter->id == device_id) { return &(*iter); @@ -30,7 +30,7 @@ const content::MediaStreamDevice* FindDeviceWithId( } const MediaStreamDevices& EmptyDevices() { - static MediaStreamDevices* devices = new MediaStreamDevices; + static auto* devices = new MediaStreamDevices; return *devices; } diff --git a/brightray/browser/net/devtools_network_controller.cc b/brightray/browser/net/devtools_network_controller.cc index cb2f92ba22..cfa4e23471 100644 --- a/brightray/browser/net/devtools_network_controller.cc +++ b/brightray/browser/net/devtools_network_controller.cc @@ -47,7 +47,7 @@ void DevToolsNetworkController::SetNetworkState( } bool has_offline_interceptors = false; - InterceptorMap::iterator it = interceptors_.begin(); + auto it = interceptors_.begin(); for (; it != interceptors_.end(); ++it) { if (it->second->IsOffline()) { has_offline_interceptors = true; diff --git a/brightray/browser/net_log.cc b/brightray/browser/net_log.cc index 9876b49418..f141c7ef2e 100644 --- a/brightray/browser/net_log.cc +++ b/brightray/browser/net_log.cc @@ -18,7 +18,7 @@ std::unique_ptr GetConstants() { std::unique_ptr constants = net::GetNetConstants(); // Adding client information to constants dictionary. - base::DictionaryValue* client_info = new base::DictionaryValue(); + auto* client_info = new base::DictionaryValue(); client_info->SetString( "command_line", base::CommandLine::ForCurrentProcess()->GetCommandLineString());