OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/net/chrome_net_log.h" | 5 #include "chrome/browser/net/chrome_net_log.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/net/net_log_temp_file.h" | 14 #include "chrome/browser/net/net_log_temp_file.h" |
15 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" | 15 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
18 #include "net/base/net_log_logger.h" | 18 #include "net/base/net_log_logger.h" |
19 #include "net/base/trace_net_log_observer.h" | 19 #include "net/base/trace_net_log_observer.h" |
20 | 20 |
21 ChromeNetLog::ChromeNetLog() | 21 ChromeNetLog::ChromeNetLog() |
22 : net_log_temp_file_(new NetLogTempFile(this)) { | 22 : net_log_temp_file_(new NetLogTempFile(this)) { |
23 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 23 const base::CommandLine* command_line = |
| 24 base::CommandLine::ForCurrentProcess(); |
24 | 25 |
25 if (command_line->HasSwitch(switches::kLogNetLog)) { | 26 if (command_line->HasSwitch(switches::kLogNetLog)) { |
26 base::FilePath log_path = | 27 base::FilePath log_path = |
27 command_line->GetSwitchValuePath(switches::kLogNetLog); | 28 command_line->GetSwitchValuePath(switches::kLogNetLog); |
28 // Much like logging.h, bypass threading restrictions by using fopen | 29 // Much like logging.h, bypass threading restrictions by using fopen |
29 // directly. Have to write on a thread that's shutdown to handle events on | 30 // directly. Have to write on a thread that's shutdown to handle events on |
30 // shutdown properly, and posting events to another thread as they occur | 31 // shutdown properly, and posting events to another thread as they occur |
31 // would result in an unbounded buffer size, so not much can be gained by | 32 // would result in an unbounded buffer size, so not much can be gained by |
32 // doing this on another thread. It's only used when debugging Chrome, so | 33 // doing this on another thread. It's only used when debugging Chrome, so |
33 // performance is not a big concern. | 34 // performance is not a big concern. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 66 |
66 ChromeNetLog::~ChromeNetLog() { | 67 ChromeNetLog::~ChromeNetLog() { |
67 net_log_temp_file_.reset(); | 68 net_log_temp_file_.reset(); |
68 // Remove the observers we own before we're destroyed. | 69 // Remove the observers we own before we're destroyed. |
69 if (net_log_logger_) | 70 if (net_log_logger_) |
70 RemoveThreadSafeObserver(net_log_logger_.get()); | 71 RemoveThreadSafeObserver(net_log_logger_.get()); |
71 if (trace_net_log_observer_) | 72 if (trace_net_log_observer_) |
72 trace_net_log_observer_->StopWatchForTraceStart(); | 73 trace_net_log_observer_->StopWatchForTraceStart(); |
73 } | 74 } |
74 | 75 |
OLD | NEW |