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

Side by Side Diff: net/spdy/array_output_buffer.h

Issue 2832973003: Split net/spdy into core and chromium subdirectories. (Closed)
Patch Set: Fix some more build rules. Created 3 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 | « net/socket/ssl_client_socket_pool_unittest.cc ('k') | net/spdy/array_output_buffer.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 2017 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 NET_SPDY_ARRAY_OUTPUT_BUFFER_H_
6 #define NET_SPDY_ARRAY_OUTPUT_BUFFER_H_
7
8 #include <cstddef>
9 #include "net/spdy/zero_copy_output_buffer.h"
10
11 namespace net {
12
13 class ArrayOutputBuffer : public ZeroCopyOutputBuffer {
14 public:
15 // |buffer| is pointed to the output to write to, and |size| is the capacity
16 // of the output.
17 ArrayOutputBuffer(char* buffer, int64_t size)
18 : current_(buffer), begin_(buffer), capacity_(size) {}
19 ~ArrayOutputBuffer() override{};
20
21 void Next(char** data, int* size) override;
22 void AdvanceWritePtr(int64_t count) override;
23 uint64_t BytesFree() const override;
24
25 size_t Size() const { return current_ - begin_; }
26 char* Begin() const { return begin_; }
27
28 // Resets the buffer to its original state.
29 void Reset() {
30 capacity_ += Size();
31 current_ = begin_;
32 }
33
34 ArrayOutputBuffer(const ArrayOutputBuffer&) = delete;
35 ArrayOutputBuffer& operator=(const ArrayOutputBuffer&) = delete;
36
37 private:
38 char* current_ = nullptr;
39 char* begin_ = nullptr;
40 int64_t capacity_ = 0;
41 };
42
43 } // namespace net
44
45 #endif // NET_SPDY_ARRAY_OUTPUT_BUFFER_H_
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_pool_unittest.cc ('k') | net/spdy/array_output_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698