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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « mojo/shell/in_thread_application_loader.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mojo/shell/in_thread_application_loader.h"
6
7 #include "base/bind.h"
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/task_runner.h"
11 #include "base/thread_task_runner_handle.h"
12 #include "mojo/application/public/cpp/application_delegate.h"
13 #include "mojo/application/public/cpp/application_impl.h"
14 #include "mojo/application/public/interfaces/application.mojom.h"
15 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
16
17 namespace mojo {
18 namespace shell {
19
20 InThreadApplicationLoader::InThreadApplicationLoader(
21 const ApplicationFactory& factory)
22 : InThreadApplicationLoader(factory, base::Closure()) {}
23
24 InThreadApplicationLoader::InThreadApplicationLoader(
25 const ApplicationFactory& factory,
26 const base::Closure& termination_closure)
27 : factory_(factory),
28 termination_closure_(termination_closure),
29 weak_factory_(this) {}
30
31 InThreadApplicationLoader::~InThreadApplicationLoader() {}
32
33 void InThreadApplicationLoader::Load(const GURL& url,
34 InterfaceRequest<Application> request) {
35 // TODO(xhwang): Handle repeating Load requests?
36
37 application_delegate_ = factory_.Run();
38 DCHECK(application_delegate_);
39
40 application_impl_.reset(new ApplicationImpl(
41 application_delegate_.get(), request.Pass(), termination_closure_));
42 }
43
44 } // namespace shell
45 } // namespace mojo
OLDNEW
« 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