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

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: Review nit 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..0781a193810470290f3939f1709e5cd2754347d0 100644
--- a/mojo/public/cpp/application/lib/application_impl.cc
+++ b/mojo/public/cpp/application/lib/application_impl.cc
@@ -28,13 +28,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 +54,16 @@ ApplicationImpl::~ApplicationImpl() {
delete shell_watch_;
}
+void ApplicationImpl::Initialize(Array<String> args) {
+ assert(!initialized_);
viettrungluu 2014/09/15 17:26:19 You can actually use mojo/public/cpp/environment/l
DaveMoore 2014/09/15 22:35:08 Done.
+ initialized_ = true;
+ args_ = args.Pass();
+ delegate_->Initialize(this);
+}
+
ApplicationConnection* ApplicationImpl::ConnectToApplication(
const String& application_url) {
+ assert(initialized_);
viettrungluu 2014/09/15 17:26:19 "
DaveMoore 2014/09/15 22:35:08 Done.
ServiceProviderPtr out_service_provider;
shell_->ConnectToApplication(application_url, Get(&out_service_provider));
internal::ServiceRegistry* registry = new internal::ServiceRegistry(
@@ -71,11 +79,11 @@ ApplicationConnection* ApplicationImpl::ConnectToApplication(
}
void ApplicationImpl::BindShell(ScopedMessagePipeHandle shell_handle) {
+ initialized_ = false;
viettrungluu 2014/09/15 17:26:19 I don't think you need this. Maybe a MOJO_DCHECK(!
DaveMoore 2014/09/15 22:35:08 Removed. At one point this was where I initialized
shell_watch_ = new ShellPtrWatcher(this);
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,

Powered by Google App Engine
This is Rietveld 408576698