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