| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/utility/image_writer/image_writer.h" | 5 #include "chrome/utility/image_writer/image_writer.h" |
| 6 | 6 |
| 7 #include "base/location.h" |
| 7 #include "base/memory/aligned_memory.h" | 8 #include "base/memory/aligned_memory.h" |
| 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" |
| 8 #include "chrome/utility/image_writer/error_messages.h" | 11 #include "chrome/utility/image_writer/error_messages.h" |
| 9 #include "chrome/utility/image_writer/image_writer_handler.h" | 12 #include "chrome/utility/image_writer/image_writer_handler.h" |
| 10 #include "content/public/utility/utility_thread.h" | 13 #include "content/public/utility/utility_thread.h" |
| 11 | 14 |
| 12 #if defined(OS_MACOSX) | 15 #if defined(OS_MACOSX) |
| 13 #include "chrome/utility/image_writer/disk_unmounter_mac.h" | 16 #include "chrome/utility/image_writer/disk_unmounter_mac.h" |
| 14 #endif | 17 #endif |
| 15 | 18 |
| 16 namespace image_writer { | 19 namespace image_writer { |
| 17 | 20 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 handler_->SendCancelled(); | 65 handler_->SendCancelled(); |
| 63 } | 66 } |
| 64 | 67 |
| 65 bool ImageWriter::IsRunning() const { return running_; } | 68 bool ImageWriter::IsRunning() const { return running_; } |
| 66 | 69 |
| 67 const base::FilePath& ImageWriter::GetImagePath() { return image_path_; } | 70 const base::FilePath& ImageWriter::GetImagePath() { return image_path_; } |
| 68 | 71 |
| 69 const base::FilePath& ImageWriter::GetDevicePath() { return device_path_; } | 72 const base::FilePath& ImageWriter::GetDevicePath() { return device_path_; } |
| 70 | 73 |
| 71 void ImageWriter::PostTask(const base::Closure& task) { | 74 void ImageWriter::PostTask(const base::Closure& task) { |
| 72 base::MessageLoop::current()->PostTask(FROM_HERE, task); | 75 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
| 73 } | 76 } |
| 74 | 77 |
| 75 void ImageWriter::PostProgress(int64 progress) { | 78 void ImageWriter::PostProgress(int64 progress) { |
| 76 handler_->SendProgress(progress); | 79 handler_->SendProgress(progress); |
| 77 } | 80 } |
| 78 | 81 |
| 79 void ImageWriter::Error(const std::string& message) { | 82 void ImageWriter::Error(const std::string& message) { |
| 80 running_ = false; | 83 running_ = false; |
| 81 handler_->SendFailed(message); | 84 handler_->SendFailed(message); |
| 82 } | 85 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 running_ = false; | 192 running_ = false; |
| 190 } else { | 193 } else { |
| 191 // Unable to read entire file. | 194 // Unable to read entire file. |
| 192 LOG(ERROR) << "Failed to read " << kBurningBlockSize << " bytes of image " | 195 LOG(ERROR) << "Failed to read " << kBurningBlockSize << " bytes of image " |
| 193 << "at offset " << bytes_processed_; | 196 << "at offset " << bytes_processed_; |
| 194 Error(error::kReadImage); | 197 Error(error::kReadImage); |
| 195 } | 198 } |
| 196 } | 199 } |
| 197 | 200 |
| 198 } // namespace image_writer | 201 } // namespace image_writer |
| OLD | NEW |