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

Unified Diff: mojo/shell/in_thread_application_loader.cc

Issue 1414463005: mojo: Add InThreadApplicationLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « mojo/shell/in_thread_application_loader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/in_thread_application_loader.cc
diff --git a/mojo/shell/in_thread_application_loader.cc b/mojo/shell/in_thread_application_loader.cc
new file mode 100644
index 0000000000000000000000000000000000000000..40ef382bb4fc0888767de40b540b079ec42bed48
--- /dev/null
+++ b/mojo/shell/in_thread_application_loader.cc
@@ -0,0 +1,45 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/shell/in_thread_application_loader.h"
+
+#include "base/bind.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/task_runner.h"
+#include "base/thread_task_runner_handle.h"
+#include "mojo/application/public/cpp/application_delegate.h"
+#include "mojo/application/public/cpp/application_impl.h"
+#include "mojo/application/public/interfaces/application.mojom.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
+
+namespace mojo {
+namespace shell {
+
+InThreadApplicationLoader::InThreadApplicationLoader(
+ const ApplicationFactory& factory)
+ : InThreadApplicationLoader(factory, base::Closure()) {}
+
+InThreadApplicationLoader::InThreadApplicationLoader(
+ const ApplicationFactory& factory,
+ const base::Closure& termination_closure)
+ : factory_(factory),
+ termination_closure_(termination_closure),
+ weak_factory_(this) {}
+
+InThreadApplicationLoader::~InThreadApplicationLoader() {}
+
+void InThreadApplicationLoader::Load(const GURL& url,
+ InterfaceRequest<Application> request) {
+ // TODO(xhwang): Handle repeating Load requests?
+
+ application_delegate_ = factory_.Run();
+ DCHECK(application_delegate_);
+
+ application_impl_.reset(new ApplicationImpl(
+ application_delegate_.get(), request.Pass(), termination_closure_));
+}
+
+} // namespace shell
+} // namespace mojo
« no previous file with comments | « mojo/shell/in_thread_application_loader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698