Update navigator.services API to use the new services.onconnect event [2/3].
[chromium-blink-merge.git] / net / spdy / spdy_buffer_producer.h
blobd098bb9a36e6a4bc8872f1814dae96965bfec7da
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"
13 namespace net {
15 class SpdyBuffer;
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 {
21 public:
22 SpdyBufferProducer();
24 // Produces the buffer to be written. Will be called at most once.
25 virtual scoped_ptr<SpdyBuffer> ProduceBuffer() = 0;
27 virtual ~SpdyBufferProducer();
29 private:
30 DISALLOW_COPY_AND_ASSIGN(SpdyBufferProducer);
33 // A simple wrapper around a single SpdyBuffer.
34 class NET_EXPORT_PRIVATE SimpleBufferProducer : public SpdyBufferProducer {
35 public:
36 explicit SimpleBufferProducer(scoped_ptr<SpdyBuffer> buffer);
38 ~SimpleBufferProducer() override;
40 scoped_ptr<SpdyBuffer> ProduceBuffer() override;
42 private:
43 scoped_ptr<SpdyBuffer> buffer_;
45 DISALLOW_COPY_AND_ASSIGN(SimpleBufferProducer);
48 } // namespace net
50 #endif // NET_SPDY_SPDY_BUFFER_PRODUCER_H_