| 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 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 base::AutoLock lock(ports_lock_); | 802 base::AutoLock lock(ports_lock_); |
| 802 return GetPort_Locked(port_name); | 803 return GetPort_Locked(port_name); |
| 803 } | 804 } |
| 804 | 805 |
| 805 scoped_refptr<Port> Node::GetPort_Locked(const PortName& port_name) { | 806 scoped_refptr<Port> Node::GetPort_Locked(const PortName& port_name) { |
| 806 ports_lock_.AssertAcquired(); | 807 ports_lock_.AssertAcquired(); |
| 807 auto iter = ports_.find(port_name); | 808 auto iter = ports_.find(port_name); |
| 808 if (iter == ports_.end()) | 809 if (iter == ports_.end()) |
| 809 return nullptr; | 810 return nullptr; |
| 810 | 811 |
| 812 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARM64) |
| 813 // Workaround for https://crbug.com/665869. |
| 814 base::subtle::MemoryBarrier(); |
| 815 #endif |
| 816 |
| 811 return iter->second; | 817 return iter->second; |
| 812 } | 818 } |
| 813 | 819 |
| 814 int Node::SendMessageInternal(const PortRef& port_ref, ScopedMessage* message) { | 820 int Node::SendMessageInternal(const PortRef& port_ref, ScopedMessage* message) { |
| 815 ScopedMessage& m = *message; | 821 ScopedMessage& m = *message; |
| 816 for (size_t i = 0; i < m->num_ports(); ++i) { | 822 for (size_t i = 0; i < m->num_ports(); ++i) { |
| 817 if (m->ports()[i] == port_ref.name()) | 823 if (m->ports()[i] == port_ref.name()) |
| 818 return ERROR_PORT_CANNOT_SEND_SELF; | 824 return ERROR_PORT_CANNOT_SEND_SELF; |
| 819 } | 825 } |
| 820 | 826 |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 | 1382 |
| 1377 if (num_data_bytes) | 1383 if (num_data_bytes) |
| 1378 memcpy(header + 1, data, num_data_bytes); | 1384 memcpy(header + 1, data, num_data_bytes); |
| 1379 | 1385 |
| 1380 return message; | 1386 return message; |
| 1381 } | 1387 } |
| 1382 | 1388 |
| 1383 } // namespace ports | 1389 } // namespace ports |
| 1384 } // namespace edk | 1390 } // namespace edk |
| 1385 } // namespace mojo | 1391 } // namespace mojo |
| OLD | NEW |