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> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "mojo/edk/system/channel.h" | 10 #include "mojo/edk/system/channel.h" |
9 #include "mojo/edk/system/channel_endpoint.h" | 11 #include "mojo/edk/system/channel_endpoint.h" |
10 #include "mojo/edk/system/channel_endpoint_id.h" | 12 #include "mojo/edk/system/channel_endpoint_id.h" |
11 #include "mojo/edk/system/incoming_endpoint.h" | 13 #include "mojo/edk/system/incoming_endpoint.h" |
12 #include "mojo/edk/system/local_message_pipe_endpoint.h" | 14 #include "mojo/edk/system/local_message_pipe_endpoint.h" |
13 #include "mojo/edk/system/message_in_transit.h" | 15 #include "mojo/edk/system/message_in_transit.h" |
14 #include "mojo/edk/system/message_pipe_dispatcher.h" | 16 #include "mojo/edk/system/message_pipe_dispatcher.h" |
15 #include "mojo/edk/system/message_pipe_endpoint.h" | 17 #include "mojo/edk/system/message_pipe_endpoint.h" |
16 #include "mojo/edk/system/proxy_message_pipe_endpoint.h" | 18 #include "mojo/edk/system/proxy_message_pipe_endpoint.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 // The other case should have been disallowed by |Core|. (Note: |port| | 362 // The other case should have been disallowed by |Core|. (Note: |port| |
361 // is the peer port of the handle given to |WriteMessage()|.) | 363 // is the peer port of the handle given to |WriteMessage()|.) |
362 DCHECK_EQ(mp_transport.GetPort(), port); | 364 DCHECK_EQ(mp_transport.GetPort(), port); |
363 return MOJO_RESULT_INVALID_ARGUMENT; | 365 return MOJO_RESULT_INVALID_ARGUMENT; |
364 } | 366 } |
365 } | 367 } |
366 } | 368 } |
367 | 369 |
368 // Clone the dispatchers and attach them to the message. (This must be done as | 370 // Clone the dispatchers and attach them to the message. (This must be done as |
369 // a separate loop, since we want to leave the dispatchers alone on failure.) | 371 // a separate loop, since we want to leave the dispatchers alone on failure.) |
370 scoped_ptr<DispatcherVector> dispatchers(new DispatcherVector()); | 372 std::unique_ptr<DispatcherVector> dispatchers(new DispatcherVector()); |
371 dispatchers->reserve(transports->size()); | 373 dispatchers->reserve(transports->size()); |
372 for (size_t i = 0; i < transports->size(); i++) { | 374 for (size_t i = 0; i < transports->size(); i++) { |
373 if ((*transports)[i].is_valid()) { | 375 if ((*transports)[i].is_valid()) { |
374 dispatchers->push_back( | 376 dispatchers->push_back( |
375 (*transports)[i].CreateEquivalentDispatcherAndClose()); | 377 (*transports)[i].CreateEquivalentDispatcherAndClose()); |
376 } else { | 378 } else { |
377 LOG(WARNING) << "Enqueueing null dispatcher"; | 379 LOG(WARNING) << "Enqueueing null dispatcher"; |
378 dispatchers->push_back(nullptr); | 380 dispatchers->push_back(nullptr); |
379 } | 381 } |
380 } | 382 } |
381 message->SetDispatchers(dispatchers.Pass()); | 383 message->SetDispatchers(std::move(dispatchers)); |
382 return MOJO_RESULT_OK; | 384 return MOJO_RESULT_OK; |
383 } | 385 } |
384 | 386 |
385 } // namespace system | 387 } // namespace system |
386 } // namespace mojo | 388 } // namespace mojo |
OLD | NEW |