| 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 <string.h> |
| 8 |
| 7 #include "base/location.h" | 9 #include "base/location.h" |
| 8 #include "base/memory/aligned_memory.h" | 10 #include "base/memory/aligned_memory.h" |
| 9 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 13 #include "build/build_config.h" |
| 11 #include "chrome/utility/image_writer/error_messages.h" | 14 #include "chrome/utility/image_writer/error_messages.h" |
| 12 #include "chrome/utility/image_writer/image_writer_handler.h" | 15 #include "chrome/utility/image_writer/image_writer_handler.h" |
| 13 #include "content/public/utility/utility_thread.h" | 16 #include "content/public/utility/utility_thread.h" |
| 14 | 17 |
| 15 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
| 16 #include "chrome/utility/image_writer/disk_unmounter_mac.h" | 19 #include "chrome/utility/image_writer/disk_unmounter_mac.h" |
| 17 #endif | 20 #endif |
| 18 | 21 |
| 19 namespace image_writer { | 22 namespace image_writer { |
| 20 | 23 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 bool ImageWriter::IsRunning() const { return running_; } | 71 bool ImageWriter::IsRunning() const { return running_; } |
| 69 | 72 |
| 70 const base::FilePath& ImageWriter::GetImagePath() { return image_path_; } | 73 const base::FilePath& ImageWriter::GetImagePath() { return image_path_; } |
| 71 | 74 |
| 72 const base::FilePath& ImageWriter::GetDevicePath() { return device_path_; } | 75 const base::FilePath& ImageWriter::GetDevicePath() { return device_path_; } |
| 73 | 76 |
| 74 void ImageWriter::PostTask(const base::Closure& task) { | 77 void ImageWriter::PostTask(const base::Closure& task) { |
| 75 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); | 78 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
| 76 } | 79 } |
| 77 | 80 |
| 78 void ImageWriter::PostProgress(int64 progress) { | 81 void ImageWriter::PostProgress(int64_t progress) { |
| 79 handler_->SendProgress(progress); | 82 handler_->SendProgress(progress); |
| 80 } | 83 } |
| 81 | 84 |
| 82 void ImageWriter::Error(const std::string& message) { | 85 void ImageWriter::Error(const std::string& message) { |
| 83 running_ = false; | 86 running_ = false; |
| 84 handler_->SendFailed(message); | 87 handler_->SendFailed(message); |
| 85 } | 88 } |
| 86 | 89 |
| 87 bool ImageWriter::InitializeFiles() { | 90 bool ImageWriter::InitializeFiles() { |
| 88 if (!image_file_.IsValid()) { | 91 if (!image_file_.IsValid()) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 running_ = false; | 195 running_ = false; |
| 193 } else { | 196 } else { |
| 194 // Unable to read entire file. | 197 // Unable to read entire file. |
| 195 LOG(ERROR) << "Failed to read " << kBurningBlockSize << " bytes of image " | 198 LOG(ERROR) << "Failed to read " << kBurningBlockSize << " bytes of image " |
| 196 << "at offset " << bytes_processed_; | 199 << "at offset " << bytes_processed_; |
| 197 Error(error::kReadImage); | 200 Error(error::kReadImage); |
| 198 } | 201 } |
| 199 } | 202 } |
| 200 | 203 |
| 201 } // namespace image_writer | 204 } // namespace image_writer |
| OLD | NEW |