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(State state) { |
| 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 } |
| 142 return std::string(); |
| 143 } |
| 144 |
131 MCSClient::MCSClient(const std::string& version_string, | 145 MCSClient::MCSClient(const std::string& version_string, |
132 base::Clock* clock, | 146 base::Clock* clock, |
133 ConnectionFactory* connection_factory, | 147 ConnectionFactory* connection_factory, |
134 GCMStore* gcm_store) | 148 GCMStore* gcm_store) |
135 : version_string_(version_string), | 149 : version_string_(version_string), |
136 clock_(clock), | 150 clock_(clock), |
137 state_(UNINITIALIZED), | 151 state_(UNINITIALIZED), |
138 android_id_(0), | 152 android_id_(0), |
139 security_token_(0), | 153 security_token_(0), |
140 connection_factory_(connection_factory), | 154 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()); | 880 reinterpret_cast<mcs_proto::DataMessageStanza*>(packet->protobuf.get()); |
867 CollapseKey collapse_key(*data_message); | 881 CollapseKey collapse_key(*data_message); |
868 if (collapse_key.IsValid()) | 882 if (collapse_key.IsValid()) |
869 collapse_key_map_.erase(collapse_key); | 883 collapse_key_map_.erase(collapse_key); |
870 } | 884 } |
871 | 885 |
872 return packet; | 886 return packet; |
873 } | 887 } |
874 | 888 |
875 } // namespace gcm | 889 } // namespace gcm |
OLD | NEW |