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

Unified Diff: third_party/mojo/src/mojo/public/cpp/bindings/lib/interface_ptr_internal.h

Issue 1127293003: Update mojo sdk to rev f84766d3b6420b7cf6a113d9d65d73cb5fe18d90 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: formatting Created 5 years, 7 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: third_party/mojo/src/mojo/public/cpp/bindings/lib/interface_ptr_internal.h
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/interface_ptr_internal.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/interface_ptr_internal.h
index 2778eefa5748b135b3bfd1e30f80feaa97532e56..cd3803fd371221885d110dc6dee0930ba5a54004 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/interface_ptr_internal.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/interface_ptr_internal.h
@@ -8,6 +8,7 @@
#include <algorithm> // For |std::swap()|.
#include "mojo/public/cpp/bindings/interface_ptr_info.h"
+#include "mojo/public/cpp/bindings/lib/control_message_proxy.h"
#include "mojo/public/cpp/bindings/lib/filter_chain.h"
#include "mojo/public/cpp/bindings/lib/message_header_validator.h"
#include "mojo/public/cpp/bindings/lib/router.h"
@@ -41,6 +42,33 @@ class InterfacePtrState {
uint32_t version() const { return version_; }
+ void QueryVersion(const Callback<void(uint32_t)>& callback) {
+ ConfigureProxyIfNecessary();
+
+ // It is safe to capture |this| because the callback won't be run after this
+ // object goes away.
+ auto callback_wrapper = [this, callback](uint32_t version) {
+ this->version_ = version;
+ callback.Run(version);
+ };
+
+ // Do a static cast in case the interface contains methods with the same
+ // name.
+ static_cast<ControlMessageProxy*>(proxy_)->QueryVersion(callback_wrapper);
+ }
+
+ void RequireVersion(uint32_t version) {
+ ConfigureProxyIfNecessary();
+
+ if (version <= version_)
+ return;
+
+ version_ = version;
+ // Do a static cast in case the interface contains methods with the same
+ // name.
+ static_cast<ControlMessageProxy*>(proxy_)->RequireVersion(version);
+ }
+
void Swap(InterfacePtrState* other) {
using std::swap;
swap(other->proxy_, proxy_);

Powered by Google App Engine
This is Rietveld 408576698