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

Side by Side Diff: mojo/shell/standalone/context.h

Issue 1877753003: Move mojo\shell to services\shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@62scan
Patch Set: . Created 4 years, 8 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/standalone/DEPS ('k') | mojo/shell/standalone/context.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 2013 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 MOJO_SHELL_STANDALONE_CONTEXT_H_
6 #define MOJO_SHELL_STANDALONE_CONTEXT_H_
7
8 #include "base/callback_forward.h"
9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/threading/thread.h"
13 #include "base/time/time.h"
14 #include "mojo/edk/embedder/process_delegate.h"
15 #include "mojo/shell/shell.h"
16 #include "mojo/shell/standalone/tracer.h"
17
18 namespace base {
19 class SingleThreadTaskRunner;
20 }
21
22 namespace catalog {
23 class Factory;
24 class Store;
25 }
26
27 namespace mojo {
28 namespace shell {
29 class NativeRunnerDelegate;
30
31 // The "global" context for the shell's main process.
32 class Context : public edk::ProcessDelegate {
33 public:
34 struct InitParams {
35 InitParams();
36 ~InitParams();
37
38 NativeRunnerDelegate* native_runner_delegate = nullptr;
39 scoped_ptr<catalog::Store> catalog_store;
40 // If true the edk is initialized.
41 bool init_edk = true;
42 };
43
44 Context();
45 ~Context() override;
46
47 static void EnsureEmbedderIsInitialized();
48
49 // This must be called with a message loop set up for the current thread,
50 // which must remain alive until after Shutdown() is called.
51 void Init(scoped_ptr<InitParams> init_params);
52
53 // If Init() was called and succeeded, this must be called before destruction.
54 void Shutdown();
55
56 // Run the application specified on the command line.
57 void RunCommandLineApplication();
58
59 Shell* shell() { return shell_.get(); }
60
61 private:
62 // edk::ProcessDelegate:
63 void OnShutdownComplete() override;
64
65 // Runs the app specified by |name|.
66 void Run(const std::string& name);
67
68 scoped_refptr<base::SingleThreadTaskRunner> shell_runner_;
69 scoped_ptr<base::Thread> io_thread_;
70 scoped_refptr<base::SequencedWorkerPool> blocking_pool_;
71
72 // Ensure this is destructed before task_runners_ since it owns a message pipe
73 // that needs the IO thread to destruct cleanly.
74 Tracer tracer_;
75 scoped_ptr<catalog::Factory> catalog_;
76 scoped_ptr<Shell> shell_;
77 base::Time main_entry_time_;
78 bool init_edk_ = false;
79
80 DISALLOW_COPY_AND_ASSIGN(Context);
81 };
82
83 } // namespace shell
84 } // namespace mojo
85
86 #endif // MOJO_SHELL_STANDALONE_CONTEXT_H_
OLDNEW
« no previous file with comments | « mojo/shell/standalone/DEPS ('k') | mojo/shell/standalone/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698