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

Unified Diff: services/shell/public/cpp/lib/interface_provider.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_provider.cc
diff --git a/services/shell/public/cpp/lib/interface_provider.cc b/services/shell/public/cpp/lib/interface_provider.cc
index 209d356ac476bb6a79d8cfc51f389500c8b297b7..0934ee15ce2803570448310547e73216da6a4a18 100644
--- a/services/shell/public/cpp/lib/interface_provider.cc
+++ b/services/shell/public/cpp/lib/interface_provider.cc
@@ -4,19 +4,32 @@
#include "services/shell/public/cpp/interface_provider.h"
+#include "base/macros.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+
namespace shell {
InterfaceProvider::InterfaceProvider() : weak_factory_(this) {
pending_request_ = GetProxy(&interface_provider_);
}
+
InterfaceProvider::~InterfaceProvider() {}
void InterfaceProvider::Bind(mojom::InterfaceProviderPtr interface_provider) {
DCHECK(pending_request_.is_pending());
+ DCHECK(forward_callback_.is_null());
mojo::FuseInterface(std::move(pending_request_),
interface_provider.PassInterface());
}
+void InterfaceProvider::Forward(const ForwardCallback& callback) {
+ DCHECK(pending_request_.is_pending());
+ DCHECK(forward_callback_.is_null());
+ interface_provider_.reset();
+ pending_request_.PassMessagePipe().reset();
+ forward_callback_ = callback;
+}
+
void InterfaceProvider::SetConnectionLostClosure(
const base::Closure& connection_lost_closure) {
interface_provider_.set_connection_error_handler(connection_lost_closure);
@@ -35,7 +48,14 @@ void InterfaceProvider::GetInterface(
it->second.Run(std::move(request_handle));
return;
}
- interface_provider_->GetInterface(name, std::move(request_handle));
+
+ if (!forward_callback_.is_null()) {
+ DCHECK(!interface_provider_.is_bound());
+ forward_callback_.Run(name, std::move(request_handle));
+ } else {
+ DCHECK(interface_provider_.is_bound());
+ interface_provider_->GetInterface(name, std::move(request_handle));
+ }
}
void InterfaceProvider::ClearBinders() {
« no previous file with comments | « services/shell/public/cpp/lib/connector_impl.cc ('k') | services/shell/public/cpp/lib/interface_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698