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

Side by Side Diff: net/filter/mock_source_stream.h

Issue 2604233002: Fix bug in deflate code. (Closed)
Patch Set: Revert bypassing replay state Created 3 years, 11 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 | « net/filter/gzip_source_stream_unittest.cc ('k') | net/filter/mock_source_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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 NET_FILTER_MOCK_SOURCE_STREAM_H_ 5 #ifndef NET_FILTER_MOCK_SOURCE_STREAM_H_
6 #define NET_FILTER_MOCK_SOURCE_STREAM_H_ 6 #define NET_FILTER_MOCK_SOURCE_STREAM_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 28 matching lines...) Expand all
39 // Enqueues a result to be returned by |Read|. This method does not make a 39 // Enqueues a result to be returned by |Read|. This method does not make a
40 // copy of |data|, so |data| must outlive this object. If |mode| is SYNC, 40 // copy of |data|, so |data| must outlive this object. If |mode| is SYNC,
41 // |Read| will return the supplied data synchronously; otherwise, consumer 41 // |Read| will return the supplied data synchronously; otherwise, consumer
42 // needs to call |CompleteNextRead| 42 // needs to call |CompleteNextRead|
43 void AddReadResult(const char* data, int len, Error error, Mode mode); 43 void AddReadResult(const char* data, int len, Error error, Mode mode);
44 44
45 // Completes a pending Read() call. Crash in debug build if there is no 45 // Completes a pending Read() call. Crash in debug build if there is no
46 // pending read. 46 // pending read.
47 void CompleteNextRead(); 47 void CompleteNextRead();
48 48
49 // Affects behavior or AddReadResult. When set to true, each character in
50 // |data| passed to AddReadResult will be read as an individual byte, instead
51 // of all at once. Default to false.
52 // Note that setting it only affects future calls to AddReadResult, not
53 // previous ones.
54 void set_read_one_byte_at_a_time(bool read_one_byte_at_a_time) {
55 read_one_byte_at_a_time_ = read_one_byte_at_a_time;
56 }
57
58 // Returns true if a read is waiting to be completed.
59 bool awaiting_completion() const { return awaiting_completion_; }
60
49 private: 61 private:
50 struct QueuedResult { 62 struct QueuedResult {
51 QueuedResult(const char* data, int len, Error error, Mode mode); 63 QueuedResult(const char* data, int len, Error error, Mode mode);
52 64
53 const char* data; 65 const char* data;
54 const int len; 66 const int len;
55 const Error error; 67 const Error error;
56 const Mode mode; 68 const Mode mode;
57 }; 69 };
58 70
71 bool read_one_byte_at_a_time_;
59 std::queue<QueuedResult> results_; 72 std::queue<QueuedResult> results_;
60 bool awaiting_completion_; 73 bool awaiting_completion_;
61 scoped_refptr<IOBuffer> dest_buffer_; 74 scoped_refptr<IOBuffer> dest_buffer_;
62 CompletionCallback callback_; 75 CompletionCallback callback_;
63 int dest_buffer_size_; 76 int dest_buffer_size_;
64 77
65 DISALLOW_COPY_AND_ASSIGN(MockSourceStream); 78 DISALLOW_COPY_AND_ASSIGN(MockSourceStream);
66 }; 79 };
67 80
68 } // namespace net 81 } // namespace net
69 82
70 #endif // NET_FILTER_MOCK_SOURCE_STREAM_H_ 83 #endif // NET_FILTER_MOCK_SOURCE_STREAM_H_
OLDNEW
« no previous file with comments | « net/filter/gzip_source_stream_unittest.cc ('k') | net/filter/mock_source_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698