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

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

Issue 394313002: Add support for loading pak files from arbitrary file regions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove IsWholeFile, use kWholeFile; other nits Created 6 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 7
8 namespace base { 8 namespace base {
9 9
10 const File::Region File::Region::kWholeFile;
11
10 File::Info::Info() 12 File::Info::Info()
11 : size(0), 13 : size(0),
12 is_directory(false), 14 is_directory(false),
13 is_symbolic_link(false) { 15 is_symbolic_link(false) {
14 } 16 }
15 17
16 File::Info::~Info() { 18 File::Info::~Info() {
17 } 19 }
18 20
21 File::Region::Region() : offset(0), size(0) {
Primiano Tucci (use gerrit) 2014/07/23 23:17:38 This is a private ctor and can be used only by kWh
willchan no longer on Chromium 2014/07/25 21:21:23 Sounds great.
22 }
23
24 File::Region::Region(int64 offset, int64 size) : offset(offset), size(size) {
25 DCHECK_GE(offset, 0);
26 DCHECK_GT(size, 0);
27 }
28
29 bool File::Region::operator==(const File::Region& other) const {
30 return other.offset == offset && other.size == size;
31 }
32
19 File::File() 33 File::File()
20 : error_details_(FILE_ERROR_FAILED), 34 : error_details_(FILE_ERROR_FAILED),
21 created_(false), 35 created_(false),
22 async_(false) { 36 async_(false) {
23 } 37 }
24 38
25 #if !defined(OS_NACL) 39 #if !defined(OS_NACL)
26 File::File(const FilePath& name, uint32 flags) 40 File::File(const FilePath& name, uint32 flags)
27 : error_details_(FILE_OK), 41 : error_details_(FILE_OK),
28 created_(false), 42 created_(false),
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return "FILE_ERROR_IO"; 132 return "FILE_ERROR_IO";
119 case FILE_ERROR_MAX: 133 case FILE_ERROR_MAX:
120 break; 134 break;
121 } 135 }
122 136
123 NOTREACHED(); 137 NOTREACHED();
124 return ""; 138 return "";
125 } 139 }
126 140
127 } // namespace base 141 } // namespace base
OLDNEW
« base/files/file.h ('K') | « base/files/file.h ('k') | base/files/memory_mapped_file.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698