| 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/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 14 #include "mojo/edk/system/ports/node_delegate.h" | 15 #include "mojo/edk/system/ports/node_delegate.h" |
| 15 | 16 |
| 16 namespace mojo { | 17 namespace mojo { |
| 17 namespace edk { | 18 namespace edk { |
| 18 namespace ports { | 19 namespace ports { |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 base::AutoLock lock(ports_lock_); | 798 base::AutoLock lock(ports_lock_); |
| 798 return GetPort_Locked(port_name); | 799 return GetPort_Locked(port_name); |
| 799 } | 800 } |
| 800 | 801 |
| 801 scoped_refptr<Port> Node::GetPort_Locked(const PortName& port_name) { | 802 scoped_refptr<Port> Node::GetPort_Locked(const PortName& port_name) { |
| 802 ports_lock_.AssertAcquired(); | 803 ports_lock_.AssertAcquired(); |
| 803 auto iter = ports_.find(port_name); | 804 auto iter = ports_.find(port_name); |
| 804 if (iter == ports_.end()) | 805 if (iter == ports_.end()) |
| 805 return nullptr; | 806 return nullptr; |
| 806 | 807 |
| 808 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARM64) |
| 809 // Workaround for https://crbug.com/665869. |
| 810 base::subtle::MemoryBarrier(); |
| 811 #endif |
| 812 |
| 807 return iter->second; | 813 return iter->second; |
| 808 } | 814 } |
| 809 | 815 |
| 810 int Node::SendMessageInternal(const PortRef& port_ref, ScopedMessage* message) { | 816 int Node::SendMessageInternal(const PortRef& port_ref, ScopedMessage* message) { |
| 811 ScopedMessage& m = *message; | 817 ScopedMessage& m = *message; |
| 812 for (size_t i = 0; i < m->num_ports(); ++i) { | 818 for (size_t i = 0; i < m->num_ports(); ++i) { |
| 813 if (m->ports()[i] == port_ref.name()) | 819 if (m->ports()[i] == port_ref.name()) |
| 814 return ERROR_PORT_CANNOT_SEND_SELF; | 820 return ERROR_PORT_CANNOT_SEND_SELF; |
| 815 } | 821 } |
| 816 | 822 |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1372 | 1378 |
| 1373 if (num_data_bytes) | 1379 if (num_data_bytes) |
| 1374 memcpy(header + 1, data, num_data_bytes); | 1380 memcpy(header + 1, data, num_data_bytes); |
| 1375 | 1381 |
| 1376 return message; | 1382 return message; |
| 1377 } | 1383 } |
| 1378 | 1384 |
| 1379 } // namespace ports | 1385 } // namespace ports |
| 1380 } // namespace edk | 1386 } // namespace edk |
| 1381 } // namespace mojo | 1387 } // namespace mojo |
| OLD | NEW |