| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "content/shell/browser/shell_net_log.h" | 5 #include "content/shell/browser/shell_net_log.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 11 #include "base/files/scoped_file.h" | 12 #include "base/files/scoped_file.h" |
| 12 #include "base/values.h" | 13 #include "base/values.h" |
| 13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 14 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
| 15 #include "net/log/net_log_util.h" | 16 #include "net/log/net_log_util.h" |
| 16 #include "net/log/write_to_file_net_log_observer.h" | 17 #include "net/log/write_to_file_net_log_observer.h" |
| 17 | 18 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #elif defined(OS_POSIX) | 59 #elif defined(OS_POSIX) |
| 59 file.reset(fopen(log_path.value().c_str(), "w")); | 60 file.reset(fopen(log_path.value().c_str(), "w")); |
| 60 #endif | 61 #endif |
| 61 | 62 |
| 62 if (!file) { | 63 if (!file) { |
| 63 LOG(ERROR) << "Could not open file " << log_path.value() | 64 LOG(ERROR) << "Could not open file " << log_path.value() |
| 64 << " for net logging"; | 65 << " for net logging"; |
| 65 } else { | 66 } else { |
| 66 scoped_ptr<base::Value> constants(GetShellConstants(app_name)); | 67 scoped_ptr<base::Value> constants(GetShellConstants(app_name)); |
| 67 write_to_file_observer_.reset(new net::WriteToFileNetLogObserver()); | 68 write_to_file_observer_.reset(new net::WriteToFileNetLogObserver()); |
| 68 write_to_file_observer_->StartObserving(this, file.Pass(), | 69 write_to_file_observer_->StartObserving(this, std::move(file), |
| 69 constants.get(), nullptr); | 70 constants.get(), nullptr); |
| 70 } | 71 } |
| 71 } | 72 } |
| 72 } | 73 } |
| 73 | 74 |
| 74 ShellNetLog::~ShellNetLog() { | 75 ShellNetLog::~ShellNetLog() { |
| 75 // Remove the observer we own before we're destroyed. | 76 // Remove the observer we own before we're destroyed. |
| 76 if (write_to_file_observer_) | 77 if (write_to_file_observer_) |
| 77 write_to_file_observer_->StopObserving(nullptr); | 78 write_to_file_observer_->StopObserving(nullptr); |
| 78 } | 79 } |
| 79 | 80 |
| 80 } // namespace content | 81 } // namespace content |
| OLD | NEW |