OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 BLIMP_NET_BLIMP_MESSAGE_PUMP_H_ | 5 #ifndef BLIMP_NET_BLIMP_MESSAGE_PUMP_H_ |
6 #define BLIMP_NET_BLIMP_MESSAGE_PUMP_H_ | 6 #define BLIMP_NET_BLIMP_MESSAGE_PUMP_H_ |
7 | 7 |
8 #include <blimp/net/blimp_connection_statistics.h> | |
Kevin M
2016/05/20 01:02:04
Angle brackets.
shaktisahu
2016/05/22 22:36:57
Now that I think about it, I suspect angle bracket
| |
8 #include <memory> | 9 #include <memory> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
13 #include "blimp/net/blimp_net_export.h" | 14 #include "blimp/net/blimp_net_export.h" |
15 #include "blimp/net/packet_reader.h" | |
14 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
15 | 17 |
16 namespace net { | 18 namespace net { |
17 class GrowableIOBuffer; | 19 class GrowableIOBuffer; |
18 } | 20 } |
19 | 21 |
20 namespace blimp { | 22 namespace blimp { |
21 | 23 |
22 class BlimpMessageProcessor; | 24 class BlimpMessageProcessor; |
23 class ConnectionErrorObserver; | 25 class ConnectionErrorObserver; |
(...skipping 13 matching lines...) Expand all Loading... | |
37 // Caller retains the ownership of |processor|. | 39 // Caller retains the ownership of |processor|. |
38 // The processor can be unset by passing a null pointer when no reads are | 40 // The processor can be unset by passing a null pointer when no reads are |
39 // inflight, ie. after |processor_|->ProcessMessage() is called, but before | 41 // inflight, ie. after |processor_|->ProcessMessage() is called, but before |
40 // ProcessMessage() invokes its completion callback. | 42 // ProcessMessage() invokes its completion callback. |
41 void SetMessageProcessor(BlimpMessageProcessor* processor); | 43 void SetMessageProcessor(BlimpMessageProcessor* processor); |
42 | 44 |
43 void set_error_observer(ConnectionErrorObserver* observer) { | 45 void set_error_observer(ConnectionErrorObserver* observer) { |
44 error_observer_ = observer; | 46 error_observer_ = observer; |
45 } | 47 } |
46 | 48 |
49 void SetBlimpConnectionStatistics( | |
Kevin M
2016/05/20 01:02:04
IIRC we can only inline simple setters and getters
shaktisahu
2016/05/22 22:36:57
Done.
| |
50 BlimpConnectionStatistics* connection_statistics) { | |
51 DCHECK(reader_); | |
52 reader_->set_blimp_connection_statistics(connection_statistics); | |
53 } | |
54 | |
47 private: | 55 private: |
48 // Read next packet from |reader_|. | 56 // Read next packet from |reader_|. |
49 void ReadNextPacket(); | 57 void ReadNextPacket(); |
50 | 58 |
51 // Callback when next packet is ready in |buffer_|. | 59 // Callback when next packet is ready in |buffer_|. |
52 void OnReadPacketComplete(int result); | 60 void OnReadPacketComplete(int result); |
53 | 61 |
54 // Callback when |processor_| finishes processing a BlimpMessage. | 62 // Callback when |processor_| finishes processing a BlimpMessage. |
55 // Any values other than net::OK indicate that |processor_| has encountered an | 63 // Any values other than net::OK indicate that |processor_| has encountered an |
56 // error that should be handled. Currently all errors will cause the | 64 // error that should be handled. Currently all errors will cause the |
(...skipping 10 matching lines...) Expand all Loading... | |
67 | 75 |
68 // Used to abandon ProcessMessage completion callbacks if |this| is deleted. | 76 // Used to abandon ProcessMessage completion callbacks if |this| is deleted. |
69 base::WeakPtrFactory<BlimpMessagePump> weak_factory_; | 77 base::WeakPtrFactory<BlimpMessagePump> weak_factory_; |
70 | 78 |
71 DISALLOW_COPY_AND_ASSIGN(BlimpMessagePump); | 79 DISALLOW_COPY_AND_ASSIGN(BlimpMessagePump); |
72 }; | 80 }; |
73 | 81 |
74 } // namespace blimp | 82 } // namespace blimp |
75 | 83 |
76 #endif // BLIMP_NET_BLIMP_MESSAGE_PUMP_H_ | 84 #endif // BLIMP_NET_BLIMP_MESSAGE_PUMP_H_ |
OLD | NEW |