OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/net_log/net_log_temp_file.h" | 5 #include "components/net_log/net_log_temp_file.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
9 #include "base/files/scoped_file.h" | 11 #include "base/files/scoped_file.h" |
10 #include "base/values.h" | 12 #include "base/values.h" |
11 #include "build/build_config.h" | 13 #include "build/build_config.h" |
12 #include "components/net_log/chrome_net_log.h" | 14 #include "components/net_log/chrome_net_log.h" |
13 #include "net/log/write_to_file_net_log_observer.h" | 15 #include "net/log/write_to_file_net_log_observer.h" |
14 | 16 |
15 namespace net_log { | 17 namespace net_log { |
16 | 18 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 if (!file) | 183 if (!file) |
182 return; | 184 return; |
183 | 185 |
184 log_type_ = log_type; | 186 log_type_ = log_type; |
185 state_ = STATE_LOGGING; | 187 state_ = STATE_LOGGING; |
186 | 188 |
187 scoped_ptr<base::Value> constants( | 189 scoped_ptr<base::Value> constants( |
188 ChromeNetLog::GetConstants(command_line_string_, channel_string_)); | 190 ChromeNetLog::GetConstants(command_line_string_, channel_string_)); |
189 write_to_file_observer_.reset(new net::WriteToFileNetLogObserver()); | 191 write_to_file_observer_.reset(new net::WriteToFileNetLogObserver()); |
190 write_to_file_observer_->set_capture_mode(GetCaptureModeForLogType(log_type)); | 192 write_to_file_observer_->set_capture_mode(GetCaptureModeForLogType(log_type)); |
191 write_to_file_observer_->StartObserving(chrome_net_log_, file.Pass(), | 193 write_to_file_observer_->StartObserving(chrome_net_log_, std::move(file), |
192 constants.get(), nullptr); | 194 constants.get(), nullptr); |
193 } | 195 } |
194 | 196 |
195 void NetLogTempFile::StopNetLog() { | 197 void NetLogTempFile::StopNetLog() { |
196 DCHECK(thread_checker_.CalledOnValidThread()); | 198 DCHECK(thread_checker_.CalledOnValidThread()); |
197 if (state_ != STATE_LOGGING) | 199 if (state_ != STATE_LOGGING) |
198 return; | 200 return; |
199 | 201 |
200 write_to_file_observer_->StopObserving(nullptr); | 202 write_to_file_observer_->StopObserving(nullptr); |
201 write_to_file_observer_.reset(); | 203 write_to_file_observer_.reset(); |
(...skipping 19 matching lines...) Expand all Loading... |
221 return true; | 223 return true; |
222 } | 224 } |
223 | 225 |
224 bool NetLogTempFile::NetExportLogExists() const { | 226 bool NetLogTempFile::NetExportLogExists() const { |
225 DCHECK(thread_checker_.CalledOnValidThread()); | 227 DCHECK(thread_checker_.CalledOnValidThread()); |
226 DCHECK(!log_path_.empty()); | 228 DCHECK(!log_path_.empty()); |
227 return base::PathExists(log_path_); | 229 return base::PathExists(log_path_); |
228 } | 230 } |
229 | 231 |
230 } // namespace net_log | 232 } // namespace net_log |
OLD | NEW |