| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 : options_(options), | 109 : options_(options), |
| 110 channel_(nullptr), | 110 channel_(nullptr), |
| 111 calling_init_(false), | 111 calling_init_(false), |
| 112 in_two_phase_read_(false), | 112 in_two_phase_read_(false), |
| 113 two_phase_max_bytes_read_(0), | 113 two_phase_max_bytes_read_(0), |
| 114 error_(false), | 114 error_(false), |
| 115 serialized_(false) { | 115 serialized_(false) { |
| 116 } | 116 } |
| 117 | 117 |
| 118 DataPipeConsumerDispatcher::~DataPipeConsumerDispatcher() { | 118 DataPipeConsumerDispatcher::~DataPipeConsumerDispatcher() { |
| 119 // |Close()|/|CloseImplNoLock()| should have taken care of the channel. | 119 // See comment in ~MessagePipeDispatcher. |
| 120 DCHECK(!channel_); | 120 if (channel_ && internal::g_io_thread_task_runner->RunsTasksOnCurrentThread()) |
| 121 channel_->Shutdown(); |
| 122 else |
| 123 DCHECK(!channel_); |
| 121 } | 124 } |
| 122 | 125 |
| 123 void DataPipeConsumerDispatcher::CancelAllAwakablesNoLock() { | 126 void DataPipeConsumerDispatcher::CancelAllAwakablesNoLock() { |
| 124 lock().AssertAcquired(); | 127 lock().AssertAcquired(); |
| 125 awakable_list_.CancelAll(); | 128 awakable_list_.CancelAll(); |
| 126 } | 129 } |
| 127 | 130 |
| 128 void DataPipeConsumerDispatcher::CloseImplNoLock() { | 131 void DataPipeConsumerDispatcher::CloseImplNoLock() { |
| 129 lock().AssertAcquired(); | 132 lock().AssertAcquired(); |
| 130 internal::g_io_thread_task_runner->PostTask( | 133 internal::g_io_thread_task_runner->PostTask( |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 CHECK(!write_error) << "DataPipeConsumerDispatcher doesn't write."; | 492 CHECK(!write_error) << "DataPipeConsumerDispatcher doesn't write."; |
| 490 | 493 |
| 491 channel_ = nullptr; | 494 channel_ = nullptr; |
| 492 } | 495 } |
| 493 | 496 |
| 494 serialized_ = true; | 497 serialized_ = true; |
| 495 } | 498 } |
| 496 | 499 |
| 497 } // namespace edk | 500 } // namespace edk |
| 498 } // namespace mojo | 501 } // namespace mojo |
| OLD | NEW |