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_producer_dispatcher.h" | 5 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 void DataPipeProducerDispatcher::NotifyWrite(uint32_t num_bytes) { | 466 void DataPipeProducerDispatcher::NotifyWrite(uint32_t num_bytes) { |
467 DVLOG(1) << "Data pipe producer " << pipe_id_ << " notifying peer: " | 467 DVLOG(1) << "Data pipe producer " << pipe_id_ << " notifying peer: " |
468 << num_bytes << " bytes written. [control_port=" | 468 << num_bytes << " bytes written. [control_port=" |
469 << control_port_.name() << "]"; | 469 << control_port_.name() << "]"; |
470 | 470 |
471 SendDataPipeControlMessage(node_controller_, control_port_, | 471 SendDataPipeControlMessage(node_controller_, control_port_, |
472 DataPipeCommand::DATA_WAS_WRITTEN, num_bytes); | 472 DataPipeCommand::DATA_WAS_WRITTEN, num_bytes); |
473 } | 473 } |
474 | 474 |
475 void DataPipeProducerDispatcher::OnPortStatusChanged() { | 475 void DataPipeProducerDispatcher::OnPortStatusChanged() { |
476 // This has to be outside |lock_| because the watch callback can call data | 476 DCHECK(RequestContext::current()); |
477 // pipe functions which then try to acquire |lock_|. | 477 |
478 RequestContext request_context; | |
479 base::AutoLock lock(lock_); | 478 base::AutoLock lock(lock_); |
480 | 479 |
481 // We stop observing the control port as soon it's transferred, but this can | 480 // We stop observing the control port as soon it's transferred, but this can |
482 // race with events which are raised right before that happens. This is fine | 481 // race with events which are raised right before that happens. This is fine |
483 // to ignore. | 482 // to ignore. |
484 if (transferred_) | 483 if (transferred_) |
485 return; | 484 return; |
486 | 485 |
487 DVLOG(1) << "Control port status changed for data pipe producer " << pipe_id_; | 486 DVLOG(1) << "Control port status changed for data pipe producer " << pipe_id_; |
488 | 487 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 } | 539 } |
541 | 540 |
542 if (peer_closed_ != was_peer_closed || | 541 if (peer_closed_ != was_peer_closed || |
543 available_capacity_ != previous_capacity) { | 542 available_capacity_ != previous_capacity) { |
544 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); | 543 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); |
545 } | 544 } |
546 } | 545 } |
547 | 546 |
548 } // namespace edk | 547 } // namespace edk |
549 } // namespace mojo | 548 } // namespace mojo |
OLD | NEW |