| 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 "mojo/common/data_pipe_utils.h" | 5 #include "mojo/common/data_pipe_utils.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/files/scoped_file.h" | 11 #include "base/files/scoped_file.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/task_runner_util.h" | 13 #include "base/task_runner_util.h" |
| 14 #include "mojo/common/handle_watcher.h" | |
| 15 | 14 |
| 16 namespace mojo { | 15 namespace mojo { |
| 17 namespace common { | 16 namespace common { |
| 18 | 17 |
| 19 bool BlockingCopyToFile(ScopedDataPipeConsumerHandle source, | 18 bool BlockingCopyToFile(ScopedDataPipeConsumerHandle source, |
| 20 const base::FilePath& destination) { | 19 const base::FilePath& destination) { |
| 21 base::ScopedFILE fp(base::OpenFile(destination, "wb")); | 20 base::ScopedFILE fp(base::OpenFile(destination, "wb")); |
| 22 if (!fp) | 21 if (!fp) |
| 23 return false; | 22 return false; |
| 24 | 23 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 const base::Callback<void(bool)>& callback) { | 62 const base::Callback<void(bool)>& callback) { |
| 64 base::PostTaskAndReplyWithResult( | 63 base::PostTaskAndReplyWithResult( |
| 65 task_runner, | 64 task_runner, |
| 66 FROM_HERE, | 65 FROM_HERE, |
| 67 base::Bind(&BlockingCopyToFile, base::Passed(&source), destination), | 66 base::Bind(&BlockingCopyToFile, base::Passed(&source), destination), |
| 68 callback); | 67 callback); |
| 69 } | 68 } |
| 70 | 69 |
| 71 } // namespace common | 70 } // namespace common |
| 72 } // namespace mojo | 71 } // namespace mojo |
| OLD | NEW |