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

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, 4 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
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..7c72e4c8163b1c878815696683305aaf192b8ed5 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) {
@@ -88,7 +90,10 @@ class AssociatedInterfacePtrState {
endpoint_client_.reset(new InterfaceEndpointClient(
info.PassHandle(), nullptr,
base::WrapUnique(new typename Interface::ResponseValidator_()), false,
- std::move(runner)));
+ std::move(runner),
+ // The version is only queried from the client so the value passed here
yzshen1 2016/08/31 17:06:46 style nit: please move to comment out of the state
Sam McNally 2016/09/01 00:44:36 Done.
+ // will not be used.
+ 0u));
proxy_.reset(new Proxy(endpoint_client_.get()));
proxy_->serialization_context()->group_controller =
endpoint_client_->group_controller();

Powered by Google App Engine
This is Rietveld 408576698