client_id is accessed on different threads

This commit is contained in:
deepak1556 2016-04-19 10:01:38 +05:30
parent b8e04f4947
commit ddf962c6ea
2 changed files with 11 additions and 2 deletions

View file

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