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 #include "google_apis/gcm/engine/mcs_client.h" | 5 #include "google_apis/gcm/engine/mcs_client.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 | 121 |
122 // The protobuf of the message itself. | 122 // The protobuf of the message itself. |
123 MCSProto protobuf; | 123 MCSProto protobuf; |
124 }; | 124 }; |
125 | 125 |
126 ReliablePacketInfo::ReliablePacketInfo() | 126 ReliablePacketInfo::ReliablePacketInfo() |
127 : stream_id(0), tag(0) { | 127 : stream_id(0), tag(0) { |
128 } | 128 } |
129 ReliablePacketInfo::~ReliablePacketInfo() {} | 129 ReliablePacketInfo::~ReliablePacketInfo() {} |
130 | 130 |
131 std::string MCSClient::GetStateString() const { | |
132 switch(state_) { | |
133 case UNINITIALIZED: | |
134 return "UNINITIALIZED"; | |
135 case LOADED: | |
136 return "LOADED"; | |
137 case CONNECTING: | |
138 return "CONNECTING"; | |
139 case CONNECTED: | |
140 return "CONNECTED"; | |
141 default: | |
142 return std::string(); | |
jianli
2014/03/06 01:55:21
ditto
juyik
2014/03/06 02:23:59
Done.
| |
143 } | |
144 } | |
145 | |
131 MCSClient::MCSClient(const std::string& version_string, | 146 MCSClient::MCSClient(const std::string& version_string, |
132 base::Clock* clock, | 147 base::Clock* clock, |
133 ConnectionFactory* connection_factory, | 148 ConnectionFactory* connection_factory, |
134 GCMStore* gcm_store) | 149 GCMStore* gcm_store) |
135 : version_string_(version_string), | 150 : version_string_(version_string), |
136 clock_(clock), | 151 clock_(clock), |
137 state_(UNINITIALIZED), | 152 state_(UNINITIALIZED), |
138 android_id_(0), | 153 android_id_(0), |
139 security_token_(0), | 154 security_token_(0), |
140 connection_factory_(connection_factory), | 155 connection_factory_(connection_factory), |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
866 reinterpret_cast<mcs_proto::DataMessageStanza*>(packet->protobuf.get()); | 881 reinterpret_cast<mcs_proto::DataMessageStanza*>(packet->protobuf.get()); |
867 CollapseKey collapse_key(*data_message); | 882 CollapseKey collapse_key(*data_message); |
868 if (collapse_key.IsValid()) | 883 if (collapse_key.IsValid()) |
869 collapse_key_map_.erase(collapse_key); | 884 collapse_key_map_.erase(collapse_key); |
870 } | 885 } |
871 | 886 |
872 return packet; | 887 return packet; |
873 } | 888 } |
874 | 889 |
875 } // namespace gcm | 890 } // namespace gcm |
OLD | NEW |