flush after every print in windows

R=djsollen@google.com, reed@google.com, epoger@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/26680004

git-svn-id: http://skia.googlecode.com/svn/trunk@11670 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2013-10-09 15:09:42 +00:00
parent df187c7eb2
commit aadb4d9a53
3 changed files with 9 additions and 2 deletions

View File

@ -63,11 +63,10 @@ public:
private:
#ifdef SK_BUILD_FOR_ANDROID
void nativeLogError(const char msg[]) { SkDebugf("%s", msg); }
void nativeLogProgress(const char msg[]) { SkDebugf("%s", msg); }
#else
void nativeLogError(const char msg[]) { fprintf(stderr, "%s", msg); }
void nativeLogProgress(const char msg[]) { printf("%s", msg); }
#endif
void nativeLogProgress(const char msg[]) { SkDebugf("%s", msg); }
void fileWrite(const char msg[], size_t size);

View File

@ -34,6 +34,11 @@ namespace skiagm {
va_start(args, format);
fprintf(stream, "GM: ");
vfprintf(stream, format, args);
#ifdef SK_BUILD_FOR_WIN
if (stderr == stream || stdout == stream) {
fflush(stream);
}
#endif
va_end(args);
}

View File

@ -23,6 +23,9 @@ void SkDebugf(const char format[], ...) {
va_start(args, format);
vprintf(format, args);
va_end(args);
// When we crash on Windows we often are missing a lot of prints. Since we don't really care
// about SkDebugf performance we flush after every print.
fflush(stdout);
va_start(args, format);
vsnprintf(buffer, kBufferSize, format, args);