OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_IMPL_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_IMPL_H_ |
6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_IMPL_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_IMPL_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <vector> | 10 #include <vector> |
9 | 11 |
| 12 #include "base/macros.h" |
10 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
11 #include "base/time/time.h" | 14 #include "base/time/time.h" |
12 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
13 #include "google_apis/gcm/engine/connection_handler.h" | 16 #include "google_apis/gcm/engine/connection_handler.h" |
14 | 17 |
15 namespace mcs_proto { | 18 namespace mcs_proto { |
16 class LoginRequest; | 19 class LoginRequest; |
17 } // namespace mcs_proto | 20 } // namespace mcs_proto |
18 | 21 |
19 namespace gcm { | 22 namespace gcm { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // This connection's socket and the input/output streams attached to it. | 101 // This connection's socket and the input/output streams attached to it. |
99 net::StreamSocket* socket_; | 102 net::StreamSocket* socket_; |
100 scoped_ptr<SocketInputStream> input_stream_; | 103 scoped_ptr<SocketInputStream> input_stream_; |
101 scoped_ptr<SocketOutputStream> output_stream_; | 104 scoped_ptr<SocketOutputStream> output_stream_; |
102 | 105 |
103 // Whether the MCS login handshake has successfully completed. See Init(..) | 106 // Whether the MCS login handshake has successfully completed. See Init(..) |
104 // description for more info on what the handshake involves. | 107 // description for more info on what the handshake involves. |
105 bool handshake_complete_; | 108 bool handshake_complete_; |
106 | 109 |
107 // State for the message currently being processed, if there is one. | 110 // State for the message currently being processed, if there is one. |
108 uint8 message_tag_; | 111 uint8_t message_tag_; |
109 uint32 message_size_; | 112 uint32_t message_size_; |
110 | 113 |
111 ProtoReceivedCallback read_callback_; | 114 ProtoReceivedCallback read_callback_; |
112 ProtoSentCallback write_callback_; | 115 ProtoSentCallback write_callback_; |
113 ConnectionChangedCallback connection_callback_; | 116 ConnectionChangedCallback connection_callback_; |
114 | 117 |
115 // The number of bytes of the size packet read so far without finishing the | 118 // The number of bytes of the size packet read so far without finishing the |
116 // read. This can be up to but no larger than 5 (the max number of bytes for | 119 // read. This can be up to but no larger than 5 (the max number of bytes for |
117 // a varint32). | 120 // a varint32). |
118 uint8 size_packet_so_far_; | 121 uint8_t size_packet_so_far_; |
119 // A temporary input buffer for holding large messages. Will hold | 122 // A temporary input buffer for holding large messages. Will hold |
120 // message_size_ bytes for messages larger than the normal size limit (and | 123 // message_size_ bytes for messages larger than the normal size limit (and |
121 // will be empty otherwise). | 124 // will be empty otherwise). |
122 std::vector<uint8> payload_input_buffer_; | 125 std::vector<uint8_t> payload_input_buffer_; |
123 | 126 |
124 base::WeakPtrFactory<ConnectionHandlerImpl> weak_ptr_factory_; | 127 base::WeakPtrFactory<ConnectionHandlerImpl> weak_ptr_factory_; |
125 | 128 |
126 DISALLOW_COPY_AND_ASSIGN(ConnectionHandlerImpl); | 129 DISALLOW_COPY_AND_ASSIGN(ConnectionHandlerImpl); |
127 }; | 130 }; |
128 | 131 |
129 } // namespace gcm | 132 } // namespace gcm |
130 | 133 |
131 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_IMPL_H_ | 134 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_IMPL_H_ |
OLD | NEW |