| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/remote_producer_data_pipe_impl.h" | 5 #include "mojo/edk/system/remote_producer_data_pipe_impl.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "mojo/edk/system/channel.h" | 14 #include "mojo/edk/system/channel.h" |
| 15 #include "mojo/edk/system/channel_endpoint.h" | 15 #include "mojo/edk/system/channel_endpoint.h" |
| 16 #include "mojo/edk/system/configuration.h" | 16 #include "mojo/edk/system/configuration.h" |
| 17 #include "mojo/edk/system/data_pipe.h" | 17 #include "mojo/edk/system/data_pipe.h" |
| 18 #include "mojo/edk/system/message_in_transit.h" | 18 #include "mojo/edk/system/message_in_transit.h" |
| 19 #include "mojo/edk/system/message_in_transit_queue.h" | 19 #include "mojo/edk/system/message_in_transit_queue.h" |
| 20 #include "mojo/edk/system/remote_consumer_data_pipe_impl.h" | 20 #include "mojo/edk/system/remote_consumer_data_pipe_impl.h" |
| 21 #include "mojo/edk/system/remote_data_pipe_ack.h" | 21 #include "mojo/edk/system/remote_data_pipe_ack.h" |
| 22 | 22 |
| 23 using mojo::util::RefPtr; |
| 24 |
| 23 namespace mojo { | 25 namespace mojo { |
| 24 namespace system { | 26 namespace system { |
| 25 | 27 |
| 26 namespace { | 28 namespace { |
| 27 | 29 |
| 28 bool ValidateIncomingMessage(size_t element_num_bytes, | 30 bool ValidateIncomingMessage(size_t element_num_bytes, |
| 29 size_t capacity_num_bytes, | 31 size_t capacity_num_bytes, |
| 30 size_t current_num_bytes, | 32 size_t current_num_bytes, |
| 31 const MessageInTransit* message) { | 33 const MessageInTransit* message) { |
| 32 // We should only receive endpoint client messages. | 34 // We should only receive endpoint client messages. |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 // If the consumer is still open and we still have data, we have to keep the | 460 // If the consumer is still open and we still have data, we have to keep the |
| 459 // buffer around. Currently, we won't free it even if it empties later. (We | 461 // buffer around. Currently, we won't free it even if it empties later. (We |
| 460 // could do this -- requiring a check on every read -- but that seems to be | 462 // could do this -- requiring a check on every read -- but that seems to be |
| 461 // optimizing for the uncommon case.) | 463 // optimizing for the uncommon case.) |
| 462 if (!consumer_open() || !current_num_bytes_) | 464 if (!consumer_open() || !current_num_bytes_) |
| 463 DestroyBuffer(); | 465 DestroyBuffer(); |
| 464 } | 466 } |
| 465 | 467 |
| 466 } // namespace system | 468 } // namespace system |
| 467 } // namespace mojo | 469 } // namespace mojo |
| OLD | NEW |