REVIEW: create AtomNetworkDelegate on the IO thread

This commit is contained in:
deepak1556 2017-12-15 23:02:33 +05:30 committed by Cheng Zhao
parent b2cef31bc0
commit ebb0e46380
10 changed files with 53 additions and 34 deletions

View file

@ -247,7 +247,6 @@ void AtomNetworkDelegate::SetResponseListenerInIO(
void AtomNetworkDelegate::SetDevToolsNetworkEmulationClientId(
const std::string& client_id) {
base::AutoLock auto_lock(lock_);
client_id_ = client_id;
}
@ -266,16 +265,10 @@ int AtomNetworkDelegate::OnBeforeStartTransaction(
net::URLRequest* request,
const net::CompletionCallback& callback,
net::HttpRequestHeaders* headers) {
std::string client_id;
{
base::AutoLock auto_lock(lock_);
client_id = client_id_;
}
if (!client_id.empty())
if (!client_id_.empty())
headers->SetHeader(
DevToolsNetworkTransaction::kDevToolsEmulateNetworkConditionsClientId,
client_id);
client_id_);
if (!base::ContainsKey(response_listeners_, kOnBeforeSendHeaders))
return brightray::NetworkDelegate::OnBeforeStartTransaction(
request, callback, headers);

View file

@ -118,8 +118,6 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate {
std::map<ResponseEvent, ResponseListenerInfo> response_listeners_;
std::map<uint64_t, net::CompletionCallback> callbacks_;
base::Lock lock_;
// Client id for devtools network emulation.
std::string client_id_;