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

Side by Side Diff: third_party/ijar/mapped_file.h

Issue 1901473003: 🐞 Update version of third_party/ijar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « third_party/ijar/ijar.cc ('k') | third_party/ijar/mapped_file_unix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Bazel Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #ifndef INCLUDED_THIRD_PARTY_IJAR_MAPPED_FILE_H
16 #define INCLUDED_THIRD_PARTY_IJAR_MAPPED_FILE_H
17
18 #include "third_party/ijar/common.h"
19
20 namespace devtools_ijar {
21
22 struct MappedInputFileImpl;
23 struct MappedOutputFileImpl;
24
25 // A memory mapped input file.
26 class MappedInputFile {
27 private:
28 MappedInputFileImpl *impl_;
29
30 protected:
31 const char* errmsg_;
32 bool opened_;
33 u1* buffer_;
34 size_t length_;
35
36 public:
37 MappedInputFile(const char* name);
38 virtual ~MappedInputFile();
39
40 // If opening the file succeeded or not.
41 bool Opened() const { return opened_; }
42
43 // Description of the last error that happened.
44 const char* Error() const { return errmsg_; }
45
46 // The mapped contents of the file.
47 u1* Buffer() const { return buffer_ ; }
48
49 // The length of the file.
50 size_t Length() const { return length_; }
51
52 // Unmap a given number of bytes from the beginning of the file.
53 void Discard(size_t bytes);
54 int Close();
55 };
56
57 class MappedOutputFile {
58 private:
59 MappedOutputFileImpl *impl_;
60
61 protected:
62 const char* errmsg_;
63 bool opened_;
64 u1* buffer_;
65
66 public:
67 MappedOutputFile(const char* name, u8 estimated_size);
68 virtual ~MappedOutputFile();
69
70 // If opening the file succeeded or not.
71 bool Opened() const { return opened_; }
72
73 // Description of the last error that happened.
74 const char* Error() const { return errmsg_; }
75
76 // The mapped contents of the file.
77 u1* Buffer() const { return buffer_; }
78 int Close(int size);
79 };
80
81 } // namespace devtools_ijar
82 #endif
OLDNEW
« no previous file with comments | « third_party/ijar/ijar.cc ('k') | third_party/ijar/mapped_file_unix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698