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 "mojo/edk/system/data_pipe_consumer_dispatcher.h" | 5 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 520 |
521 ports::PortStatus port_status; | 521 ports::PortStatus port_status; |
522 int rv = node_controller_->node()->GetStatus(control_port_, &port_status); | 522 int rv = node_controller_->node()->GetStatus(control_port_, &port_status); |
523 if (rv != ports::OK || !port_status.receiving_messages) { | 523 if (rv != ports::OK || !port_status.receiving_messages) { |
524 DVLOG(1) << "Data pipe consumer " << pipe_id_ << " is aware of peer closure" | 524 DVLOG(1) << "Data pipe consumer " << pipe_id_ << " is aware of peer closure" |
525 << " [control_port=" << control_port_.name() << "]"; | 525 << " [control_port=" << control_port_.name() << "]"; |
526 peer_closed_ = true; | 526 peer_closed_ = true; |
527 } else if (rv == ports::OK && port_status.has_messages && !in_transit_) { | 527 } else if (rv == ports::OK && port_status.has_messages && !in_transit_) { |
528 ports::ScopedMessage message; | 528 ports::ScopedMessage message; |
529 do { | 529 do { |
530 int rv = node_controller_->node()->GetMessageIf(control_port_, nullptr, | 530 int rv = node_controller_->node()->GetMessage( |
531 &message); | 531 control_port_, &message, nullptr); |
532 if (rv != ports::OK) | 532 if (rv != ports::OK) |
533 peer_closed_ = true; | 533 peer_closed_ = true; |
534 if (message) { | 534 if (message) { |
535 if (message->num_payload_bytes() < sizeof(DataPipeControlMessage)) { | 535 if (message->num_payload_bytes() < sizeof(DataPipeControlMessage)) { |
536 peer_closed_ = true; | 536 peer_closed_ = true; |
537 break; | 537 break; |
538 } | 538 } |
539 | 539 |
540 const DataPipeControlMessage* m = | 540 const DataPipeControlMessage* m = |
541 static_cast<const DataPipeControlMessage*>( | 541 static_cast<const DataPipeControlMessage*>( |
(...skipping 22 matching lines...) Expand all Loading... |
564 } | 564 } |
565 | 565 |
566 if (peer_closed_ != was_peer_closed || | 566 if (peer_closed_ != was_peer_closed || |
567 bytes_available_ != previous_bytes_available) { | 567 bytes_available_ != previous_bytes_available) { |
568 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); | 568 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); |
569 } | 569 } |
570 } | 570 } |
571 | 571 |
572 } // namespace edk | 572 } // namespace edk |
573 } // namespace mojo | 573 } // namespace mojo |
OLD | NEW |