OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/public/cpp/bindings/lib/router.h" | 5 #include "mojo/public/cpp/bindings/lib/router.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 class ResponderThunk : public MessageReceiverWithStatus { | 32 class ResponderThunk : public MessageReceiverWithStatus { |
33 public: | 33 public: |
34 explicit ResponderThunk(const base::WeakPtr<Router>& router, | 34 explicit ResponderThunk(const base::WeakPtr<Router>& router, |
35 scoped_refptr<base::SingleThreadTaskRunner> runner) | 35 scoped_refptr<base::SingleThreadTaskRunner> runner) |
36 : router_(router), | 36 : router_(router), |
37 accept_was_invoked_(false), | 37 accept_was_invoked_(false), |
38 task_runner_(std::move(runner)) {} | 38 task_runner_(std::move(runner)) {} |
39 ~ResponderThunk() override { | 39 ~ResponderThunk() override { |
40 if (!accept_was_invoked_) { | 40 if (!accept_was_invoked_) { |
41 // The Mojo application handled a message that was expecting a response | 41 // The Service handled a message that was expecting a response |
42 // but did not send a response. | 42 // but did not send a response. |
43 // We raise an error to signal the calling application that an error | 43 // We raise an error to signal the calling application that an error |
44 // condition occurred. Without this the calling application would have no | 44 // condition occurred. Without this the calling application would have no |
45 // way of knowing it should stop waiting for a response. | 45 // way of knowing it should stop waiting for a response. |
46 if (task_runner_->RunsTasksOnCurrentThread()) { | 46 if (task_runner_->RunsTasksOnCurrentThread()) { |
47 // Please note that even if this code is run from a different task | 47 // Please note that even if this code is run from a different task |
48 // runner on the same thread as |task_runner_|, it is okay to directly | 48 // runner on the same thread as |task_runner_|, it is okay to directly |
49 // call Router::RaiseError(), because it will raise error from the | 49 // call Router::RaiseError(), because it will raise error from the |
50 // correct task runner asynchronously. | 50 // correct task runner asynchronously. |
51 if (router_) | 51 if (router_) |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 std::string description = control_message_handler_.disconnect_description(); | 336 std::string description = control_message_handler_.disconnect_description(); |
337 error_with_reason_handler_.Run( | 337 error_with_reason_handler_.Run( |
338 control_message_handler_.disconnect_custom_reason(), description); | 338 control_message_handler_.disconnect_custom_reason(), description); |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 // ---------------------------------------------------------------------------- | 342 // ---------------------------------------------------------------------------- |
343 | 343 |
344 } // namespace internal | 344 } // namespace internal |
345 } // namespace mojo | 345 } // namespace mojo |
OLD | NEW |