| 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/chromeos/boot_times_loader.h" | 5 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 BootTimesLoader* BootTimesLoader::Get() { | 122 BootTimesLoader* BootTimesLoader::Get() { |
| 123 return g_boot_times_loader.Pointer(); | 123 return g_boot_times_loader.Pointer(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Appends the given buffer into the file. Returns the number of bytes | 126 // Appends the given buffer into the file. Returns the number of bytes |
| 127 // written, or -1 on error. | 127 // written, or -1 on error. |
| 128 // TODO(satorux): Move this to file_util. | 128 // TODO(satorux): Move this to file_util. |
| 129 static int AppendFile(const base::FilePath& file_path, | 129 static int AppendFile(const base::FilePath& file_path, |
| 130 const char* data, | 130 const char* data, |
| 131 int size) { | 131 int size) { |
| 132 FILE* file = file_util::OpenFile(file_path, "a"); | 132 FILE* file = base::OpenFile(file_path, "a"); |
| 133 if (!file) { | 133 if (!file) { |
| 134 return -1; | 134 return -1; |
| 135 } | 135 } |
| 136 const int num_bytes_written = fwrite(data, 1, size, file); | 136 const int num_bytes_written = fwrite(data, 1, size, file); |
| 137 file_util::CloseFile(file); | 137 base::CloseFile(file); |
| 138 return num_bytes_written; | 138 return num_bytes_written; |
| 139 } | 139 } |
| 140 | 140 |
| 141 static void RecordStatsDelayed(const base::FilePath::StringType& name, | 141 static void RecordStatsDelayed(const base::FilePath::StringType& name, |
| 142 const std::string& uptime, | 142 const std::string& uptime, |
| 143 const std::string& disk) { | 143 const std::string& disk) { |
| 144 const base::FilePath log_path(kLogPath); | 144 const base::FilePath log_path(kLogPath); |
| 145 const base::FilePath uptime_output = | 145 const base::FilePath uptime_output = |
| 146 log_path.Append(base::FilePath(kUptimePrefix + name)); | 146 log_path.Append(base::FilePath(kUptimePrefix + name)); |
| 147 const base::FilePath disk_output = | 147 const base::FilePath disk_output = |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 GetRenderWidgetHost(&web_contents->GetController()); | 378 GetRenderWidgetHost(&web_contents->GetController()); |
| 379 render_widget_hosts_loading_.erase(render_widget_host); | 379 render_widget_hosts_loading_.erase(render_widget_host); |
| 380 break; | 380 break; |
| 381 } | 381 } |
| 382 default: | 382 default: |
| 383 break; | 383 break; |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 | 386 |
| 387 } // namespace chromeos | 387 } // namespace chromeos |
| OLD | NEW |