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

Unified Diff: services/shell/public/cpp/lib/interface_registry.cc

Issue 2111353002: Move content's shell connections to the IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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: services/shell/public/cpp/lib/interface_registry.cc
diff --git a/services/shell/public/cpp/lib/interface_registry.cc b/services/shell/public/cpp/lib/interface_registry.cc
index ebfaddd35ace806392e426ee68569432371092bd..b585eaee26654e0908cc5ed5ded2914e38909b1d 100644
--- a/services/shell/public/cpp/lib/interface_registry.cc
+++ b/services/shell/public/cpp/lib/interface_registry.cc
@@ -39,20 +39,29 @@ void InterfaceRegistry::RemoveInterface(const std::string& name) {
}
void InterfaceRegistry::PauseBinding() {
- DCHECK(!pending_request_.is_pending());
- DCHECK(binding_.is_bound());
- pending_request_ = binding_.Unbind();
+ DCHECK(!is_paused_);
+ is_paused_ = true;
}
void InterfaceRegistry::ResumeBinding() {
- DCHECK(pending_request_.is_pending());
- DCHECK(!binding_.is_bound());
- binding_.Bind(std::move(pending_request_));
+ DCHECK(is_paused_);
+ is_paused_ = false;
+
+ while (!pending_interface_requests_.empty()) {
+ auto& request = pending_interface_requests_.front();
+ GetInterface(request.first, std::move(request.second));
+ pending_interface_requests_.pop();
+ }
}
// mojom::InterfaceProvider:
void InterfaceRegistry::GetInterface(const mojo::String& interface_name,
mojo::ScopedMessagePipeHandle handle) {
+ if (is_paused_) {
+ pending_interface_requests_.emplace(interface_name, std::move(handle));
+ return;
+ }
+
auto iter = name_to_binder_.find(interface_name);
if (iter != name_to_binder_.end()) {
iter->second->BindInterface(connection_, interface_name, std::move(handle));
@@ -61,6 +70,8 @@ void InterfaceRegistry::GetInterface(const mojo::String& interface_name,
<< "interface: " << interface_name << " connection_name:"
<< connection_->GetConnectionName() << " remote_name:"
<< connection_->GetRemoteIdentity().name();
+ } else if (!default_binder_.is_null()) {
+ default_binder_.Run(interface_name, std::move(handle));
}
}
« no previous file with comments | « services/shell/public/cpp/lib/interface_provider.cc ('k') | services/shell/public/cpp/lib/service_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698