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

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

Issue 323683002: net: FileStream cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
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 <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if (!IsValid()) 272 if (!IsValid())
273 return; 273 return;
274 274
275 base::ThreadRestrictions::AssertIOAllowed(); 275 base::ThreadRestrictions::AssertIOAllowed();
276 file_.reset(); 276 file_.reset();
277 } 277 }
278 278
279 int64 File::Seek(Whence whence, int64 offset) { 279 int64 File::Seek(Whence whence, int64 offset) {
280 base::ThreadRestrictions::AssertIOAllowed(); 280 base::ThreadRestrictions::AssertIOAllowed();
281 DCHECK(IsValid()); 281 DCHECK(IsValid());
282 if (offset < 0)
283 return -1;
284 282
285 return lseek(file_.get(), static_cast<off_t>(offset), 283 return lseek(file_.get(), static_cast<off_t>(offset),
286 static_cast<int>(whence)); 284 static_cast<int>(whence));
287 } 285 }
288 286
289 int File::Read(int64 offset, char* data, int size) { 287 int File::Read(int64 offset, char* data, int size) {
290 base::ThreadRestrictions::AssertIOAllowed(); 288 base::ThreadRestrictions::AssertIOAllowed();
291 DCHECK(IsValid()); 289 DCHECK(IsValid());
292 if (size < 0) 290 if (size < 0)
293 return -1; 291 return -1;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 return FILE_ERROR_FAILED; 476 return FILE_ERROR_FAILED;
479 } 477 }
480 } 478 }
481 479
482 void File::SetPlatformFile(PlatformFile file) { 480 void File::SetPlatformFile(PlatformFile file) {
483 DCHECK(!file_.is_valid()); 481 DCHECK(!file_.is_valid());
484 file_.reset(file); 482 file_.reset(file);
485 } 483 }
486 484
487 } // namespace base 485 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/files/file_unittest.cc » ('j') | chrome/browser/extensions/api/messaging/native_message_process_host.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698