| 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 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 | 1348 |
| 1349 for (const auto& proxy_name : dead_proxies_to_broadcast) { | 1349 for (const auto& proxy_name : dead_proxies_to_broadcast) { |
| 1350 // Broadcast an event signifying that this proxy is no longer functioning. | 1350 // Broadcast an event signifying that this proxy is no longer functioning. |
| 1351 ObserveProxyEventData event; | 1351 ObserveProxyEventData event; |
| 1352 event.proxy_node_name = name_; | 1352 event.proxy_node_name = name_; |
| 1353 event.proxy_port_name = proxy_name; | 1353 event.proxy_port_name = proxy_name; |
| 1354 event.proxy_to_node_name = kInvalidNodeName; | 1354 event.proxy_to_node_name = kInvalidNodeName; |
| 1355 event.proxy_to_port_name = kInvalidPortName; | 1355 event.proxy_to_port_name = kInvalidPortName; |
| 1356 delegate_->BroadcastMessage(NewInternalMessage( | 1356 delegate_->BroadcastMessage(NewInternalMessage( |
| 1357 kInvalidPortName, EventType::kObserveProxy, event)); | 1357 kInvalidPortName, EventType::kObserveProxy, event)); |
| 1358 |
| 1359 // Also process death locally since the port that points this closed one |
| 1360 // could be on the current node. |
| 1361 // Note: Although this is recursive, only a single port is involved which |
| 1362 // limits the expected branching to 1. |
| 1363 DestroyAllPortsWithPeer(name_, proxy_name); |
| 1358 } | 1364 } |
| 1359 | 1365 |
| 1360 // Close any ports referenced by the closed proxies. | 1366 // Close any ports referenced by the closed proxies. |
| 1361 for (const auto& name : referenced_port_names) { | 1367 for (const auto& name : referenced_port_names) { |
| 1362 PortRef ref; | 1368 PortRef ref; |
| 1363 if (GetPort(name, &ref) == OK) | 1369 if (GetPort(name, &ref) == OK) |
| 1364 ClosePort(ref); | 1370 ClosePort(ref); |
| 1365 } | 1371 } |
| 1366 } | 1372 } |
| 1367 | 1373 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1379 | 1385 |
| 1380 if (num_data_bytes) | 1386 if (num_data_bytes) |
| 1381 memcpy(header + 1, data, num_data_bytes); | 1387 memcpy(header + 1, data, num_data_bytes); |
| 1382 | 1388 |
| 1383 return message; | 1389 return message; |
| 1384 } | 1390 } |
| 1385 | 1391 |
| 1386 } // namespace ports | 1392 } // namespace ports |
| 1387 } // namespace edk | 1393 } // namespace edk |
| 1388 } // namespace mojo | 1394 } // namespace mojo |
| OLD | NEW |