| 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 "mojo/edk/system/message_pipe_dispatcher.h" | 5 #include "mojo/edk/system/message_pipe_dispatcher.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 PlatformHandle* handles) { | 480 PlatformHandle* handles) { |
| 481 SerializedState* state = static_cast<SerializedState*>(destination); | 481 SerializedState* state = static_cast<SerializedState*>(destination); |
| 482 state->pipe_id = pipe_id_; | 482 state->pipe_id = pipe_id_; |
| 483 state->endpoint = static_cast<int8_t>(endpoint_); | 483 state->endpoint = static_cast<int8_t>(endpoint_); |
| 484 ports[0] = port_.name(); | 484 ports[0] = port_.name(); |
| 485 return true; | 485 return true; |
| 486 } | 486 } |
| 487 | 487 |
| 488 bool MessagePipeDispatcher::BeginTransit() { | 488 bool MessagePipeDispatcher::BeginTransit() { |
| 489 base::AutoLock lock(signal_lock_); | 489 base::AutoLock lock(signal_lock_); |
| 490 if (in_transit_) | 490 if (in_transit_ || port_closed_) |
| 491 return false; | 491 return false; |
| 492 in_transit_ = true; | 492 in_transit_ = true; |
| 493 return in_transit_; | 493 return in_transit_; |
| 494 } | 494 } |
| 495 | 495 |
| 496 void MessagePipeDispatcher::CompleteTransitAndClose() { | 496 void MessagePipeDispatcher::CompleteTransitAndClose() { |
| 497 node_controller_->SetPortObserver(port_, nullptr); | 497 node_controller_->SetPortObserver(port_, nullptr); |
| 498 | 498 |
| 499 base::AutoLock lock(signal_lock_); | 499 base::AutoLock lock(signal_lock_); |
| 500 in_transit_ = false; | 500 in_transit_ = false; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 DVLOG(1) << "Peer closure detected on message pipe " << pipe_id_ | 606 DVLOG(1) << "Peer closure detected on message pipe " << pipe_id_ |
| 607 << " endpoint " << endpoint_ << " [port=" << port_.name() << "]"; | 607 << " endpoint " << endpoint_ << " [port=" << port_.name() << "]"; |
| 608 } | 608 } |
| 609 #endif | 609 #endif |
| 610 | 610 |
| 611 awakables_.AwakeForStateChange(GetHandleSignalsStateNoLock()); | 611 awakables_.AwakeForStateChange(GetHandleSignalsStateNoLock()); |
| 612 } | 612 } |
| 613 | 613 |
| 614 } // namespace edk | 614 } // namespace edk |
| 615 } // namespace mojo | 615 } // namespace mojo |
| OLD | NEW |