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
3 // found in the LICENSE file.
5 #ifndef NET_SPDY_SPDY_BUFFER_PRODUCER_H_
6 #define NET_SPDY_SPDY_BUFFER_PRODUCER_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "net/base/net_export.h"
17 // An object which provides a SpdyBuffer for writing. We pass these
18 // around instead of SpdyBuffers since some buffers have to be
19 // generated "just in time".
20 class NET_EXPORT_PRIVATE SpdyBufferProducer
{
24 // Produces the buffer to be written. Will be called at most once.
25 virtual scoped_ptr
<SpdyBuffer
> ProduceBuffer() = 0;
27 virtual ~SpdyBufferProducer();
30 DISALLOW_COPY_AND_ASSIGN(SpdyBufferProducer
);
33 // A simple wrapper around a single SpdyBuffer.
34 class NET_EXPORT_PRIVATE SimpleBufferProducer
: public SpdyBufferProducer
{
36 explicit SimpleBufferProducer(scoped_ptr
<SpdyBuffer
> buffer
);
38 ~SimpleBufferProducer() override
;
40 scoped_ptr
<SpdyBuffer
> ProduceBuffer() override
;
43 scoped_ptr
<SpdyBuffer
> buffer_
;
45 DISALLOW_COPY_AND_ASSIGN(SimpleBufferProducer
);
50 #endif // NET_SPDY_SPDY_BUFFER_PRODUCER_H_