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 "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // encountered. | 27 // encountered. |
28 ConnectionHandlerImpl( | 28 ConnectionHandlerImpl( |
29 base::TimeDelta read_timeout, | 29 base::TimeDelta read_timeout, |
30 const ProtoReceivedCallback& read_callback, | 30 const ProtoReceivedCallback& read_callback, |
31 const ProtoSentCallback& write_callback, | 31 const ProtoSentCallback& write_callback, |
32 const ConnectionChangedCallback& connection_callback); | 32 const ConnectionChangedCallback& connection_callback); |
33 virtual ~ConnectionHandlerImpl(); | 33 virtual ~ConnectionHandlerImpl(); |
34 | 34 |
35 // ConnectionHandler implementation. | 35 // ConnectionHandler implementation. |
36 virtual void Init(const mcs_proto::LoginRequest& login_request, | 36 virtual void Init(const mcs_proto::LoginRequest& login_request, |
37 net::StreamSocket* socket) OVERRIDE; | 37 net::StreamSocket* socket) override; |
38 virtual void Reset() OVERRIDE; | 38 virtual void Reset() override; |
39 virtual bool CanSendMessage() const OVERRIDE; | 39 virtual bool CanSendMessage() const override; |
40 virtual void SendMessage(const google::protobuf::MessageLite& message) | 40 virtual void SendMessage(const google::protobuf::MessageLite& message) |
41 OVERRIDE; | 41 override; |
42 | 42 |
43 private: | 43 private: |
44 // State machine for handling incoming data. See WaitForData(..) for usage. | 44 // State machine for handling incoming data. See WaitForData(..) for usage. |
45 enum ProcessingState { | 45 enum ProcessingState { |
46 // Processing the version, tag, and size packets (assuming minimum length | 46 // Processing the version, tag, and size packets (assuming minimum length |
47 // size packet). Only used during the login handshake. | 47 // size packet). Only used during the login handshake. |
48 MCS_VERSION_TAG_AND_SIZE = 0, | 48 MCS_VERSION_TAG_AND_SIZE = 0, |
49 // Processing the tag and size packets (assuming minimum length size | 49 // Processing the tag and size packets (assuming minimum length size |
50 // packet). Used for normal messages. | 50 // packet). Used for normal messages. |
51 MCS_TAG_AND_SIZE, | 51 MCS_TAG_AND_SIZE, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 ConnectionChangedCallback connection_callback_; | 114 ConnectionChangedCallback connection_callback_; |
115 | 115 |
116 base::WeakPtrFactory<ConnectionHandlerImpl> weak_ptr_factory_; | 116 base::WeakPtrFactory<ConnectionHandlerImpl> weak_ptr_factory_; |
117 | 117 |
118 DISALLOW_COPY_AND_ASSIGN(ConnectionHandlerImpl); | 118 DISALLOW_COPY_AND_ASSIGN(ConnectionHandlerImpl); |
119 }; | 119 }; |
120 | 120 |
121 } // namespace gcm | 121 } // namespace gcm |
122 | 122 |
123 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_IMPL_H_ | 123 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_IMPL_H_ |
OLD | NEW |