Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1028)

Unified Diff: mojo/common/data_pipe_utils.cc

Issue 992273002: Random drive-by cleanup. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: log seek failures Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | shell/application_manager/data_pipe_peek.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..614044f7a7d35329a6a61b45efea1046239596b0 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(
@@ -79,6 +77,7 @@ bool BlockingCopyFromFile(const base::FilePath& source,
if (!file.IsValid())
return false;
if (file.Seek(base::File::FROM_BEGIN, skip) != skip) {
+ LOG(ERROR) << "Seek of " << skip << " in " << source.value() << " failed";
return false;
}
for (;;) {
@@ -166,7 +165,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(
« no previous file with comments | « no previous file | shell/application_manager/data_pipe_peek.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698