ScopedPtrHashMap has been removed

This commit is contained in:
Cheng Zhao 2017-04-04 13:26:50 +09:00
Родитель fdb880eca2
Коммит 0a110a44f9
4 изменённых файлов: 20 добавлений и 16 удалений

Просмотреть файл

@ -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,

Просмотреть файл

@ -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,

Просмотреть файл

@ -27,29 +27,28 @@ void DevToolsNetworkController::SetNetworkState(
std::unique_ptr<DevToolsNetworkConditions> 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<DevToolsNetworkInterceptor> 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<DevToolsNetworkConditions> 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

Просмотреть файл

@ -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 <unordered_map>
#include <memory>
#include <string>
#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<DevToolsNetworkConditions> conditions);
DevToolsNetworkInterceptor* GetInterceptor(const std::string& client_id);
private:
using InterceptorMap =
base::ScopedPtrHashMap<std::string,
std::unique_ptr<DevToolsNetworkInterceptor>>;
std::unordered_map<std::string,
std::unique_ptr<DevToolsNetworkInterceptor>>;
std::unique_ptr<DevToolsNetworkInterceptor> appcache_interceptor_;
InterceptorMap interceptors_;