| 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 326 |
| 327 to_send_.push_back(make_linked_ptr(packet_info.release())); | 327 to_send_.push_back(make_linked_ptr(packet_info.release())); |
| 328 | 328 |
| 329 // Notify that the messages has been succsfully queued for sending. | 329 // Notify that the messages has been succsfully queued for sending. |
| 330 // TODO(jianli): We should report QUEUED after writing to GCM store succeeds. | 330 // TODO(jianli): We should report QUEUED after writing to GCM store succeeds. |
| 331 NotifyMessageSendStatus(message.GetProtobuf(), QUEUED); | 331 NotifyMessageSendStatus(message.GetProtobuf(), QUEUED); |
| 332 | 332 |
| 333 MaybeSendMessage(); | 333 MaybeSendMessage(); |
| 334 } | 334 } |
| 335 | 335 |
| 336 void MCSClient::Destroy() { | |
| 337 gcm_store_->Destroy(base::Bind(&MCSClient::OnGCMUpdateFinished, | |
| 338 weak_ptr_factory_.GetWeakPtr())); | |
| 339 } | |
| 340 | |
| 341 void MCSClient::ResetStateAndBuildLoginRequest( | 336 void MCSClient::ResetStateAndBuildLoginRequest( |
| 342 mcs_proto::LoginRequest* request) { | 337 mcs_proto::LoginRequest* request) { |
| 343 DCHECK(android_id_); | 338 DCHECK(android_id_); |
| 344 DCHECK(security_token_); | 339 DCHECK(security_token_); |
| 345 stream_id_in_ = 0; | 340 stream_id_in_ = 0; |
| 346 stream_id_out_ = 1; | 341 stream_id_out_ = 1; |
| 347 last_device_to_server_stream_id_received_ = 0; | 342 last_device_to_server_stream_id_received_ = 0; |
| 348 last_server_to_device_stream_id_received_ = 0; | 343 last_server_to_device_stream_id_received_ = 0; |
| 349 | 344 |
| 350 heartbeat_manager_.Stop(); | 345 heartbeat_manager_.Stop(); |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 reinterpret_cast<mcs_proto::DataMessageStanza*>(packet->protobuf.get()); | 836 reinterpret_cast<mcs_proto::DataMessageStanza*>(packet->protobuf.get()); |
| 842 CollapseKey collapse_key(*data_message); | 837 CollapseKey collapse_key(*data_message); |
| 843 if (collapse_key.IsValid()) | 838 if (collapse_key.IsValid()) |
| 844 collapse_key_map_.erase(collapse_key); | 839 collapse_key_map_.erase(collapse_key); |
| 845 } | 840 } |
| 846 | 841 |
| 847 return packet; | 842 return packet; |
| 848 } | 843 } |
| 849 | 844 |
| 850 } // namespace gcm | 845 } // namespace gcm |
| OLD | NEW |