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

Side by Side Diff: pdf/chunk_stream.h

Issue 2911853002: Refactor PDF ChunkStream and DocumentLoader code. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | pdf/chunk_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef PDF_CHUNK_STREAM_H_ 5 #ifndef PDF_CHUNK_STREAM_H_
6 #define PDF_CHUNK_STREAM_H_ 6 #define PDF_CHUNK_STREAM_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 23 matching lines...) Expand all
34 std::vector<std::pair<size_t, size_t>>* ranges) const; 34 std::vector<std::pair<size_t, size_t>>* ranges) const;
35 bool IsRangeAvailable(size_t offset, size_t size) const; 35 bool IsRangeAvailable(size_t offset, size_t size) const;
36 size_t GetFirstMissingByte() const; 36 size_t GetFirstMissingByte() const;
37 37
38 // Finds the first byte of the missing byte interval that offset belongs to. 38 // Finds the first byte of the missing byte interval that offset belongs to.
39 size_t GetFirstMissingByteInInterval(size_t offset) const; 39 size_t GetFirstMissingByteInInterval(size_t offset) const;
40 // Returns the last byte of the missing byte interval that offset belongs to. 40 // Returns the last byte of the missing byte interval that offset belongs to.
41 size_t GetLastMissingByteInInterval(size_t offset) const; 41 size_t GetLastMissingByteInInterval(size_t offset) const;
42 42
43 private: 43 private:
44 std::map<size_t, size_t>::const_iterator GetStartChunk(size_t offset) const;
45
44 std::vector<unsigned char> data_; 46 std::vector<unsigned char> data_;
45 47
46 // Pair, first - begining of the chunk, second - size of the chunk. 48 // Key: offset of the chunk.
49 // Value: size of the chunk.
47 std::map<size_t, size_t> chunks_; 50 std::map<size_t, size_t> chunks_;
48 51
49 size_t stream_size_; 52 size_t stream_size_;
50 }; 53 };
51 54
52 }; // namespace chrome_pdf 55 }; // namespace chrome_pdf
53 56
54 #endif // PDF_CHUNK_STREAM_H_ 57 #endif // PDF_CHUNK_STREAM_H_
OLDNEW
« no previous file with comments | « no previous file | pdf/chunk_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698