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

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: make sync nonvirtual 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
« no previous file with comments | « include/core/SkStream.h ('k') | src/ports/SkOSFile_stdio.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 return true; 456 return true;
457 } 457 }
458 458
459 void SkFILEWStream::flush() 459 void SkFILEWStream::flush()
460 { 460 {
461 if (fFILE) { 461 if (fFILE) {
462 sk_fflush(fFILE); 462 sk_fflush(fFILE);
463 } 463 }
464 } 464 }
465 465
466 void SkFILEWStream::fsync()
467 {
468 flush();
469 if (fFILE) {
470 sk_fsync(fFILE);
471 }
472 }
473
466 //////////////////////////////////////////////////////////////////////// 474 ////////////////////////////////////////////////////////////////////////
467 475
468 SkMemoryWStream::SkMemoryWStream(void* buffer, size_t size) 476 SkMemoryWStream::SkMemoryWStream(void* buffer, size_t size)
469 : fBuffer((char*)buffer), fMaxLength(size), fBytesWritten(0) 477 : fBuffer((char*)buffer), fMaxLength(size), fBytesWritten(0)
470 { 478 {
471 } 479 }
472 480
473 bool SkMemoryWStream::write(const void* buffer, size_t size) { 481 bool SkMemoryWStream::write(const void* buffer, size_t size) {
474 size = SkTMin(size, fMaxLength - fBytesWritten); 482 size = SkTMin(size, fMaxLength - fBytesWritten);
475 if (size > 0) { 483 if (size > 0) {
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 while (true) { 977 while (true) {
970 count = input->read(scratch, sizeof(scratch)); 978 count = input->read(scratch, sizeof(scratch));
971 if (0 == count) { 979 if (0 == count) {
972 return true; 980 return true;
973 } 981 }
974 if (!out->write(scratch, count)) { 982 if (!out->write(scratch, count)) {
975 return false; 983 return false;
976 } 984 }
977 } 985 }
978 } 986 }
OLDNEW
« no previous file with comments | « include/core/SkStream.h ('k') | src/ports/SkOSFile_stdio.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698