| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/cronet/ios/cronet_environment.h" | 5 #include "components/cronet/ios/cronet_environment.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 : net::NetLogCaptureMode::Default(); | 162 : net::NetLogCaptureMode::Default(); |
| 163 | 163 |
| 164 net_log_observer_.reset(new net::WriteToFileNetLogObserver()); | 164 net_log_observer_.reset(new net::WriteToFileNetLogObserver()); |
| 165 net_log_observer_->set_capture_mode(capture_mode); | 165 net_log_observer_->set_capture_mode(capture_mode); |
| 166 net_log_observer_->StartObserving(main_context_->net_log(), std::move(file), | 166 net_log_observer_->StartObserving(main_context_->net_log(), std::move(file), |
| 167 nullptr, main_context_.get()); | 167 nullptr, main_context_.get()); |
| 168 LOG(WARNING) << "Started NetLog to " << full_path.value(); | 168 LOG(WARNING) << "Started NetLog to " << full_path.value(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void CronetEnvironment::StopNetLog() { | 171 void CronetEnvironment::StopNetLog() { |
| 172 base::WaitableEvent log_stopped_event(true, false); | 172 base::WaitableEvent log_stopped_event( |
| 173 base::WaitableEvent::ResetPolicy::MANUAL, |
| 174 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 173 PostToNetworkThread(FROM_HERE, | 175 PostToNetworkThread(FROM_HERE, |
| 174 base::Bind(&CronetEnvironment::StopNetLogOnNetworkThread, | 176 base::Bind(&CronetEnvironment::StopNetLogOnNetworkThread, |
| 175 base::Unretained(this), &log_stopped_event)); | 177 base::Unretained(this), &log_stopped_event)); |
| 176 log_stopped_event.Wait(); | 178 log_stopped_event.Wait(); |
| 177 } | 179 } |
| 178 | 180 |
| 179 void CronetEnvironment::StopNetLogOnNetworkThread( | 181 void CronetEnvironment::StopNetLogOnNetworkThread( |
| 180 base::WaitableEvent* log_stopped_event) { | 182 base::WaitableEvent* log_stopped_event) { |
| 181 if (net_log_observer_) { | 183 if (net_log_observer_) { |
| 182 DLOG(WARNING) << "Stopped NetLog."; | 184 DLOG(WARNING) << "Stopped NetLog."; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 const net::HttpUserAgentSettings* user_agent_settings = | 365 const net::HttpUserAgentSettings* user_agent_settings = |
| 364 main_context_->http_user_agent_settings(); | 366 main_context_->http_user_agent_settings(); |
| 365 if (!user_agent_settings) { | 367 if (!user_agent_settings) { |
| 366 return nullptr; | 368 return nullptr; |
| 367 } | 369 } |
| 368 | 370 |
| 369 return user_agent_settings->GetUserAgent(); | 371 return user_agent_settings->GetUserAgent(); |
| 370 } | 372 } |
| 371 | 373 |
| 372 } // namespace cronet | 374 } // namespace cronet |
| OLD | NEW |