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

Side by Side Diff: remoting/client/plugin/compression.h

Issue 2690003: Copy the (early prototype of) remoting in Chrome into the public tree.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« no previous file with comments | « remoting/client/plugin/client.cc ('k') | remoting/client/plugin/compression.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 REMOTING_CLIENT_PLUGIN_COMPRESSION_H_
6 #define REMOTING_CLIENT_PLUGIN_COMPRESSION_H_
7
8 #include <vector>
9
10 #include "base/basictypes.h"
11
12 #if defined(USE_SYSTEM_ZLIB)
13 #include <zlib.h>
14 #else
15 #include "third_party/zlib/zlib.h"
16 #endif
17
18 namespace remoting {
19
20 class Compressor {
21 public:
22 Compressor() {}
23 virtual ~Compressor() {}
24
25 virtual void Write(char* buffer, int size) = 0;
26 virtual void Flush() = 0;
27 virtual int GetCompressedSize() = 0;
28 virtual char* GetCompressedData() = 0;
29 virtual int GetRawSize() = 0;
30
31 DISALLOW_COPY_AND_ASSIGN(Compressor);
32 };
33
34 class Decompressor {
35 public:
36 Decompressor() {}
37 virtual ~Decompressor() {}
38
39 virtual void Write(char* buffer, int size) = 0;
40 virtual void Flush() = 0;
41 virtual char* GetRawData() = 0;
42 virtual int GetRawSize() = 0;
43 virtual int GetCompressedSize() = 0;
44
45 DISALLOW_COPY_AND_ASSIGN(Decompressor);
46 };
47
48 class ZCompressor : public Compressor {
49 public:
50 ZCompressor();
51 virtual ~ZCompressor() {}
52
53 virtual void Write(char* buffer, int size);
54 virtual void Flush();
55 virtual int GetCompressedSize();
56 virtual char* GetCompressedData();
57 virtual int GetRawSize();
58
59 private:
60 void WriteInternal(char* buffer, int size, int flush);
61
62 std::vector<char> buffer_;
63 z_stream stream_;
64
65 DISALLOW_COPY_AND_ASSIGN(ZCompressor);
66 };
67
68 class ZDecompressor : public Decompressor {
69 public:
70 ZDecompressor();
71 virtual ~ZDecompressor() {}
72
73 virtual void Write(char* buffer, int size);
74 virtual void Flush();
75 virtual char* GetRawData();
76 virtual int GetRawSize();
77 virtual int GetCompressedSize();
78
79 private:
80 void WriteInternal(char* buffer, int size, int flush);
81
82 std::vector<char> buffer_;
83 z_stream stream_;
84
85 DISALLOW_COPY_AND_ASSIGN(ZDecompressor);
86 };
87
88 } // namespace remoting
89
90 #endif // REMOTING_CLIENT_PLUGIN_COMPRESSION_H_
OLDNEW
« no previous file with comments | « remoting/client/plugin/client.cc ('k') | remoting/client/plugin/compression.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698