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

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

Issue 1424943006: Support Windows FILE_FLAG_SEQUENTIAL_SCAN in base::File. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « base/files/file.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 if (flags & FLAG_ASYNC) 368 if (flags & FLAG_ASYNC)
369 create_flags |= FILE_FLAG_OVERLAPPED; 369 create_flags |= FILE_FLAG_OVERLAPPED;
370 if (flags & FLAG_TEMPORARY) 370 if (flags & FLAG_TEMPORARY)
371 create_flags |= FILE_ATTRIBUTE_TEMPORARY; 371 create_flags |= FILE_ATTRIBUTE_TEMPORARY;
372 if (flags & FLAG_HIDDEN) 372 if (flags & FLAG_HIDDEN)
373 create_flags |= FILE_ATTRIBUTE_HIDDEN; 373 create_flags |= FILE_ATTRIBUTE_HIDDEN;
374 if (flags & FLAG_DELETE_ON_CLOSE) 374 if (flags & FLAG_DELETE_ON_CLOSE)
375 create_flags |= FILE_FLAG_DELETE_ON_CLOSE; 375 create_flags |= FILE_FLAG_DELETE_ON_CLOSE;
376 if (flags & FLAG_BACKUP_SEMANTICS) 376 if (flags & FLAG_BACKUP_SEMANTICS)
377 create_flags |= FILE_FLAG_BACKUP_SEMANTICS; 377 create_flags |= FILE_FLAG_BACKUP_SEMANTICS;
378 if (flags & FLAG_SEQUENTIAL_SCAN)
379 create_flags |= FILE_FLAG_SEQUENTIAL_SCAN;
378 380
379 file_.Set(CreateFile(path.value().c_str(), access, sharing, NULL, 381 file_.Set(CreateFile(path.value().c_str(), access, sharing, NULL,
380 disposition, create_flags, NULL)); 382 disposition, create_flags, NULL));
381 383
382 if (file_.IsValid()) { 384 if (file_.IsValid()) {
383 error_details_ = FILE_OK; 385 error_details_ = FILE_OK;
384 async_ = ((flags & FLAG_ASYNC) == FLAG_ASYNC); 386 async_ = ((flags & FLAG_ASYNC) == FLAG_ASYNC);
385 387
386 if (flags & (FLAG_OPEN_ALWAYS)) 388 if (flags & (FLAG_OPEN_ALWAYS))
387 created_ = (ERROR_ALREADY_EXISTS != GetLastError()); 389 created_ = (ERROR_ALREADY_EXISTS != GetLastError());
388 else if (flags & (FLAG_CREATE_ALWAYS | FLAG_CREATE)) 390 else if (flags & (FLAG_CREATE_ALWAYS | FLAG_CREATE))
389 created_ = true; 391 created_ = true;
390 } else { 392 } else {
391 error_details_ = OSErrorToFileError(GetLastError()); 393 error_details_ = OSErrorToFileError(GetLastError());
392 } 394 }
393 } 395 }
394 396
395 bool File::DoFlush() { 397 bool File::DoFlush() {
396 ThreadRestrictions::AssertIOAllowed(); 398 ThreadRestrictions::AssertIOAllowed();
397 DCHECK(IsValid()); 399 DCHECK(IsValid());
398 return ::FlushFileBuffers(file_.Get()) != FALSE; 400 return ::FlushFileBuffers(file_.Get()) != FALSE;
399 } 401 }
400 402
401 void File::SetPlatformFile(PlatformFile file) { 403 void File::SetPlatformFile(PlatformFile file) {
402 file_.Set(file); 404 file_.Set(file);
403 } 405 }
404 406
405 } // namespace base 407 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698