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/system/channel.h" | 5 #include "mojo/system/channel.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 DVLOG(2) << "Ignoring downstream message for zombie endpoint (local ID = " | 344 DVLOG(2) << "Ignoring downstream message for zombie endpoint (local ID = " |
345 << local_id << ", remote ID = " << message_view.source_id() << ")"; | 345 << local_id << ", remote ID = " << message_view.source_id() << ")"; |
346 return; | 346 return; |
347 } | 347 } |
348 | 348 |
349 // We need to duplicate the message, because |EnqueueMessage()| will take | 349 // We need to duplicate the message, because |EnqueueMessage()| will take |
350 // ownership of it. | 350 // ownership of it. |
351 scoped_ptr<MessageInTransit> message(new MessageInTransit(message_view)); | 351 scoped_ptr<MessageInTransit> message(new MessageInTransit(message_view)); |
352 message->DeserializeDispatchers(this); | 352 message->DeserializeDispatchers(this); |
353 MojoResult result = endpoint_info.message_pipe->EnqueueMessage( | 353 MojoResult result = endpoint_info.message_pipe->EnqueueMessage( |
354 MessagePipe::GetPeerPort(endpoint_info.port), message.Pass(), NULL); | 354 MessagePipe::GetPeerPort(endpoint_info.port), message.Pass()); |
355 if (result != MOJO_RESULT_OK) { | 355 if (result != MOJO_RESULT_OK) { |
356 // TODO(vtl): This might be a "non-error", e.g., if the destination endpoint | 356 // TODO(vtl): This might be a "non-error", e.g., if the destination endpoint |
357 // has been closed (in an unavoidable race). This might also be a "remote" | 357 // has been closed (in an unavoidable race). This might also be a "remote" |
358 // error, e.g., if the remote side is sending invalid control messages (to | 358 // error, e.g., if the remote side is sending invalid control messages (to |
359 // the message pipe). | 359 // the message pipe). |
360 HandleLocalError(base::StringPrintf( | 360 HandleLocalError(base::StringPrintf( |
361 "Failed to enqueue message to local ID %u (result %d)", | 361 "Failed to enqueue message to local ID %u (result %d)", |
362 static_cast<unsigned>(local_id), static_cast<int>(result))); | 362 static_cast<unsigned>(local_id), static_cast<int>(result))); |
363 return; | 363 return; |
364 } | 364 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 // TODO(vtl): Is this how we really want to handle this? | 473 // TODO(vtl): Is this how we really want to handle this? |
474 // Sometimes we'll want to propagate the error back to the message pipe | 474 // Sometimes we'll want to propagate the error back to the message pipe |
475 // (endpoint), and notify it that the remote is (effectively) closed. | 475 // (endpoint), and notify it that the remote is (effectively) closed. |
476 // Sometimes we'll want to kill the channel (and notify all the endpoints that | 476 // Sometimes we'll want to kill the channel (and notify all the endpoints that |
477 // their remotes are dead. | 477 // their remotes are dead. |
478 LOG(WARNING) << error_message; | 478 LOG(WARNING) << error_message; |
479 } | 479 } |
480 | 480 |
481 } // namespace system | 481 } // namespace system |
482 } // namespace mojo | 482 } // namespace mojo |
OLD | NEW |