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

Unified 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: Add base unittest and fix win 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 side-by-side diff with in-line comments
Download patch
Index: base/files/file.cc
diff --git a/base/files/file.cc b/base/files/file.cc
index ea8dbf27ac1770d88fc6ce933a4bdd331820d2d9..543a7bf89fe63518d952870f5674087c0881371d 100644
--- a/base/files/file.cc
+++ b/base/files/file.cc
@@ -16,6 +16,23 @@ File::Info::Info()
File::Info::~Info() {
}
+File::Region::Region(int64 offset, int64 size) : offset(offset), size(size) {
+ DCHECK_GE(offset, 0);
+ DCHECK_GE(size, 0);
+}
+
+File::Region::~Region() {
+}
+
+bool File::Region::IsWholeFile() const {
willchan no longer on Chromium 2014/07/21 23:55:40 Hmmm...what happens when |size| == the length of t
Primiano Tucci (use gerrit) 2014/07/22 10:32:01 Good point, let me spend one minute to explain the
willchan no longer on Chromium 2014/07/22 20:45:47 We chatted about this offline. Primiano explained
+ return offset == 0 && size == std::numeric_limits<int64>::max();
+}
+
+// static
+File::Region File::Region::WholeFile() {
+ return File::Region(0, std::numeric_limits<int64>::max());
+}
+
File::File()
: error_details_(FILE_ERROR_FAILED),
created_(false),

Powered by Google App Engine
This is Rietveld 408576698