Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(973)

Side by Side Diff: mojo/edk/system/ports/node.cc

Issue 2514553002: Mojo EDK: Work around Nexus 9 hardware bug (Closed)
Patch Set: . Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/system/message_pipe_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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)
Torne 2016/11/18 15:37:57 You could use #if defined(OS_ANDROID) && defined(A
Ken Rockot(use gerrit already) 2016/11/18 15:49:28 Done
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
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
OLDNEW
« no previous file with comments | « mojo/edk/system/message_pipe_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698