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

Side by Side Diff: src/core/SkStream.cpp

Issue 1530783003: add fsync to try to get complete skps from webpage picture capture (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: exclude android and friends that may not define fileno Created 5 years 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 unified diff | Download patch
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkStream.h" 10 #include "SkStream.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 void SkWStream::newline() 73 void SkWStream::newline()
74 { 74 {
75 this->write("\n", 1); 75 this->write("\n", 1);
76 } 76 }
77 77
78 void SkWStream::flush() 78 void SkWStream::flush()
79 { 79 {
80 } 80 }
81 81
82 void SkWStream::sync()
83 {
84 }
85
82 bool SkWStream::writeText(const char text[]) 86 bool SkWStream::writeText(const char text[])
83 { 87 {
84 SkASSERT(text); 88 SkASSERT(text);
85 return this->write(text, strlen(text)); 89 return this->write(text, strlen(text));
86 } 90 }
87 91
88 bool SkWStream::writeDecAsText(int32_t dec) 92 bool SkWStream::writeDecAsText(int32_t dec)
89 { 93 {
90 char buffer[SkStrAppendS32_MaxSize]; 94 char buffer[SkStrAppendS32_MaxSize];
91 char* stop = SkStrAppendS32(buffer, dec); 95 char* stop = SkStrAppendS32(buffer, dec);
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 return true; 460 return true;
457 } 461 }
458 462
459 void SkFILEWStream::flush() 463 void SkFILEWStream::flush()
460 { 464 {
461 if (fFILE) { 465 if (fFILE) {
462 sk_fflush(fFILE); 466 sk_fflush(fFILE);
463 } 467 }
464 } 468 }
465 469
470 void SkFILEWStream::sync()
471 {
472 if (fFILE) {
473 sk_fsync(fFILE);
474 }
475 }
476
466 //////////////////////////////////////////////////////////////////////// 477 ////////////////////////////////////////////////////////////////////////
467 478
468 SkMemoryWStream::SkMemoryWStream(void* buffer, size_t size) 479 SkMemoryWStream::SkMemoryWStream(void* buffer, size_t size)
469 : fBuffer((char*)buffer), fMaxLength(size), fBytesWritten(0) 480 : fBuffer((char*)buffer), fMaxLength(size), fBytesWritten(0)
470 { 481 {
471 } 482 }
472 483
473 bool SkMemoryWStream::write(const void* buffer, size_t size) { 484 bool SkMemoryWStream::write(const void* buffer, size_t size) {
474 size = SkTMin(size, fMaxLength - fBytesWritten); 485 size = SkTMin(size, fMaxLength - fBytesWritten);
475 if (size > 0) { 486 if (size > 0) {
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 while (true) { 980 while (true) {
970 count = input->read(scratch, sizeof(scratch)); 981 count = input->read(scratch, sizeof(scratch));
971 if (0 == count) { 982 if (0 == count) {
972 return true; 983 return true;
973 } 984 }
974 if (!out->write(scratch, count)) { 985 if (!out->write(scratch, count)) {
975 return false; 986 return false;
976 } 987 }
977 } 988 }
978 } 989 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698