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

Unified Diff: content/public/browser/browser_associated_interface.h

Issue 2400663003: Use a binding set for BrowserAssociatedInterface (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/browser_associated_interface.h
diff --git a/content/public/browser/browser_associated_interface.h b/content/public/browser/browser_associated_interface.h
index ca12ff29b446593e88beb777b3ad6a0114c90961..3942fe6b18cebac1cb989dac7a9776add1c33e2f 100644
--- a/content/public/browser/browser_associated_interface.h
+++ b/content/public/browser/browser_associated_interface.h
@@ -14,7 +14,7 @@
#include "content/public/browser/browser_message_filter.h"
#include "content/public/browser/browser_thread.h"
#include "ipc/ipc_channel_proxy.h"
-#include "mojo/public/cpp/bindings/associated_binding.h"
+#include "mojo/public/cpp/bindings/associated_binding_set.h"
#include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
namespace content {
@@ -76,7 +76,7 @@ class BrowserAssociatedInterface {
base::Bind(&InternalState::Initialize, this));
return;
}
- binding_.reset(new mojo::AssociatedBinding<Interface>(impl_));
+ bindings_.reset(new mojo::AssociatedBindingSet<Interface>);
}
void ShutDown() {
@@ -85,19 +85,16 @@ class BrowserAssociatedInterface {
base::Bind(&InternalState::ShutDown, this));
return;
}
- binding_.reset();
+ bindings_.reset();
}
void BindRequest(mojo::ScopedInterfaceEndpointHandle handle) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- // If this interface has already been shut down or is already bound, we
- // drop the request.
- if (!binding_ || binding_->is_bound())
+ // If this interface has already been shut down we drop the request.
+ if (!bindings_)
return;
-
- binding_->Bind(mojo::MakeAssociatedRequest<Interface>(std::move(handle)));
- binding_->set_connection_error_handler(
- base::Bind(&InternalState::ShutDown, base::Unretained(this)));
+ bindings_->AddBinding(
+ impl_, mojo::MakeAssociatedRequest<Interface>(std::move(handle)));
}
private:
@@ -106,7 +103,7 @@ class BrowserAssociatedInterface {
~InternalState() {}
Interface* impl_;
- std::unique_ptr<mojo::AssociatedBinding<Interface>> binding_;
+ std::unique_ptr<mojo::AssociatedBindingSet<Interface>> bindings_;
DISALLOW_COPY_AND_ASSIGN(InternalState);
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698