зеркало из https://github.com/electron/electron.git
ScopedPtrHashMap has been removed
This commit is contained in:
Родитель
fdb880eca2
Коммит
0a110a44f9
|
@ -689,7 +689,7 @@ bool InspectableWebContentsImpl::ShouldCreateWebContents(
|
||||||
int32_t route_id,
|
int32_t route_id,
|
||||||
int32_t main_frame_route_id,
|
int32_t main_frame_route_id,
|
||||||
int32_t main_frame_widget_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 std::string& frame_name,
|
||||||
const GURL& target_url,
|
const GURL& target_url,
|
||||||
const std::string& partition_id,
|
const std::string& partition_id,
|
||||||
|
|
|
@ -146,7 +146,7 @@ class InspectableWebContentsImpl :
|
||||||
int32_t route_id,
|
int32_t route_id,
|
||||||
int32_t main_frame_route_id,
|
int32_t main_frame_route_id,
|
||||||
int32_t main_frame_widget_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 std::string& frame_name,
|
||||||
const GURL& target_url,
|
const GURL& target_url,
|
||||||
const std::string& partition_id,
|
const std::string& partition_id,
|
||||||
|
|
|
@ -27,29 +27,28 @@ void DevToolsNetworkController::SetNetworkState(
|
||||||
std::unique_ptr<DevToolsNetworkConditions> conditions) {
|
std::unique_ptr<DevToolsNetworkConditions> conditions) {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||||
|
|
||||||
DevToolsNetworkInterceptor* interceptor = interceptors_.get(client_id);
|
auto it = interceptors_.find(client_id);
|
||||||
if (!interceptor) {
|
if (it == interceptors_.end()) {
|
||||||
if (!conditions)
|
if (!conditions)
|
||||||
return;
|
return;
|
||||||
std::unique_ptr<DevToolsNetworkInterceptor> new_interceptor(
|
std::unique_ptr<DevToolsNetworkInterceptor> new_interceptor(
|
||||||
new DevToolsNetworkInterceptor);
|
new DevToolsNetworkInterceptor);
|
||||||
new_interceptor->UpdateConditions(std::move(conditions));
|
new_interceptor->UpdateConditions(std::move(conditions));
|
||||||
interceptors_.set(client_id, std::move(new_interceptor));
|
interceptors_[client_id] = std::move(new_interceptor);
|
||||||
} else {
|
} else {
|
||||||
if (!conditions) {
|
if (!conditions) {
|
||||||
std::unique_ptr<DevToolsNetworkConditions> online_conditions(
|
std::unique_ptr<DevToolsNetworkConditions> online_conditions(
|
||||||
new DevToolsNetworkConditions(false));
|
new DevToolsNetworkConditions(false));
|
||||||
interceptor->UpdateConditions(std::move(online_conditions));
|
it->second->UpdateConditions(std::move(online_conditions));
|
||||||
interceptors_.erase(client_id);
|
interceptors_.erase(client_id);
|
||||||
} else {
|
} else {
|
||||||
interceptor->UpdateConditions(std::move(conditions));
|
it->second->UpdateConditions(std::move(conditions));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_offline_interceptors = false;
|
bool has_offline_interceptors = false;
|
||||||
auto it = interceptors_.begin();
|
for (const auto& interceptor : interceptors_) {
|
||||||
for (; it != interceptors_.end(); ++it) {
|
if (interceptor.second->IsOffline()) {
|
||||||
if (it->second->IsOffline()) {
|
|
||||||
has_offline_interceptors = true;
|
has_offline_interceptors = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -70,11 +69,11 @@ DevToolsNetworkController::GetInterceptor(const std::string& client_id) {
|
||||||
if (interceptors_.empty() || client_id.empty())
|
if (interceptors_.empty() || client_id.empty())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
DevToolsNetworkInterceptor* interceptor = interceptors_.get(client_id);
|
auto it = interceptors_.find(client_id);
|
||||||
if (!interceptor)
|
if (it == interceptors_.end())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return interceptor;
|
return it->second.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace brightray
|
} // namespace brightray
|
||||||
|
|
|
@ -5,8 +5,12 @@
|
||||||
#ifndef BROWSER_DEVTOOLS_NETWORK_CONTROLLER_H_
|
#ifndef BROWSER_DEVTOOLS_NETWORK_CONTROLLER_H_
|
||||||
#define 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/macros.h"
|
||||||
|
#include "base/threading/thread_checker.h"
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
|
@ -21,12 +25,13 @@ class DevToolsNetworkController {
|
||||||
|
|
||||||
void SetNetworkState(const std::string& client_id,
|
void SetNetworkState(const std::string& client_id,
|
||||||
std::unique_ptr<DevToolsNetworkConditions> conditions);
|
std::unique_ptr<DevToolsNetworkConditions> conditions);
|
||||||
|
|
||||||
DevToolsNetworkInterceptor* GetInterceptor(const std::string& client_id);
|
DevToolsNetworkInterceptor* GetInterceptor(const std::string& client_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using InterceptorMap =
|
using InterceptorMap =
|
||||||
base::ScopedPtrHashMap<std::string,
|
std::unordered_map<std::string,
|
||||||
std::unique_ptr<DevToolsNetworkInterceptor>>;
|
std::unique_ptr<DevToolsNetworkInterceptor>>;
|
||||||
|
|
||||||
std::unique_ptr<DevToolsNetworkInterceptor> appcache_interceptor_;
|
std::unique_ptr<DevToolsNetworkInterceptor> appcache_interceptor_;
|
||||||
InterceptorMap interceptors_;
|
InterceptorMap interceptors_;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче