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

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

Issue 172673002: Base: Don't check for thread restrictions when closing a file doesn't do IO. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « base/files/file_posix.cc ('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/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 98
99 bool File::IsValid() const { 99 bool File::IsValid() const {
100 return file_.IsValid(); 100 return file_.IsValid();
101 } 101 }
102 PlatformFile File::TakePlatformFile() { 102 PlatformFile File::TakePlatformFile() {
103 return file_.Take(); 103 return file_.Take();
104 } 104 }
105 105
106 void File::Close() { 106 void File::Close() {
107 base::ThreadRestrictions::AssertIOAllowed(); 107 if (file_.IsValid()) {
108 file_.Close(); 108 base::ThreadRestrictions::AssertIOAllowed();
109 file_.Close();
110 }
109 } 111 }
110 112
111 int64 File::Seek(Whence whence, int64 offset) { 113 int64 File::Seek(Whence whence, int64 offset) {
112 base::ThreadRestrictions::AssertIOAllowed(); 114 base::ThreadRestrictions::AssertIOAllowed();
113 DCHECK(IsValid()); 115 DCHECK(IsValid());
114 if (offset < 0) 116 if (offset < 0)
115 return -1; 117 return -1;
116 118
117 LARGE_INTEGER distance, res; 119 LARGE_INTEGER distance, res;
118 distance.QuadPart = offset; 120 distance.QuadPart = offset;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 last_error); 325 last_error);
324 return FILE_ERROR_FAILED; 326 return FILE_ERROR_FAILED;
325 } 327 }
326 } 328 }
327 329
328 void File::SetPlatformFile(PlatformFile file) { 330 void File::SetPlatformFile(PlatformFile file) {
329 file_.Set(file); 331 file_.Set(file);
330 } 332 }
331 333
332 } // namespace base 334 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698