| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "mojo/edk/embedder/embedder_internal.h" | 10 #include "mojo/edk/embedder/embedder_internal.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 serialized_write_buffer_size); | 79 serialized_write_buffer_size); |
| 80 return rv; | 80 return rv; |
| 81 } | 81 } |
| 82 | 82 |
| 83 DataPipeProducerDispatcher::DataPipeProducerDispatcher( | 83 DataPipeProducerDispatcher::DataPipeProducerDispatcher( |
| 84 const MojoCreateDataPipeOptions& options) | 84 const MojoCreateDataPipeOptions& options) |
| 85 : options_(options), channel_(nullptr), error_(false), serialized_(false) { | 85 : options_(options), channel_(nullptr), error_(false), serialized_(false) { |
| 86 } | 86 } |
| 87 | 87 |
| 88 DataPipeProducerDispatcher::~DataPipeProducerDispatcher() { | 88 DataPipeProducerDispatcher::~DataPipeProducerDispatcher() { |
| 89 // |Close()|/|CloseImplNoLock()| should have taken care of the channel. | 89 // See comment in ~MessagePipeDispatcher. |
| 90 DCHECK(!channel_); | 90 if (channel_ && internal::g_io_thread_task_runner->RunsTasksOnCurrentThread()) |
| 91 channel_->Shutdown(); |
| 92 else |
| 93 DCHECK(!channel_); |
| 91 } | 94 } |
| 92 | 95 |
| 93 void DataPipeProducerDispatcher::CancelAllAwakablesNoLock() { | 96 void DataPipeProducerDispatcher::CancelAllAwakablesNoLock() { |
| 94 lock().AssertAcquired(); | 97 lock().AssertAcquired(); |
| 95 awakable_list_.CancelAll(); | 98 awakable_list_.CancelAll(); |
| 96 } | 99 } |
| 97 | 100 |
| 98 void DataPipeProducerDispatcher::CloseImplNoLock() { | 101 void DataPipeProducerDispatcher::CloseImplNoLock() { |
| 99 lock().AssertAcquired(); | 102 lock().AssertAcquired(); |
| 100 internal::g_io_thread_task_runner->PostTask( | 103 internal::g_io_thread_task_runner->PostTask( |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 CHECK(fds.empty()); | 398 CHECK(fds.empty()); |
| 396 if (write_error) | 399 if (write_error) |
| 397 serialized_platform_handle_.reset(); | 400 serialized_platform_handle_.reset(); |
| 398 channel_ = nullptr; | 401 channel_ = nullptr; |
| 399 } | 402 } |
| 400 serialized_ = true; | 403 serialized_ = true; |
| 401 } | 404 } |
| 402 | 405 |
| 403 } // namespace edk | 406 } // namespace edk |
| 404 } // namespace mojo | 407 } // namespace mojo |
| OLD | NEW |