| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/core.h" | 5 #include "mojo/edk/system/core.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 } | 784 } |
| 785 | 785 |
| 786 MojoResult Core::NotifyBadMessage(MojoMessageHandle message, | 786 MojoResult Core::NotifyBadMessage(MojoMessageHandle message, |
| 787 const char* error, | 787 const char* error, |
| 788 size_t error_num_bytes) { | 788 size_t error_num_bytes) { |
| 789 if (!message) | 789 if (!message) |
| 790 return MOJO_RESULT_INVALID_ARGUMENT; | 790 return MOJO_RESULT_INVALID_ARGUMENT; |
| 791 | 791 |
| 792 const PortsMessage& ports_message = | 792 const PortsMessage& ports_message = |
| 793 reinterpret_cast<MessageForTransit*>(message)->ports_message(); | 793 reinterpret_cast<MessageForTransit*>(message)->ports_message(); |
| 794 if (ports_message.source_node() == ports::kInvalidNodeName) { | 794 if (ports_message.source_node() == ports::constants::kInvalidNodeName) { |
| 795 DVLOG(1) << "Received invalid message from unknown node."; | 795 DVLOG(1) << "Received invalid message from unknown node."; |
| 796 if (!default_process_error_callback_.is_null()) | 796 if (!default_process_error_callback_.is_null()) |
| 797 default_process_error_callback_.Run(std::string(error, error_num_bytes)); | 797 default_process_error_callback_.Run(std::string(error, error_num_bytes)); |
| 798 return MOJO_RESULT_OK; | 798 return MOJO_RESULT_OK; |
| 799 } | 799 } |
| 800 | 800 |
| 801 GetNodeController()->NotifyBadMessageFrom( | 801 GetNodeController()->NotifyBadMessageFrom( |
| 802 ports_message.source_node(), std::string(error, error_num_bytes)); | 802 ports_message.source_node(), std::string(error, error_num_bytes)); |
| 803 return MOJO_RESULT_OK; | 803 return MOJO_RESULT_OK; |
| 804 } | 804 } |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 std::unique_ptr<NodeController> node_controller) { | 1195 std::unique_ptr<NodeController> node_controller) { |
| 1196 // It's OK to leak this reference. At this point we know the IO loop is still | 1196 // It's OK to leak this reference. At this point we know the IO loop is still |
| 1197 // running, and we know the NodeController will observe its eventual | 1197 // running, and we know the NodeController will observe its eventual |
| 1198 // destruction. This tells the NodeController to delete itself when that | 1198 // destruction. This tells the NodeController to delete itself when that |
| 1199 // happens. | 1199 // happens. |
| 1200 node_controller.release()->DestroyOnIOThreadShutdown(); | 1200 node_controller.release()->DestroyOnIOThreadShutdown(); |
| 1201 } | 1201 } |
| 1202 | 1202 |
| 1203 } // namespace edk | 1203 } // namespace edk |
| 1204 } // namespace mojo | 1204 } // namespace mojo |
| OLD | NEW |