Index: mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h |
diff --git a/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h b/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h |
index c7f74fbb9c370cc76ba0cc3ffe5d0688d9f8c35d..1cfc5d61986d5cbed70a9d6dc522ff5b9d4eb96e 100644 |
--- a/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h |
+++ b/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h |
@@ -22,6 +22,7 @@ |
#include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" |
#include "mojo/public/cpp/bindings/interface_endpoint_client.h" |
#include "mojo/public/cpp/bindings/interface_id.h" |
+#include "mojo/public/cpp/bindings/lib/control_message_handler.h" |
#include "mojo/public/cpp/bindings/lib/control_message_proxy.h" |
#include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" |
#include "mojo/public/cpp/system/message_pipe.h" |
@@ -52,12 +53,11 @@ class AssociatedInterfacePtrState { |
} |
void QueryVersion(const base::Callback<void(uint32_t)>& callback) { |
- // Do a static cast in case the interface contains methods with the same |
- // name. It is safe to capture |this| because the callback won't be run |
- // after this object goes away. |
- static_cast<ControlMessageProxy*>(proxy_.get()) |
- ->QueryVersion(base::Bind(&AssociatedInterfacePtrState::OnQueryVersion, |
- base::Unretained(this), callback)); |
+ // It is safe to capture |this| because the callback won't be run after this |
+ // object goes away. |
+ endpoint_client_->control_message_proxy()->QueryVersion( |
+ base::Bind(&AssociatedInterfacePtrState::OnQueryVersion, |
+ base::Unretained(this), callback)); |
} |
void RequireVersion(uint32_t version) { |
@@ -65,9 +65,14 @@ class AssociatedInterfacePtrState { |
return; |
version_ = version; |
- // Do a static cast in case the interface contains methods with the same |
- // name. |
- static_cast<ControlMessageProxy*>(proxy_.get())->RequireVersion(version); |
+ endpoint_client_->control_message_proxy()->RequireVersion(version); |
+ } |
+ |
+ void FlushForTesting() { |
+ if (encountered_error() || !proxy_) |
yzshen1
2016/08/29 23:24:58
Does it make sense to remove this check? (Currentl
Sam McNally
2016/08/30 03:05:51
Done.
|
+ return; |
+ |
+ endpoint_client_->control_message_proxy()->FlushForTesting(); |
} |
void Swap(AssociatedInterfacePtrState* other) { |
@@ -88,7 +93,7 @@ class AssociatedInterfacePtrState { |
endpoint_client_.reset(new InterfaceEndpointClient( |
info.PassHandle(), nullptr, |
base::WrapUnique(new typename Interface::ResponseValidator_()), false, |
- std::move(runner))); |
+ std::move(runner), 0u)); |
yzshen1
2016/08/29 23:24:58
Please comment on why we use 0 here. It might not
Sam McNally
2016/08/30 03:05:51
Done.
|
proxy_.reset(new Proxy(endpoint_client_.get())); |
proxy_->serialization_context()->group_controller = |
endpoint_client_->group_controller(); |
@@ -132,6 +137,10 @@ class AssociatedInterfacePtrState { |
callback.Run(version); |
} |
+ void OnConnectionError() { |
yzshen1
2016/08/29 23:24:58
I think this is not used.
Sam McNally
2016/08/30 03:05:51
Done.
|
+ endpoint_client_->control_message_proxy()->OnConnectionError(); |
+ } |
+ |
std::unique_ptr<InterfaceEndpointClient> endpoint_client_; |
std::unique_ptr<Proxy> proxy_; |