Bug 1409768 - Don't call fsync repeatedly when printing; r?bobowen
Usage of sync was a mistake when porting from the previous std::ostream code.
MozReview-Commit-ID: HwbFVlZMu6t
--- a/layout/printing/DrawEventRecorder.h
+++ b/layout/printing/DrawEventRecorder.h
@@ -28,29 +28,27 @@ public:
mFd = nullptr;
}
bool IsOpen() {
return mFd != nullptr;
}
void Flush() {
- // We need to be API compatible with std::ostream, and so we silently handle
- // flushes on a closed FD.
- if (IsOpen()) {
- PR_Sync(mFd);
- }
+ // For std::ostream this flushes any internal buffers. PRFileDesc's IO isn't
+ // buffered, so nothing to do here.
}
void Seek(PRInt32 aOffset, PRSeekWhence aWhence) {
PR_Seek(mFd, aOffset, aWhence);
}
void write(const char* aData, size_t aSize) {
- // See comment in Flush().
+ // We need to be API compatible with std::ostream, and so we silently handle
+ // writes on a closed FD.
if (IsOpen()) {
PR_Write(mFd, static_cast<const void*>(aData), aSize);
}
}
void read(char* aOut, size_t aSize) {
PRInt32 res = PR_Read(mFd, static_cast<void*>(aOut), aSize);
mGood = res >= 0 && ((size_t)res == aSize);