Chromium Code Reviews| 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 |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 619 port->remove_proxy_on_last_message = true; | 619 port->remove_proxy_on_last_message = true; |
| 620 port->last_sequence_num_to_receive = last_sequence_num; | 620 port->last_sequence_num_to_receive = last_sequence_num; |
| 621 } | 621 } |
| 622 TryRemoveProxy(PortRef(port_name, port)); | 622 TryRemoveProxy(PortRef(port_name, port)); |
| 623 return OK; | 623 return OK; |
| 624 } | 624 } |
| 625 | 625 |
| 626 int Node::OnObserveClosure(const PortName& port_name, | 626 int Node::OnObserveClosure(const PortName& port_name, |
| 627 uint64_t last_sequence_num) { | 627 uint64_t last_sequence_num) { |
| 628 // OK if the port doesn't exist, as it may have been closed already. | 628 // OK if the port doesn't exist, as it may have been closed already. |
| 629 scoped_refptr<Port> port = GetPort(port_name); | 629 scoped_refptr<Port> closed_port = GetPort(port_name); |
| 630 if (!port) | 630 if (!closed_port) |
| 631 return OK; | 631 return OK; |
| 632 | 632 |
| 633 // This message tells the port that it should no longer expect more messages | 633 // This message tells the port that it should no longer expect more messages |
| 634 // beyond last_sequence_num. This message is forwarded along until we reach | 634 // beyond last_sequence_num. This message is forwarded along until we reach |
| 635 // the receiving end, and this message serves as an equivalent to | 635 // the receiving end, and this message serves as an equivalent to |
| 636 // ObserveProxyAck. | 636 // ObserveProxyAck. |
| 637 | 637 |
| 638 bool notify_delegate = false; | 638 bool notify_delegate = false; |
| 639 ObserveClosureEventData forwarded_data; | 639 ObserveClosureEventData forwarded_data; |
| 640 NodeName peer_node_name; | 640 NodeName peer_node_name; |
| 641 PortName peer_port_name; | 641 PortName peer_port_name; |
| 642 | |
| 643 // NOTE: This redundant copy of the scoped_refptr is here as a workaround for | |
| 644 // https://crbug.com/665869. Without it a code sequence is generated which | |
| 645 // under certain conditions can tickle a Tegra K1 erratum, causing the lock | |
| 646 // acquisition below to segfault. | |
| 647 scoped_refptr<Port> port = closed_port; | |
|
Torne
2016/11/18 11:59:56
Doing this here isn't sufficient - there are also
| |
| 642 bool try_remove_proxy = false; | 648 bool try_remove_proxy = false; |
| 643 { | 649 { |
| 644 base::AutoLock lock(port->lock); | 650 base::AutoLock lock(port->lock); |
| 645 | 651 |
| 646 port->peer_closed = true; | 652 port->peer_closed = true; |
| 647 port->last_sequence_num_to_receive = last_sequence_num; | 653 port->last_sequence_num_to_receive = last_sequence_num; |
| 648 | 654 |
| 649 DVLOG(2) << "ObserveClosure at " << port_name << "@" << name_ | 655 DVLOG(2) << "ObserveClosure at " << port_name << "@" << name_ |
| 650 << " (state=" << port->state << ") pointing to " | 656 << " (state=" << port->state << ") pointing to " |
| 651 << port->peer_port_name << "@" << port->peer_node_name | 657 << port->peer_port_name << "@" << port->peer_node_name |
| (...skipping 720 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 |