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

Side by Side Diff: content/common/mojo/embedded_application_runner.h

Issue 2398783002: Rename a bunch of Mojo Application stuff to reference Services. (Closed)
Patch Set: . Created 4 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 | « content/common/mojo/OWNERS ('k') | content/common/mojo/embedded_application_runner.cc » ('j') | 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 2016 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 #ifndef CONTENT_COMMON_MOJO_EMBEDDED_APPLICATION_RUNNER_H_
6 #define CONTENT_COMMON_MOJO_EMBEDDED_APPLICATION_RUNNER_H_
7
8 #include <memory>
9
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/single_thread_task_runner.h"
15 #include "base/strings/string_piece.h"
16 #include "content/public/common/mojo_application_info.h"
17 #include "services/shell/public/cpp/service.h"
18 #include "services/shell/public/interfaces/service.mojom.h"
19
20 namespace content {
21
22 // Hosts an in-process application instance that supports multiple Service
23 // connections. The first incoming connection will invoke a provided factory
24 // function to instantiate the application, and the application will
25 // automatically be torn down when its last connection is lost. The application
26 // may be launched and torn down multiple times by a single
27 // EmbeddedApplicationRunner instance.
28 class EmbeddedApplicationRunner {
29 public:
30 // Constructs a runner which hosts a Mojo application. If an existing instance
31 // of the app is not running when an incoming connection is made, details from
32 // |info| will be used to construct a new instance.
33 EmbeddedApplicationRunner(const base::StringPiece& name,
34 const MojoApplicationInfo& info);
35 ~EmbeddedApplicationRunner();
36
37 // Binds an incoming ServiceRequest for this application. If the
38 // application isn't already running, it's started. Otherwise the request is
39 // bound to the running instance.
40 void BindServiceRequest(shell::mojom::ServiceRequest request);
41
42 // Sets a callback to run after the application loses its last connection and
43 // is torn down.
44 void SetQuitClosure(const base::Closure& quit_closure);
45
46 private:
47 class Instance;
48
49 void OnQuit();
50
51 // A reference to the application instance which may operate on the
52 // |application_task_runner_|'s thread.
53 scoped_refptr<Instance> instance_;
54
55 base::Closure quit_closure_;
56
57 base::WeakPtrFactory<EmbeddedApplicationRunner> weak_factory_;
58
59 DISALLOW_COPY_AND_ASSIGN(EmbeddedApplicationRunner);
60 };
61
62 } // namespace content
63
64 #endif // CONTENT_COMMON_MOJO_EMBEDDED_APPLICATION_RUNNER_H_
OLDNEW
« no previous file with comments | « content/common/mojo/OWNERS ('k') | content/common/mojo/embedded_application_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698