| 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/incoming_endpoint.h" | 14 #include "mojo/edk/system/incoming_endpoint.h" |
| 15 #include "mojo/edk/system/local_message_pipe_endpoint.h" | 15 #include "mojo/edk/system/local_message_pipe_endpoint.h" |
| 16 #include "mojo/edk/system/message_in_transit.h" | 16 #include "mojo/edk/system/message_in_transit.h" |
| 17 #include "mojo/edk/system/message_pipe_dispatcher.h" | 17 #include "mojo/edk/system/message_pipe_dispatcher.h" |
| 18 #include "mojo/edk/system/message_pipe_endpoint.h" | 18 #include "mojo/edk/system/message_pipe_endpoint.h" |
| 19 #include "mojo/edk/system/proxy_message_pipe_endpoint.h" | 19 #include "mojo/edk/system/proxy_message_pipe_endpoint.h" |
| 20 #include "mojo/edk/util/make_unique.h" | 20 #include "mojo/edk/util/make_unique.h" |
| 21 | 21 |
| 22 using mojo::embedder::ScopedPlatformHandle; |
| 22 using mojo::util::MakeRefCounted; | 23 using mojo::util::MakeRefCounted; |
| 23 using mojo::util::MutexLocker; | 24 using mojo::util::MutexLocker; |
| 24 using mojo::util::RefPtr; | 25 using mojo::util::RefPtr; |
| 25 | 26 |
| 26 namespace mojo { | 27 namespace mojo { |
| 27 namespace system { | 28 namespace system { |
| 28 | 29 |
| 29 // static | 30 // static |
| 30 RefPtr<MessagePipe> MessagePipe::CreateLocalLocal() | 31 RefPtr<MessagePipe> MessagePipe::CreateLocalLocal() |
| 31 MOJO_NO_THREAD_SAFETY_ANALYSIS { | 32 MOJO_NO_THREAD_SAFETY_ANALYSIS { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 size_t* max_platform_handles) { | 222 size_t* max_platform_handles) { |
| 222 *max_size = channel->GetSerializedEndpointSize(); | 223 *max_size = channel->GetSerializedEndpointSize(); |
| 223 *max_platform_handles = 0; | 224 *max_platform_handles = 0; |
| 224 } | 225 } |
| 225 | 226 |
| 226 bool MessagePipe::EndSerialize( | 227 bool MessagePipe::EndSerialize( |
| 227 unsigned port, | 228 unsigned port, |
| 228 Channel* channel, | 229 Channel* channel, |
| 229 void* destination, | 230 void* destination, |
| 230 size_t* actual_size, | 231 size_t* actual_size, |
| 231 embedder::PlatformHandleVector* /*platform_handles*/) { | 232 std::vector<ScopedPlatformHandle>* /*platform_handles*/) { |
| 232 DCHECK(port == 0 || port == 1); | 233 DCHECK(port == 0 || port == 1); |
| 233 | 234 |
| 234 MutexLocker locker(&mutex_); | 235 MutexLocker locker(&mutex_); |
| 235 DCHECK(endpoints_[port]); | 236 DCHECK(endpoints_[port]); |
| 236 | 237 |
| 237 // The port being serialized must be local. | 238 // The port being serialized must be local. |
| 238 DCHECK_EQ(endpoints_[port]->GetType(), MessagePipeEndpoint::kTypeLocal); | 239 DCHECK_EQ(endpoints_[port]->GetType(), MessagePipeEndpoint::kTypeLocal); |
| 239 | 240 |
| 240 unsigned peer_port = GetPeerPort(port); | 241 unsigned peer_port = GetPeerPort(port); |
| 241 MessageInTransitQueue* message_queue = | 242 MessageInTransitQueue* message_queue = |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 LOG(WARNING) << "Enqueueing null dispatcher"; | 387 LOG(WARNING) << "Enqueueing null dispatcher"; |
| 387 dispatchers->push_back(nullptr); | 388 dispatchers->push_back(nullptr); |
| 388 } | 389 } |
| 389 } | 390 } |
| 390 message->SetDispatchers(std::move(dispatchers)); | 391 message->SetDispatchers(std::move(dispatchers)); |
| 391 return MOJO_RESULT_OK; | 392 return MOJO_RESULT_OK; |
| 392 } | 393 } |
| 393 | 394 |
| 394 } // namespace system | 395 } // namespace system |
| 395 } // namespace mojo | 396 } // namespace mojo |
| OLD | NEW |