OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef NET_SPDY_SPDY_FRAME_PRODUCER_H_ | |
6 #define NET_SPDY_SPDY_FRAME_PRODUCER_H_ | |
7 | |
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" | |
12 | |
13 namespace net { | |
14 | |
15 class SpdyFrame; | |
16 | |
17 // An object which provides a SpdyFrame for writing. We pass these | |
18 // around instead of SpdyFrames since some frames have to be generated | |
19 // "just in time". | |
20 class NET_EXPORT_PRIVATE SpdyFrameProducer { | |
21 public: | |
22 SpdyFrameProducer(); | |
23 | |
24 // Produces the frame to be written. Will be called at most once. | |
25 virtual scoped_ptr<SpdyFrame> ProduceFrame() = 0; | |
26 | |
27 virtual ~SpdyFrameProducer(); | |
28 | |
29 private: | |
30 DISALLOW_COPY_AND_ASSIGN(SpdyFrameProducer); | |
31 }; | |
32 | |
33 // A simple wrapper around a single SpdyFrame. | |
34 class NET_EXPORT_PRIVATE SimpleFrameProducer : public SpdyFrameProducer { | |
35 public: | |
36 explicit SimpleFrameProducer(scoped_ptr<SpdyFrame> frame); | |
37 | |
38 virtual ~SimpleFrameProducer(); | |
39 | |
40 virtual scoped_ptr<SpdyFrame> ProduceFrame() OVERRIDE; | |
41 | |
42 private: | |
43 scoped_ptr<SpdyFrame> frame_; | |
44 | |
45 DISALLOW_COPY_AND_ASSIGN(SimpleFrameProducer); | |
46 }; | |
47 | |
48 } // namespace net | |
49 | |
50 #endif // NET_SPDY_SPDY_FRAME_PRODUCER_H_ | |
OLD | NEW |