| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_SPDY_SPDY_BUFFER_H_ | 5 #ifndef NET_SPDY_SPDY_BUFFER_H_ |
| 6 #define NET_SPDY_SPDY_BUFFER_H_ | 6 #define NET_SPDY_SPDY_BUFFER_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // Returns an IOBuffer pointing to the data starting at | 76 // Returns an IOBuffer pointing to the data starting at |
| 77 // GetRemainingData(). Use with care; the returned IOBuffer is not | 77 // GetRemainingData(). Use with care; the returned IOBuffer is not |
| 78 // updated when Consume() is called. However, it may still be used | 78 // updated when Consume() is called. However, it may still be used |
| 79 // past the lifetime of this object. | 79 // past the lifetime of this object. |
| 80 // | 80 // |
| 81 // This is used with Socket::Write(), which takes an IOBuffer* that | 81 // This is used with Socket::Write(), which takes an IOBuffer* that |
| 82 // may be written to even after the socket itself is destroyed. (See | 82 // may be written to even after the socket itself is destroyed. (See |
| 83 // http://crbug.com/249725 .) | 83 // http://crbug.com/249725 .) |
| 84 IOBuffer* GetIOBufferForRemainingData(); | 84 IOBuffer* GetIOBufferForRemainingData(); |
| 85 | 85 |
| 86 // Returns the estimate of dynamically allocated memory in bytes. |
| 87 size_t EstimateMemoryUsage() const; |
| 88 |
| 86 private: | 89 private: |
| 87 void ConsumeHelper(size_t consume_size, ConsumeSource consume_source); | 90 void ConsumeHelper(size_t consume_size, ConsumeSource consume_source); |
| 88 | 91 |
| 89 // Ref-count the passed-in SpdySerializedFrame to support the semantics of | 92 // Ref-count the passed-in SpdySerializedFrame to support the semantics of |
| 90 // |GetIOBufferForRemainingData()|. | 93 // |GetIOBufferForRemainingData()|. |
| 91 typedef base::RefCountedData<std::unique_ptr<SpdySerializedFrame>> | 94 typedef base::RefCountedData<std::unique_ptr<SpdySerializedFrame>> |
| 92 SharedFrame; | 95 SharedFrame; |
| 93 | 96 |
| 94 class SharedFrameIOBuffer; | 97 class SharedFrameIOBuffer; |
| 95 | 98 |
| 96 const scoped_refptr<SharedFrame> shared_frame_; | 99 const scoped_refptr<SharedFrame> shared_frame_; |
| 97 std::vector<ConsumeCallback> consume_callbacks_; | 100 std::vector<ConsumeCallback> consume_callbacks_; |
| 98 size_t offset_; | 101 size_t offset_; |
| 99 | 102 |
| 100 DISALLOW_COPY_AND_ASSIGN(SpdyBuffer); | 103 DISALLOW_COPY_AND_ASSIGN(SpdyBuffer); |
| 101 }; | 104 }; |
| 102 | 105 |
| 103 } // namespace net | 106 } // namespace net |
| 104 | 107 |
| 105 #endif // NET_SPDY_SPDY_BUFFER_H_ | 108 #endif // NET_SPDY_SPDY_BUFFER_H_ |
| OLD | NEW |