OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback.h" |
11 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
12 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
13 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
14 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
15 #include "mojo/public/cpp/bindings/associated_binding.h" | 16 #include "mojo/public/cpp/bindings/associated_binding.h" |
16 #include "mojo/public/cpp/bindings/associated_group.h" | 17 #include "mojo/public/cpp/bindings/associated_group.h" |
17 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" | 18 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
18 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" | 19 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" |
19 #include "mojo/public/cpp/bindings/associated_interface_request.h" | 20 #include "mojo/public/cpp/bindings/associated_interface_request.h" |
20 #include "mojo/public/cpp/bindings/binding.h" | 21 #include "mojo/public/cpp/bindings/binding.h" |
(...skipping 19 matching lines...) Expand all Loading... |
40 notify_send_method_called_ = callback; | 41 notify_send_method_called_ = callback; |
41 } | 42 } |
42 | 43 |
43 void Echo(int32_t value, const EchoCallback& callback) override { | 44 void Echo(int32_t value, const EchoCallback& callback) override { |
44 callback.Run(value); | 45 callback.Run(value); |
45 } | 46 } |
46 void Send(int32_t value) override { notify_send_method_called_.Run(value); } | 47 void Send(int32_t value) override { notify_send_method_called_.Run(value); } |
47 | 48 |
48 AssociatedBinding<IntegerSender>* binding() { return &binding_; } | 49 AssociatedBinding<IntegerSender>* binding() { return &binding_; } |
49 | 50 |
50 void set_connection_error_handler(const Closure& handler) { | 51 void set_connection_error_handler(const base::Closure& handler) { |
51 binding_.set_connection_error_handler(handler); | 52 binding_.set_connection_error_handler(handler); |
52 } | 53 } |
53 | 54 |
54 private: | 55 private: |
55 AssociatedBinding<IntegerSender> binding_; | 56 AssociatedBinding<IntegerSender> binding_; |
56 base::Callback<void(int32_t)> notify_send_method_called_; | 57 base::Callback<void(int32_t)> notify_send_method_called_; |
57 }; | 58 }; |
58 | 59 |
59 class IntegerSenderConnectionImpl : public IntegerSenderConnection { | 60 class IntegerSenderConnectionImpl : public IntegerSenderConnection { |
60 public: | 61 public: |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 | 584 |
584 // The previous wait has dispatched the GetSender request message, therefore | 585 // The previous wait has dispatched the GetSender request message, therefore |
585 // an associated interface has been set up on the pipe. It is not allowed to | 586 // an associated interface has been set up on the pipe. It is not allowed to |
586 // wait or pause. | 587 // wait or pause. |
587 EXPECT_TRUE(connection.binding()->HasAssociatedInterfaces()); | 588 EXPECT_TRUE(connection.binding()->HasAssociatedInterfaces()); |
588 } | 589 } |
589 | 590 |
590 } // namespace | 591 } // namespace |
591 } // namespace test | 592 } // namespace test |
592 } // namespace mojo | 593 } // namespace mojo |
OLD | NEW |