From 0a110a44f91993c48c15e225d68f4a412777ec60 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 4 Apr 2017 13:26:50 +0900 Subject: [PATCH] ScopedPtrHashMap has been removed --- .../browser/inspectable_web_contents_impl.cc | 2 +- .../browser/inspectable_web_contents_impl.h | 2 +- .../net/devtools_network_controller.cc | 21 +++++++++---------- .../browser/net/devtools_network_controller.h | 11 +++++++--- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 4c52097427..0bf9b6732a 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -689,7 +689,7 @@ bool InspectableWebContentsImpl::ShouldCreateWebContents( int32_t route_id, int32_t main_frame_route_id, int32_t main_frame_widget_route_id, - WindowContainerType window_container_type, + content::mojom::WindowContainerType window_container_type, const std::string& frame_name, const GURL& target_url, const std::string& partition_id, diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index 2f000c2102..31ebd392b2 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -146,7 +146,7 @@ class InspectableWebContentsImpl : int32_t route_id, int32_t main_frame_route_id, int32_t main_frame_widget_route_id, - WindowContainerType window_container_type, + content::mojom::WindowContainerType window_container_type, const std::string& frame_name, const GURL& target_url, const std::string& partition_id, diff --git a/brightray/browser/net/devtools_network_controller.cc b/brightray/browser/net/devtools_network_controller.cc index 07b469b1f7..8bf411ac1a 100644 --- a/brightray/browser/net/devtools_network_controller.cc +++ b/brightray/browser/net/devtools_network_controller.cc @@ -27,29 +27,28 @@ void DevToolsNetworkController::SetNetworkState( std::unique_ptr conditions) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - DevToolsNetworkInterceptor* interceptor = interceptors_.get(client_id); - if (!interceptor) { + auto it = interceptors_.find(client_id); + if (it == interceptors_.end()) { if (!conditions) return; std::unique_ptr new_interceptor( new DevToolsNetworkInterceptor); new_interceptor->UpdateConditions(std::move(conditions)); - interceptors_.set(client_id, std::move(new_interceptor)); + interceptors_[client_id] = std::move(new_interceptor); } else { if (!conditions) { std::unique_ptr online_conditions( new DevToolsNetworkConditions(false)); - interceptor->UpdateConditions(std::move(online_conditions)); + it->second->UpdateConditions(std::move(online_conditions)); interceptors_.erase(client_id); } else { - interceptor->UpdateConditions(std::move(conditions)); + it->second->UpdateConditions(std::move(conditions)); } } bool has_offline_interceptors = false; - auto it = interceptors_.begin(); - for (; it != interceptors_.end(); ++it) { - if (it->second->IsOffline()) { + for (const auto& interceptor : interceptors_) { + if (interceptor.second->IsOffline()) { has_offline_interceptors = true; break; } @@ -70,11 +69,11 @@ DevToolsNetworkController::GetInterceptor(const std::string& client_id) { if (interceptors_.empty() || client_id.empty()) return nullptr; - DevToolsNetworkInterceptor* interceptor = interceptors_.get(client_id); - if (!interceptor) + auto it = interceptors_.find(client_id); + if (it == interceptors_.end()) return nullptr; - return interceptor; + return it->second.get(); } } // namespace brightray diff --git a/brightray/browser/net/devtools_network_controller.h b/brightray/browser/net/devtools_network_controller.h index 7e6c948b42..c36d888df1 100644 --- a/brightray/browser/net/devtools_network_controller.h +++ b/brightray/browser/net/devtools_network_controller.h @@ -5,8 +5,12 @@ #ifndef BROWSER_DEVTOOLS_NETWORK_CONTROLLER_H_ #define BROWSER_DEVTOOLS_NETWORK_CONTROLLER_H_ -#include "base/containers/scoped_ptr_hash_map.h" +#include +#include +#include + #include "base/macros.h" +#include "base/threading/thread_checker.h" namespace brightray { @@ -21,12 +25,13 @@ class DevToolsNetworkController { void SetNetworkState(const std::string& client_id, std::unique_ptr conditions); + DevToolsNetworkInterceptor* GetInterceptor(const std::string& client_id); private: using InterceptorMap = - base::ScopedPtrHashMap>; + std::unordered_map>; std::unique_ptr appcache_interceptor_; InterceptorMap interceptors_;