| 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/page_cycler/page_cycler.h" | 5 #include "chrome/browser/page_cycler/page_cycler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } else { | 215 } else { |
| 216 file_util::WriteFile(stats_file_, output.c_str(), output.size()); | 216 file_util::WriteFile(stats_file_, output.c_str(), output.size()); |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 if (!errors_file_.empty()) { | 219 if (!errors_file_.empty()) { |
| 220 if (!error_.empty()) { | 220 if (!error_.empty()) { |
| 221 file_util::WriteFile(errors_file_, UTF16ToUTF8(error_).c_str(), | 221 file_util::WriteFile(errors_file_, UTF16ToUTF8(error_).c_str(), |
| 222 error_.size()); | 222 error_.size()); |
| 223 } else if (base::PathExists(errors_file_)) { | 223 } else if (base::PathExists(errors_file_)) { |
| 224 // If there is an old error file, delete it to avoid confusion. | 224 // If there is an old error file, delete it to avoid confusion. |
| 225 base::Delete(errors_file_, false); | 225 base::DeleteFile(errors_file_, false); |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 if (aborted_) { | 228 if (aborted_) { |
| 229 content::BrowserThread::PostTask(content::BrowserThread::UI, | 229 content::BrowserThread::PostTask(content::BrowserThread::UI, |
| 230 FROM_HERE, | 230 FROM_HERE, |
| 231 base::Bind(&PageCycler::Abort, this)); | 231 base::Bind(&PageCycler::Abort, this)); |
| 232 } else { | 232 } else { |
| 233 content::BrowserThread::PostTask(content::BrowserThread::UI, | 233 content::BrowserThread::PostTask(content::BrowserThread::UI, |
| 234 FROM_HERE, | 234 FROM_HERE, |
| 235 base::Bind(&PageCycler::Finish, this)); | 235 base::Bind(&PageCycler::Finish, this)); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 259 aborted_ = true; | 259 aborted_ = true; |
| 260 error_.append(ASCIIToUTF16( | 260 error_.append(ASCIIToUTF16( |
| 261 "Browser was closed before the run was completed.")); | 261 "Browser was closed before the run was completed.")); |
| 262 DLOG(WARNING) << | 262 DLOG(WARNING) << |
| 263 "Page Cycler: browser was closed before the run was completed."; | 263 "Page Cycler: browser was closed before the run was completed."; |
| 264 content::BrowserThread::PostBlockingPoolTask( | 264 content::BrowserThread::PostBlockingPoolTask( |
| 265 FROM_HERE, | 265 FROM_HERE, |
| 266 base::Bind(&PageCycler::PrepareResultsOnBackgroundThread, this)); | 266 base::Bind(&PageCycler::PrepareResultsOnBackgroundThread, this)); |
| 267 } | 267 } |
| 268 } | 268 } |
| OLD | NEW |