| 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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 MOJO_DEADLINE_INDEFINITE); | 93 MOJO_DEADLINE_INDEFINITE); |
| 94 if (result != MOJO_RESULT_OK) { | 94 if (result != MOJO_RESULT_OK) { |
| 95 // If the consumer handle was closed, then treat as EOF. | 95 // If the consumer handle was closed, then treat as EOF. |
| 96 return result == MOJO_RESULT_FAILED_PRECONDITION; | 96 return result == MOJO_RESULT_FAILED_PRECONDITION; |
| 97 } | 97 } |
| 98 } else { | 98 } else { |
| 99 // If the consumer handle was closed, then treat as EOF. | 99 // If the consumer handle was closed, then treat as EOF. |
| 100 return result == MOJO_RESULT_FAILED_PRECONDITION; | 100 return result == MOJO_RESULT_FAILED_PRECONDITION; |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 #if !defined(OS_WIN) |
| 103 NOTREACHED(); | 104 NOTREACHED(); |
| 104 return false; | 105 return false; |
| 106 #endif |
| 105 } | 107 } |
| 106 | 108 |
| 107 } // namespace | 109 } // namespace |
| 108 | 110 |
| 109 // TODO(hansmuller): Add a max_size parameter. | 111 // TODO(hansmuller): Add a max_size parameter. |
| 110 bool BlockingCopyToString(ScopedDataPipeConsumerHandle source, | 112 bool BlockingCopyToString(ScopedDataPipeConsumerHandle source, |
| 111 std::string* result) { | 113 std::string* result) { |
| 112 CHECK(result); | 114 CHECK(result); |
| 113 result->clear(); | 115 result->clear(); |
| 114 return BlockingCopyHelper( | 116 return BlockingCopyHelper( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 141 base::TaskRunner* task_runner, | 143 base::TaskRunner* task_runner, |
| 142 const base::Callback<void(bool)>& callback) { | 144 const base::Callback<void(bool)>& callback) { |
| 143 base::PostTaskAndReplyWithResult(task_runner, FROM_HERE, | 145 base::PostTaskAndReplyWithResult(task_runner, FROM_HERE, |
| 144 base::Bind(&BlockingCopyFromFile, source, | 146 base::Bind(&BlockingCopyFromFile, source, |
| 145 base::Passed(&destination), skip), | 147 base::Passed(&destination), skip), |
| 146 callback); | 148 callback); |
| 147 } | 149 } |
| 148 | 150 |
| 149 } // namespace common | 151 } // namespace common |
| 150 } // namespace mojo | 152 } // namespace mojo |
| OLD | NEW |