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" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 MessageInTransit* message, | 357 MessageInTransit* message, |
358 std::vector<HandleTransport>* transports) { | 358 std::vector<HandleTransport>* transports) { |
359 DCHECK(!message->has_dispatchers()); | 359 DCHECK(!message->has_dispatchers()); |
360 | 360 |
361 // Clone the dispatchers and attach them to the message. (This must be done as | 361 // Clone the dispatchers and attach them to the message. (This must be done as |
362 // a separate loop, since we want to leave the dispatchers alone on failure.) | 362 // a separate loop, since we want to leave the dispatchers alone on failure.) |
363 std::unique_ptr<DispatcherVector> dispatchers(new DispatcherVector()); | 363 std::unique_ptr<DispatcherVector> dispatchers(new DispatcherVector()); |
364 dispatchers->reserve(transports->size()); | 364 dispatchers->reserve(transports->size()); |
365 for (size_t i = 0; i < transports->size(); i++) { | 365 for (size_t i = 0; i < transports->size(); i++) { |
366 if ((*transports)[i].is_valid()) { | 366 if ((*transports)[i].is_valid()) { |
367 dispatchers->push_back( | 367 // TODO(vtl): Plumb this into |MessageInTransit|. (I.e., |dispatchers| -> |
368 (*transports)[i].CreateEquivalentDispatcherAndClose(this, port)); | 368 // |handles|, etc.) |
| 369 Handle h = (*transports)[i].CreateEquivalentHandleAndClose(this, port); |
| 370 dispatchers->push_back(std::move(h.dispatcher)); |
369 } else { | 371 } else { |
370 LOG(WARNING) << "Enqueueing null dispatcher"; | 372 LOG(WARNING) << "Enqueueing null dispatcher"; |
371 dispatchers->push_back(nullptr); | 373 dispatchers->push_back(nullptr); |
372 } | 374 } |
373 } | 375 } |
374 message->SetDispatchers(std::move(dispatchers)); | 376 message->SetDispatchers(std::move(dispatchers)); |
375 return MOJO_RESULT_OK; | 377 return MOJO_RESULT_OK; |
376 } | 378 } |
377 | 379 |
378 } // namespace system | 380 } // namespace system |
379 } // namespace mojo | 381 } // namespace mojo |
OLD | NEW |