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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
19 #include "mojo/public/cpp/bindings/associated_group.h" | |
20 #include "mojo/public/cpp/bindings/bindings_export.h" | 19 #include "mojo/public/cpp/bindings/bindings_export.h" |
21 #include "mojo/public/cpp/bindings/connection_error_callback.h" | 20 #include "mojo/public/cpp/bindings/connection_error_callback.h" |
22 #include "mojo/public/cpp/bindings/filter_chain.h" | 21 #include "mojo/public/cpp/bindings/filter_chain.h" |
23 #include "mojo/public/cpp/bindings/interface_endpoint_client.h" | 22 #include "mojo/public/cpp/bindings/interface_endpoint_client.h" |
24 #include "mojo/public/cpp/bindings/interface_id.h" | 23 #include "mojo/public/cpp/bindings/interface_id.h" |
25 #include "mojo/public/cpp/bindings/interface_ptr.h" | 24 #include "mojo/public/cpp/bindings/interface_ptr.h" |
26 #include "mojo/public/cpp/bindings/interface_ptr_info.h" | 25 #include "mojo/public/cpp/bindings/interface_ptr_info.h" |
27 #include "mojo/public/cpp/bindings/interface_request.h" | 26 #include "mojo/public/cpp/bindings/interface_request.h" |
28 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" | 27 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" |
29 #include "mojo/public/cpp/bindings/message_header_validator.h" | 28 #include "mojo/public/cpp/bindings/message_header_validator.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 endpoint_client_->set_connection_error_with_reason_handler(error_handler); | 61 endpoint_client_->set_connection_error_with_reason_handler(error_handler); |
63 } | 62 } |
64 | 63 |
65 bool is_bound() const { return !!router_; } | 64 bool is_bound() const { return !!router_; } |
66 | 65 |
67 MessagePipeHandle handle() const { | 66 MessagePipeHandle handle() const { |
68 DCHECK(is_bound()); | 67 DCHECK(is_bound()); |
69 return router_->handle(); | 68 return router_->handle(); |
70 } | 69 } |
71 | 70 |
72 AssociatedGroup* associated_group() { | |
73 return endpoint_client_ ? endpoint_client_->associated_group() : nullptr; | |
74 } | |
75 | |
76 void FlushForTesting(); | 71 void FlushForTesting(); |
77 | 72 |
78 void EnableTestingMode(); | 73 void EnableTestingMode(); |
79 | 74 |
80 protected: | 75 protected: |
81 void BindInternal(ScopedMessagePipeHandle handle, | 76 void BindInternal(ScopedMessagePipeHandle handle, |
82 scoped_refptr<base::SingleThreadTaskRunner> runner, | 77 scoped_refptr<base::SingleThreadTaskRunner> runner, |
83 const char* interface_name, | 78 const char* interface_name, |
84 std::unique_ptr<MessageReceiver> request_validator, | 79 std::unique_ptr<MessageReceiver> request_validator, |
85 bool passes_associated_kinds, | 80 bool passes_associated_kinds, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 private: | 119 private: |
125 typename Interface::template Stub_<ImplRefTraits> stub_; | 120 typename Interface::template Stub_<ImplRefTraits> stub_; |
126 | 121 |
127 DISALLOW_COPY_AND_ASSIGN(BindingState); | 122 DISALLOW_COPY_AND_ASSIGN(BindingState); |
128 }; | 123 }; |
129 | 124 |
130 } // namesapce internal | 125 } // namesapce internal |
131 } // namespace mojo | 126 } // namespace mojo |
132 | 127 |
133 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ | 128 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ |
OLD | NEW |