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

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: Address first willchan@ comments 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 File::Info::Info() 10 File::Info::Info()
11 : size(0), 11 : size(0),
12 is_directory(false), 12 is_directory(false),
13 is_symbolic_link(false) { 13 is_symbolic_link(false) {
14 } 14 }
15 15
16 File::Info::~Info() { 16 File::Info::~Info() {
17 } 17 }
18 18
19 File::Region::Region(int64 offset, int64 size) : offset(offset), size(size) {
20 DCHECK_GE(offset, 0);
21 DCHECK_GE(size, 0);
22 }
23
24 File::Region::~Region() {
25 }
26
27 bool File::Region::IsWholeFile() const {
28 return offset == 0 && size == std::numeric_limits<int64>::max();
29 }
30
31 // static
32 File::Region File::Region::WholeFile() {
33 return File::Region(0, std::numeric_limits<int64>::max());
34 }
35
19 File::File() 36 File::File()
20 : error_details_(FILE_ERROR_FAILED), 37 : error_details_(FILE_ERROR_FAILED),
21 created_(false), 38 created_(false),
22 async_(false) { 39 async_(false) {
23 } 40 }
24 41
25 #if !defined(OS_NACL) 42 #if !defined(OS_NACL)
26 File::File(const FilePath& name, uint32 flags) 43 File::File(const FilePath& name, uint32 flags)
27 : error_details_(FILE_OK), 44 : error_details_(FILE_OK),
28 created_(false), 45 created_(false),
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return "FILE_ERROR_IO"; 135 return "FILE_ERROR_IO";
119 case FILE_ERROR_MAX: 136 case FILE_ERROR_MAX:
120 break; 137 break;
121 } 138 }
122 139
123 NOTREACHED(); 140 NOTREACHED();
124 return ""; 141 return "";
125 } 142 }
126 143
127 } // namespace base 144 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698