Chromium Code Reviews| Index: mojo/common/data_pipe_utils.cc |
| diff --git a/mojo/common/data_pipe_utils.cc b/mojo/common/data_pipe_utils.cc |
| index fd2b7b7492e63c88f46447136ec5541fb8b8e641..8738d5cb6012bcb0ceaac020227b9ecffd485e6c 100644 |
| --- a/mojo/common/data_pipe_utils.cc |
| +++ b/mojo/common/data_pipe_utils.cc |
| @@ -29,14 +29,15 @@ bool BlockingCopyHelper(ScopedDataPipeConsumerHandle source, |
| if (bytes_written < num_bytes) { |
| LOG(ERROR) << "write_bytes callback wrote fewer bytes (" |
| << bytes_written << ") written than expected (" << num_bytes |
| - << ") in BlockingCopyHelper " |
| - << "(pipe closed? out of disk space?)" << std::endl; |
| + << ") in BlockingCopyHelper (pipe closed? out of disk " |
| + "space?)"; |
| + // No need to call EndReadDataRaw(), since |source| will be closed. |
| return false; |
| } |
| result = EndReadDataRaw(source.get(), num_bytes); |
| if (result != MOJO_RESULT_OK) { |
| LOG(ERROR) << "EndReadDataRaw error (" << result |
| - << ") in BlockingCopyHelper" << std::endl; |
| + << ") in BlockingCopyHelper"; |
| return false; |
| } |
| } else if (result == MOJO_RESULT_SHOULD_WAIT) { |
| @@ -52,14 +53,11 @@ bool BlockingCopyHelper(ScopedDataPipeConsumerHandle source, |
| // If the producer handle was closed, then treat as EOF. |
| return true; |
| } else { |
| - LOG(ERROR) << "Unhandled error " << result << " in BlockingCopyHelper" |
| - << std::endl; |
| + LOG(ERROR) << "Unhandled error " << result << " in BlockingCopyHelper"; |
| // Some other error occurred. |
| - break; |
| + return false; |
| } |
| } |
| - |
| - return false; |
| } |
| size_t CopyToStringHelper( |
| @@ -78,9 +76,8 @@ bool BlockingCopyFromFile(const base::FilePath& source, |
| base::File file(source, base::File::FLAG_OPEN | base::File::FLAG_READ); |
| if (!file.IsValid()) |
| return false; |
| - if (file.Seek(base::File::FROM_BEGIN, skip) != skip) { |
| + if (file.Seek(base::File::FROM_BEGIN, skip) != skip) |
|
hansmuller1
2015/03/11 22:02:01
Maybe we should log errors for these failure modes
viettrungluu
2015/03/11 23:58:23
Done.
|
| return false; |
| - } |
| for (;;) { |
| void* buffer = nullptr; |
| uint32_t buffer_num_bytes = 0; |
| @@ -166,7 +163,7 @@ bool BlockingCopyToFile(ScopedDataPipeConsumerHandle source, |
| base::ScopedFILE fp(base::OpenFile(destination, "wb")); |
| if (!fp) { |
| LOG(ERROR) << "OpenFile('" << destination.value() |
| - << "'failed in BlockingCopyToFile" << std::endl; |
| + << "'failed in BlockingCopyToFile"; |
| return false; |
| } |
| return BlockingCopyHelper( |