Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/net/blimp_message_checkpointer.h" | 5 #include "blimp/net/blimp_message_checkpointer.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "blimp/common/create_blimp_message.h" | 8 #include "blimp/common/create_blimp_message.h" |
| 9 #include "blimp/common/proto/blimp_message.pb.h" | 9 #include "blimp/common/proto/blimp_message.pb.h" |
| 10 #include "blimp/common/proto/protocol_control.pb.h" | 10 #include "blimp/common/proto/protocol_control.pb.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 DCHECK(incoming_processor_); | 28 DCHECK(incoming_processor_); |
| 29 DCHECK(outgoing_processor_); | 29 DCHECK(outgoing_processor_); |
| 30 DCHECK(checkpoint_observer_); | 30 DCHECK(checkpoint_observer_); |
| 31 } | 31 } |
| 32 | 32 |
| 33 BlimpMessageCheckpointer::~BlimpMessageCheckpointer() {} | 33 BlimpMessageCheckpointer::~BlimpMessageCheckpointer() {} |
| 34 | 34 |
| 35 void BlimpMessageCheckpointer::ProcessMessage( | 35 void BlimpMessageCheckpointer::ProcessMessage( |
| 36 std::unique_ptr<BlimpMessage> message, | 36 std::unique_ptr<BlimpMessage> message, |
| 37 const net::CompletionCallback& callback) { | 37 const net::CompletionCallback& callback) { |
| 38 if (message->type() == BlimpMessage::PROTOCOL_CONTROL && | 38 if (message->has_protocol_control() && |
|
Kevin M
2016/05/02 17:47:48
Check the case
shaktisahu
2016/05/16 20:19:02
I am checking the case it only in DCHECK
| |
| 39 message->protocol_control().type() == | 39 message->protocol_control().type() == |
| 40 ProtocolControlMessage::CHECKPOINT_ACK) { | 40 ProtocolControlMessage::CHECKPOINT_ACK) { |
| 41 if (message->protocol_control().has_checkpoint_ack() && | 41 if (message->protocol_control().has_checkpoint_ack() && |
| 42 message->protocol_control().checkpoint_ack().has_checkpoint_id()) { | 42 message->protocol_control().checkpoint_ack().has_checkpoint_id()) { |
| 43 checkpoint_observer_->OnMessageCheckpoint( | 43 checkpoint_observer_->OnMessageCheckpoint( |
| 44 message->protocol_control().checkpoint_ack().checkpoint_id()); | 44 message->protocol_control().checkpoint_ack().checkpoint_id()); |
| 45 callback.Run(net::OK); | 45 callback.Run(net::OK); |
| 46 } else { | 46 } else { |
| 47 DLOG(WARNING) << "Invalid checkpoint ACK. Dropping connection."; | 47 DLOG(WARNING) << "Invalid checkpoint ACK. Dropping connection."; |
| 48 callback.Run(net::ERR_FAILED); | 48 callback.Run(net::ERR_FAILED); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 76 int result) { | 76 int result) { |
| 77 callback.Run(result); | 77 callback.Run(result); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void BlimpMessageCheckpointer::SendCheckpointAck() { | 80 void BlimpMessageCheckpointer::SendCheckpointAck() { |
| 81 outgoing_processor_->ProcessMessage( | 81 outgoing_processor_->ProcessMessage( |
| 82 CreateCheckpointAckMessage(checkpoint_id_), net::CompletionCallback()); | 82 CreateCheckpointAckMessage(checkpoint_id_), net::CompletionCallback()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace blimp | 85 } // namespace blimp |
| OLD | NEW |