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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 void DataPipeConsumerDispatcher::NotifyRead(uint32_t num_bytes) { | 488 void DataPipeConsumerDispatcher::NotifyRead(uint32_t num_bytes) { |
489 DVLOG(1) << "Data pipe consumer " << pipe_id_ << " notifying peer: " | 489 DVLOG(1) << "Data pipe consumer " << pipe_id_ << " notifying peer: " |
490 << num_bytes << " bytes read. [control_port=" | 490 << num_bytes << " bytes read. [control_port=" |
491 << control_port_.name() << "]"; | 491 << control_port_.name() << "]"; |
492 | 492 |
493 SendDataPipeControlMessage(node_controller_, control_port_, | 493 SendDataPipeControlMessage(node_controller_, control_port_, |
494 DataPipeCommand::DATA_WAS_READ, num_bytes); | 494 DataPipeCommand::DATA_WAS_READ, num_bytes); |
495 } | 495 } |
496 | 496 |
497 void DataPipeConsumerDispatcher::OnPortStatusChanged() { | 497 void DataPipeConsumerDispatcher::OnPortStatusChanged() { |
498 // This has to be outside |lock_| because the watch callback can call data | 498 DCHECK(RequestContext::current()); |
499 // pipe functions which then try to acquire |lock_|. | |
500 RequestContext request_context; | |
501 | 499 |
502 base::AutoLock lock(lock_); | 500 base::AutoLock lock(lock_); |
503 | 501 |
504 // We stop observing the control port as soon it's transferred, but this can | 502 // We stop observing the control port as soon it's transferred, but this can |
505 // race with events which are raised right before that happens. This is fine | 503 // race with events which are raised right before that happens. This is fine |
506 // to ignore. | 504 // to ignore. |
507 if (transferred_) | 505 if (transferred_) |
508 return; | 506 return; |
509 | 507 |
510 DVLOG(1) << "Control port status changed for data pipe producer " << pipe_id_; | 508 DVLOG(1) << "Control port status changed for data pipe producer " << pipe_id_; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 } | 561 } |
564 | 562 |
565 if (peer_closed_ != was_peer_closed || | 563 if (peer_closed_ != was_peer_closed || |
566 bytes_available_ != previous_bytes_available) { | 564 bytes_available_ != previous_bytes_available) { |
567 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); | 565 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); |
568 } | 566 } |
569 } | 567 } |
570 | 568 |
571 } // namespace edk | 569 } // namespace edk |
572 } // namespace mojo | 570 } // namespace mojo |
OLD | NEW |