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

Side by Side Diff: base/files/file_win.cc

Issue 2171833002: Add some words of caution to File::Flush(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove PlatformFile.FlushTime histogram. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/files/file.h" 5 #include "base/files/file.h"
6 6
7 #include <io.h> 7 #include <io.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 389
390 if (flags & (FLAG_OPEN_ALWAYS)) 390 if (flags & (FLAG_OPEN_ALWAYS))
391 created_ = (ERROR_ALREADY_EXISTS != GetLastError()); 391 created_ = (ERROR_ALREADY_EXISTS != GetLastError());
392 else if (flags & (FLAG_CREATE_ALWAYS | FLAG_CREATE)) 392 else if (flags & (FLAG_CREATE_ALWAYS | FLAG_CREATE))
393 created_ = true; 393 created_ = true;
394 } else { 394 } else {
395 error_details_ = OSErrorToFileError(GetLastError()); 395 error_details_ = OSErrorToFileError(GetLastError());
396 } 396 }
397 } 397 }
398 398
399 bool File::DoFlush() { 399 bool File::Flush() {
400 ThreadRestrictions::AssertIOAllowed(); 400 ThreadRestrictions::AssertIOAllowed();
401 DCHECK(IsValid()); 401 DCHECK(IsValid());
402 SCOPED_FILE_TRACE("Flush");
402 return ::FlushFileBuffers(file_.Get()) != FALSE; 403 return ::FlushFileBuffers(file_.Get()) != FALSE;
403 } 404 }
404 405
405 void File::SetPlatformFile(PlatformFile file) { 406 void File::SetPlatformFile(PlatformFile file) {
406 file_.Set(file); 407 file_.Set(file);
407 } 408 }
408 409
409 } // namespace base 410 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698