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

Unified Diff: third_party/mojo/src/mojo/public/cpp/application/lib/application_impl.cc

Issue 883843002: Update mojo sdk to rev 126532ce21c5c3c55a1e1693731411cb60169efd (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review Created 5 years, 11 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/application/lib/application_impl.cc
diff --git a/third_party/mojo/src/mojo/public/cpp/application/lib/application_impl.cc b/third_party/mojo/src/mojo/public/cpp/application/lib/application_impl.cc
index 894060d8bf2eb064a7585c442429622c4320d8da..4d1f8dcf3442827c84090373b6a7e2f06c1048fd 100644
--- a/third_party/mojo/src/mojo/public/cpp/application/lib/application_impl.cc
+++ b/third_party/mojo/src/mojo/public/cpp/application/lib/application_impl.cc
@@ -25,15 +25,11 @@ class ApplicationImpl::ShellPtrWatcher : public ErrorHandler {
};
ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate,
- ScopedMessagePipeHandle shell_handle)
- : initialized_(false), delegate_(delegate), shell_watch_(nullptr) {
- BindShell(shell_handle.Pass());
-}
-
-ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate,
- MojoHandle shell_handle)
- : initialized_(false), delegate_(delegate), shell_watch_(nullptr) {
- BindShell(MakeScopedHandle(MessagePipeHandle(shell_handle)));
+ InterfaceRequest<Application> request)
+ : initialized_(false),
+ delegate_(delegate),
+ binding_(this, request.Pass()),
+ shell_watch_(nullptr) {
}
bool ApplicationImpl::HasArg(const std::string& arg) const {
@@ -60,7 +56,7 @@ ApplicationImpl::~ApplicationImpl() {
ApplicationConnection* ApplicationImpl::ConnectToApplication(
const String& application_url) {
- MOJO_CHECK(initialized_);
+ MOJO_CHECK(shell_);
ServiceProviderPtr local_services;
InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services);
ServiceProviderPtr remote_services;
@@ -76,29 +72,24 @@ ApplicationConnection* ApplicationImpl::ConnectToApplication(
return registry;
}
-bool ApplicationImpl::WaitForInitialize() {
- MOJO_CHECK(!initialized_);
- bool result = shell_.WaitForIncomingMethodCall();
- MOJO_CHECK(initialized_ || !result);
- return result;
-}
-
-ScopedMessagePipeHandle ApplicationImpl::UnbindShell() {
- return shell_.PassMessagePipe();
-}
-
-void ApplicationImpl::Initialize(Array<String> args) {
- MOJO_CHECK(!initialized_);
- initialized_ = true;
+void ApplicationImpl::Initialize(ShellPtr shell, Array<String> args) {
+ shell_ = shell.Pass();
+ shell_watch_ = new ShellPtrWatcher(this);
+ shell_.set_error_handler(shell_watch_);
args_ = args.To<std::vector<std::string>>();
delegate_->Initialize(this);
}
-void ApplicationImpl::BindShell(ScopedMessagePipeHandle shell_handle) {
- shell_watch_ = new ShellPtrWatcher(this);
- shell_.Bind(shell_handle.Pass());
- shell_.set_client(this);
- shell_.set_error_handler(shell_watch_);
+void ApplicationImpl::WaitForInitialize() {
+ if (!shell_)
+ binding_.WaitForIncomingMethodCall();
+}
+
+void ApplicationImpl::UnbindConnections(
+ InterfaceRequest<Application>* application_request,
+ ShellPtr* shell) {
+ *application_request = binding_.Unbind();
+ shell->Bind(shell_.PassMessagePipe());
}
void ApplicationImpl::AcceptConnection(

Powered by Google App Engine
This is Rietveld 408576698