| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ports/node.h" | 5 #include "mojo/edk/system/ports/node.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/atomicops.h" | 11 #include "base/atomicops.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 15 #include "mojo/edk/system/ports/node_delegate.h" | 15 #include "mojo/edk/system/ports/node_delegate.h" |
| 16 | 16 |
| 17 namespace mojo { | 17 namespace mojo { |
| 18 namespace edk { | 18 namespace edk { |
| 19 namespace ports { | 19 namespace ports { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 int DebugError(const char* message, int error_code) { | 23 int DebugError(const char* message, int error_code) { |
| 24 CHECK(false) << "Oops: " << message; | 24 // Oops. |
| 25 CHECK(false); |
| 25 return error_code; | 26 return error_code; |
| 26 } | 27 } |
| 27 | 28 |
| 28 #define OOPS(x) DebugError(#x, x) | 29 #define OOPS(x) DebugError(#x, x) |
| 29 | 30 |
| 30 bool CanAcceptMoreMessages(const Port* port) { | 31 bool CanAcceptMoreMessages(const Port* port) { |
| 31 // Have we already doled out the last message (i.e., do we expect to NOT | 32 // Have we already doled out the last message (i.e., do we expect to NOT |
| 32 // receive further messages)? | 33 // receive further messages)? |
| 33 uint64_t next_sequence_num = port->message_queue.next_sequence_num(); | 34 uint64_t next_sequence_num = port->message_queue.next_sequence_num(); |
| 34 if (port->state == Port::kClosed) | 35 if (port->state == Port::kClosed) |
| (...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1378 | 1379 |
| 1379 if (num_data_bytes) | 1380 if (num_data_bytes) |
| 1380 memcpy(header + 1, data, num_data_bytes); | 1381 memcpy(header + 1, data, num_data_bytes); |
| 1381 | 1382 |
| 1382 return message; | 1383 return message; |
| 1383 } | 1384 } |
| 1384 | 1385 |
| 1385 } // namespace ports | 1386 } // namespace ports |
| 1386 } // namespace edk | 1387 } // namespace edk |
| 1387 } // namespace mojo | 1388 } // namespace mojo |
| OLD | NEW |