Index: mojo/public/cpp/bindings/lib/interface_ptr_state.h |
diff --git a/mojo/public/cpp/bindings/lib/interface_ptr_state.h b/mojo/public/cpp/bindings/lib/interface_ptr_state.h |
index 37d5b876608f62dc2495bf414a6b8fd861f9550f..635a9136d61b235defe91e793c7dd12ce1bddc1a 100644 |
--- a/mojo/public/cpp/bindings/lib/interface_ptr_state.h |
+++ b/mojo/public/cpp/bindings/lib/interface_ptr_state.h |
@@ -23,6 +23,7 @@ |
#include "mojo/public/cpp/bindings/interface_endpoint_client.h" |
#include "mojo/public/cpp/bindings/interface_id.h" |
#include "mojo/public/cpp/bindings/interface_ptr_info.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/lib/multiplex_router.h" |
#include "mojo/public/cpp/bindings/lib/router.h" |
@@ -64,12 +65,10 @@ class InterfacePtrState<Interface, false> { |
void QueryVersion(const base::Callback<void(uint32_t)>& callback) { |
ConfigureProxyIfNecessary(); |
- // 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_)->QueryVersion( |
- base::Bind(&InterfacePtrState::OnQueryVersion, base::Unretained(this), |
- callback)); |
+ // It is safe to capture |this| because the callback won't be run after this |
+ // object goes away. |
+ router_->control_message_proxy()->QueryVersion(base::Bind( |
+ &InterfacePtrState::OnQueryVersion, base::Unretained(this), callback)); |
} |
void RequireVersion(uint32_t version) { |
@@ -79,9 +78,16 @@ class InterfacePtrState<Interface, false> { |
return; |
version_ = version; |
- // Do a static cast in case the interface contains methods with the same |
- // name. |
- static_cast<ControlMessageProxy*>(proxy_)->RequireVersion(version); |
+ router_->control_message_proxy()->RequireVersion(version); |
+ } |
+ |
+ void FlushForTesting() { |
+ ConfigureProxyIfNecessary(); |
+ |
+ if (encountered_error() || !router_) |
+ return; |
+ |
+ router_->control_message_proxy()->FlushForTesting(); |
} |
void Swap(InterfacePtrState* other) { |
@@ -158,7 +164,7 @@ class InterfacePtrState<Interface, false> { |
filters.Append<typename Interface::ResponseValidator_>(); |
router_ = new Router(std::move(handle_), std::move(filters), false, |
- std::move(runner_)); |
+ std::move(runner_), 0); |
proxy_ = new Proxy(router_); |
} |
@@ -209,13 +215,10 @@ class InterfacePtrState<Interface, true> { |
void QueryVersion(const base::Callback<void(uint32_t)>& callback) { |
ConfigureProxyIfNecessary(); |
- |
- // 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(&InterfacePtrState::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( |
+ &InterfacePtrState::OnQueryVersion, base::Unretained(this), callback)); |
} |
void RequireVersion(uint32_t version) { |
@@ -225,9 +228,16 @@ class InterfacePtrState<Interface, true> { |
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() { |
+ ConfigureProxyIfNecessary(); |
+ |
+ if (encountered_error() || !proxy_) |
+ return; |
+ |
+ endpoint_client_->control_message_proxy()->FlushForTesting(); |
} |
void Swap(InterfacePtrState* other) { |
@@ -314,7 +324,7 @@ class InterfacePtrState<Interface, true> { |
endpoint_client_.reset(new InterfaceEndpointClient( |
router_->CreateLocalEndpointHandle(kMasterInterfaceId), nullptr, |
base::WrapUnique(new typename Interface::ResponseValidator_()), false, |
- std::move(runner_))); |
+ std::move(runner_), 0u)); |
proxy_.reset(new Proxy(endpoint_client_.get())); |
proxy_->serialization_context()->group_controller = |
endpoint_client_->group_controller(); |