Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Unified Diff: mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h

Issue 2280483002: Add FlushForTesting to InterfacePtr and Binding. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr.h ('k') | mojo/public/cpp/bindings/lib/binding_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..30a3c428e92ccbe21bdadbce7a6480417fa9546b 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,11 @@ 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() {
+ endpoint_client_->control_message_proxy()->FlushForTesting();
}
void Swap(AssociatedInterfacePtrState* other) {
@@ -85,10 +87,12 @@ class AssociatedInterfacePtrState {
DCHECK(info.is_valid());
version_ = info.version();
+ // The version is only queried from the client so the value passed here
+ // will not be used.
endpoint_client_.reset(new InterfaceEndpointClient(
info.PassHandle(), 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();
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr.h ('k') | mojo/public/cpp/bindings/lib/binding_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698