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

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

Issue 568173003: Add Initialize() method to Application with ability to send args using (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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: mojo/public/cpp/application/lib/application_impl.cc
diff --git a/mojo/public/cpp/application/lib/application_impl.cc b/mojo/public/cpp/application/lib/application_impl.cc
index 469ba3a9417f242f218b274c707892ff740b70e2..fc3857f5c992991918500269ef73f98878b6cdd2 100644
--- a/mojo/public/cpp/application/lib/application_impl.cc
+++ b/mojo/public/cpp/application/lib/application_impl.cc
@@ -7,6 +7,7 @@
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/lib/service_registry.h"
#include "mojo/public/cpp/bindings/interface_ptr.h"
+#include "mojo/public/cpp/environment/logging.h"
namespace mojo {
@@ -28,13 +29,13 @@ class ApplicationImpl::ShellPtrWatcher : public ErrorHandler {
ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate,
ScopedMessagePipeHandle shell_handle)
- : delegate_(delegate), shell_watch_(NULL) {
+ : initialized_(false), delegate_(delegate), shell_watch_(NULL) {
BindShell(shell_handle.Pass());
}
ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate,
MojoHandle shell_handle)
- : delegate_(delegate), shell_watch_(NULL) {
+ : initialized_(false), delegate_(delegate), shell_watch_(NULL) {
BindShell(MakeScopedHandle(MessagePipeHandle(shell_handle)));
}
@@ -54,8 +55,16 @@ ApplicationImpl::~ApplicationImpl() {
delete shell_watch_;
}
+void ApplicationImpl::Initialize(Array<String> args) {
+ MOJO_CHECK(!initialized_);
+ initialized_ = true;
+ args_ = args.Pass();
+ delegate_->Initialize(this);
+}
+
ApplicationConnection* ApplicationImpl::ConnectToApplication(
const String& application_url) {
+ MOJO_CHECK(initialized_);
ServiceProviderPtr out_service_provider;
shell_->ConnectToApplication(application_url, Get(&out_service_provider));
internal::ServiceRegistry* registry = new internal::ServiceRegistry(
@@ -75,7 +84,6 @@ void ApplicationImpl::BindShell(ScopedMessagePipeHandle shell_handle) {
shell_.Bind(shell_handle.Pass());
shell_.set_client(this);
shell_.set_error_handler(shell_watch_);
- delegate_->Initialize(this);
}
void ApplicationImpl::AcceptConnection(const String& requestor_url,
« no previous file with comments | « mojo/public/cpp/application/application_impl.h ('k') | mojo/public/interfaces/application/application.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698