Browse Source

Modernize to C++11 : use auto.

Haojian Wu 8 years ago
parent
commit
0cf7454d4b

+ 2 - 2
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);

+ 1 - 1
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<Trigram>::const_iterator it = index.begin();
+  auto it = index.begin();
   for (; it != index.end(); ++it) {
     Trigram trigram = *it;
     index_[trigram].push_back(file_id);

+ 3 - 3
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);

+ 2 - 2
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;
 }
 

+ 1 - 1
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;

+ 1 - 1
brightray/browser/net_log.cc

@@ -18,7 +18,7 @@ std::unique_ptr<base::DictionaryValue> GetConstants() {
   std::unique_ptr<base::DictionaryValue> 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());