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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 // The protobuf of the message itself. | 120 // The protobuf of the message itself. |
121 MCSProto protobuf; | 121 MCSProto protobuf; |
122 }; | 122 }; |
123 | 123 |
124 ReliablePacketInfo::ReliablePacketInfo() | 124 ReliablePacketInfo::ReliablePacketInfo() |
125 : stream_id(0), tag(0) { | 125 : stream_id(0), tag(0) { |
126 } | 126 } |
127 ReliablePacketInfo::~ReliablePacketInfo() {} | 127 ReliablePacketInfo::~ReliablePacketInfo() {} |
128 | 128 |
| 129 std::string MCSClient::GetStateString(State state) { |
| 130 switch(state) { |
| 131 case UNINITIALIZED: |
| 132 return "UNINITIALIZED"; |
| 133 case LOADED: |
| 134 return "LOADED"; |
| 135 case CONNECTING: |
| 136 return "CONNECTING"; |
| 137 case CONNECTED: |
| 138 return "CONNECTED"; |
| 139 } |
| 140 return std::string(); |
| 141 } |
| 142 |
129 MCSClient::MCSClient(const std::string& version_string, | 143 MCSClient::MCSClient(const std::string& version_string, |
130 base::Clock* clock, | 144 base::Clock* clock, |
131 ConnectionFactory* connection_factory, | 145 ConnectionFactory* connection_factory, |
132 GCMStore* gcm_store) | 146 GCMStore* gcm_store) |
133 : version_string_(version_string), | 147 : version_string_(version_string), |
134 clock_(clock), | 148 clock_(clock), |
135 state_(UNINITIALIZED), | 149 state_(UNINITIALIZED), |
136 android_id_(0), | 150 android_id_(0), |
137 security_token_(0), | 151 security_token_(0), |
138 connection_factory_(connection_factory), | 152 connection_factory_(connection_factory), |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 reinterpret_cast<mcs_proto::DataMessageStanza*>(packet->protobuf.get()); | 859 reinterpret_cast<mcs_proto::DataMessageStanza*>(packet->protobuf.get()); |
846 CollapseKey collapse_key(*data_message); | 860 CollapseKey collapse_key(*data_message); |
847 if (collapse_key.IsValid()) | 861 if (collapse_key.IsValid()) |
848 collapse_key_map_.erase(collapse_key); | 862 collapse_key_map_.erase(collapse_key); |
849 } | 863 } |
850 | 864 |
851 return packet; | 865 return packet; |
852 } | 866 } |
853 | 867 |
854 } // namespace gcm | 868 } // namespace gcm |
OLD | NEW |