Chromium Code Reviews| 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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 518 size_t previous_bytes_available = bytes_available_; | 518 size_t previous_bytes_available = bytes_available_; |
| 519 | 519 |
| 520 ports::PortStatus port_status; | 520 ports::PortStatus port_status; |
| 521 if (node_controller_->node()->GetStatus(control_port_, &port_status) != | 521 if (node_controller_->node()->GetStatus(control_port_, &port_status) != |
| 522 ports::OK || | 522 ports::OK || |
| 523 !port_status.receiving_messages) { | 523 !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 | 526 |
| 527 peer_closed_ = true; | 527 peer_closed_ = true; |
| 528 } | 528 } else if (port_status.has_messages && !in_transit_) { |
|
Anand Mistry (off Chromium)
2016/05/04 00:50:03
I'm still pushing back on this construct because I
Ken Rockot(use gerrit already)
2016/05/04 02:57:05
done
| |
| 529 | |
| 530 if (port_status.has_messages && !in_transit_) { | |
| 531 ports::ScopedMessage message; | 529 ports::ScopedMessage message; |
| 532 do { | 530 do { |
| 533 int rv = node_controller_->node()->GetMessageIf(control_port_, nullptr, | 531 int rv = node_controller_->node()->GetMessageIf(control_port_, nullptr, |
| 534 &message); | 532 &message); |
| 535 if (rv != ports::OK) | 533 if (rv != ports::OK) |
| 536 peer_closed_ = true; | 534 peer_closed_ = true; |
| 537 if (message) { | 535 if (message) { |
| 538 const DataPipeControlMessage* m = | 536 const DataPipeControlMessage* m = |
| 539 static_cast<const DataPipeControlMessage*>( | 537 static_cast<const DataPipeControlMessage*>( |
| 540 message->payload_bytes()); | 538 message->payload_bytes()); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 562 } | 560 } |
| 563 | 561 |
| 564 if (peer_closed_ != was_peer_closed || | 562 if (peer_closed_ != was_peer_closed || |
| 565 bytes_available_ != previous_bytes_available) { | 563 bytes_available_ != previous_bytes_available) { |
| 566 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); | 564 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); |
| 567 } | 565 } |
| 568 } | 566 } |
| 569 | 567 |
| 570 } // namespace edk | 568 } // namespace edk |
| 571 } // namespace mojo | 569 } // namespace mojo |
| OLD | NEW |