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/message_pipe.h" | 5 #include "mojo/edk/system/message_pipe.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "mojo/edk/system/channel.h" | 11 #include "mojo/edk/system/channel.h" |
12 #include "mojo/edk/system/channel_endpoint.h" | 12 #include "mojo/edk/system/channel_endpoint.h" |
13 #include "mojo/edk/system/channel_endpoint_id.h" | 13 #include "mojo/edk/system/channel_endpoint_id.h" |
| 14 #include "mojo/edk/system/handle_transport.h" |
14 #include "mojo/edk/system/incoming_endpoint.h" | 15 #include "mojo/edk/system/incoming_endpoint.h" |
15 #include "mojo/edk/system/local_message_pipe_endpoint.h" | 16 #include "mojo/edk/system/local_message_pipe_endpoint.h" |
16 #include "mojo/edk/system/message_in_transit.h" | 17 #include "mojo/edk/system/message_in_transit.h" |
17 #include "mojo/edk/system/message_pipe_dispatcher.h" | 18 #include "mojo/edk/system/message_pipe_dispatcher.h" |
18 #include "mojo/edk/system/message_pipe_endpoint.h" | 19 #include "mojo/edk/system/message_pipe_endpoint.h" |
19 #include "mojo/edk/system/proxy_message_pipe_endpoint.h" | 20 #include "mojo/edk/system/proxy_message_pipe_endpoint.h" |
20 #include "mojo/edk/util/make_unique.h" | 21 #include "mojo/edk/util/make_unique.h" |
21 | 22 |
22 using mojo::platform::ScopedPlatformHandle; | 23 using mojo::platform::ScopedPlatformHandle; |
23 using mojo::util::MakeRefCounted; | 24 using mojo::util::MakeRefCounted; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 GetPeerPort(port), std::unique_ptr<MessageInTransit>(message), nullptr); | 311 GetPeerPort(port), std::unique_ptr<MessageInTransit>(message), nullptr); |
311 DLOG_IF(WARNING, result != MOJO_RESULT_OK) | 312 DLOG_IF(WARNING, result != MOJO_RESULT_OK) |
312 << "EnqueueMessageNoLock() failed (result = " << result << ")"; | 313 << "EnqueueMessageNoLock() failed (result = " << result << ")"; |
313 return true; | 314 return true; |
314 } | 315 } |
315 | 316 |
316 void MessagePipe::OnDetachFromChannel(unsigned port) { | 317 void MessagePipe::OnDetachFromChannel(unsigned port) { |
317 Close(port); | 318 Close(port); |
318 } | 319 } |
319 | 320 |
320 MessagePipe::MessagePipe() { | 321 MessagePipe::MessagePipe() {} |
321 } | |
322 | 322 |
323 MessagePipe::~MessagePipe() { | 323 MessagePipe::~MessagePipe() { |
324 // Owned by the dispatchers. The owning dispatchers should only release us via | 324 // Owned by the dispatchers. The owning dispatchers should only release us via |
325 // their |Close()| method, which should inform us of being closed via our | 325 // their |Close()| method, which should inform us of being closed via our |
326 // |Close()|. Thus these should already be null. | 326 // |Close()|. Thus these should already be null. |
327 DCHECK(!endpoints_[0]); | 327 DCHECK(!endpoints_[0]); |
328 DCHECK(!endpoints_[1]); | 328 DCHECK(!endpoints_[1]); |
329 } | 329 } |
330 | 330 |
331 MojoResult MessagePipe::EnqueueMessageNoLock( | 331 MojoResult MessagePipe::EnqueueMessageNoLock( |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 LOG(WARNING) << "Enqueueing null dispatcher"; | 371 LOG(WARNING) << "Enqueueing null dispatcher"; |
372 dispatchers->push_back(nullptr); | 372 dispatchers->push_back(nullptr); |
373 } | 373 } |
374 } | 374 } |
375 message->SetDispatchers(std::move(dispatchers)); | 375 message->SetDispatchers(std::move(dispatchers)); |
376 return MOJO_RESULT_OK; | 376 return MOJO_RESULT_OK; |
377 } | 377 } |
378 | 378 |
379 } // namespace system | 379 } // namespace system |
380 } // namespace mojo | 380 } // namespace mojo |
OLD | NEW |