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

Side by Side Diff: pdf/chunk_stream.h

Issue 294793003: Add the pdf plugin's source in src\pdf. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: review comments Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « pdf/button.cc ('k') | 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')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef PDF_CHUNK_STREAM_H_
6 #define PDF_CHUNK_STREAM_H_
7
8 #include <map>
9 #include <stddef.h>
Lei Zhang 2014/05/20 00:13:10 nit: C #includes before C++
jam 2014/05/20 00:20:32 Done.
10 #include <vector>
11
12 namespace chrome_pdf {
13
14 // This class collects a chunks of data into one data stream. Client can check
15 // if data in certain range is available, and get missing chunks of data.
16 class ChunkStream {
17 public:
18 ChunkStream();
19 ~ChunkStream();
20
21 void Clear();
22
23 void Preallocate(size_t stream_size);
24 size_t GetSize();
25
26 bool WriteData(size_t offset, void* buffer, size_t size);
27 bool ReadData(size_t offset, size_t size, void* buffer) const;
28
29 // Returns vector of pairs where first is an offset, second is a size.
30 bool GetMissedRanges(size_t offset, size_t size,
31 std::vector<std::pair<size_t, size_t> >* ranges) const;
32 bool IsRangeAvailable(size_t offset, size_t size) const;
33 size_t GetFirstMissingByte() const;
34
35 size_t GetLastByteBefore(size_t offset) const;
36 size_t GetFirstByteAfter(size_t offset) const;
37
38 private:
39 std::vector<unsigned char> data_;
40
41 // Pair, first - begining of the chunk, second - size of the chunk.
42 std::map<size_t, size_t> chunks_;
43 };
44
45 }; // namespace chrome_pdf
46
47 #endif
OLDNEW
« no previous file with comments | « pdf/button.cc ('k') | pdf/chunk_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698