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::embedder::ScopedPlatformHandle; | 23 using mojo::platform::ScopedPlatformHandle; |
24 using mojo::util::RefPtr; | 24 using mojo::util::RefPtr; |
25 | 25 |
26 namespace mojo { | 26 namespace mojo { |
27 namespace system { | 27 namespace system { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 bool ValidateIncomingMessage(size_t element_num_bytes, | 31 bool ValidateIncomingMessage(size_t element_num_bytes, |
32 size_t capacity_num_bytes, | 32 size_t capacity_num_bytes, |
33 size_t current_num_bytes, | 33 size_t current_num_bytes, |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 // If the consumer is still open and we still have data, we have to keep the | 461 // If the consumer is still open and we still have data, we have to keep the |
462 // buffer around. Currently, we won't free it even if it empties later. (We | 462 // buffer around. Currently, we won't free it even if it empties later. (We |
463 // could do this -- requiring a check on every read -- but that seems to be | 463 // could do this -- requiring a check on every read -- but that seems to be |
464 // optimizing for the uncommon case.) | 464 // optimizing for the uncommon case.) |
465 if (!consumer_open() || !current_num_bytes_) | 465 if (!consumer_open() || !current_num_bytes_) |
466 DestroyBuffer(); | 466 DestroyBuffer(); |
467 } | 467 } |
468 | 468 |
469 } // namespace system | 469 } // namespace system |
470 } // namespace mojo | 470 } // namespace mojo |
OLD | NEW |