OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MOJO_SHELL_STANDALONE_CONTEXT_H_ | 5 #ifndef MOJO_SHELL_STANDALONE_CONTEXT_H_ |
6 #define MOJO_SHELL_STANDALONE_CONTEXT_H_ | 6 #define MOJO_SHELL_STANDALONE_CONTEXT_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "mojo/edk/embedder/process_delegate.h" | 14 #include "mojo/edk/embedder/process_delegate.h" |
15 #include "mojo/shell/application_manager.h" | 15 #include "mojo/shell/shell.h" |
16 #include "mojo/shell/standalone/tracer.h" | 16 #include "mojo/shell/standalone/tracer.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class SingleThreadTaskRunner; | 19 class SingleThreadTaskRunner; |
20 } | 20 } |
21 | 21 |
22 namespace package_manager { | 22 namespace package_manager { |
23 class ApplicationCatalogStore; | 23 class ApplicationCatalogStore; |
24 } | 24 } |
25 | 25 |
(...skipping 20 matching lines...) Expand all Loading... |
46 // This must be called with a message loop set up for the current thread, | 46 // This must be called with a message loop set up for the current thread, |
47 // which must remain alive until after Shutdown() is called. | 47 // which must remain alive until after Shutdown() is called. |
48 void Init(scoped_ptr<InitParams> init_params); | 48 void Init(scoped_ptr<InitParams> init_params); |
49 | 49 |
50 // If Init() was called and succeeded, this must be called before destruction. | 50 // If Init() was called and succeeded, this must be called before destruction. |
51 void Shutdown(); | 51 void Shutdown(); |
52 | 52 |
53 // Run the application specified on the command line. | 53 // Run the application specified on the command line. |
54 void RunCommandLineApplication(); | 54 void RunCommandLineApplication(); |
55 | 55 |
56 ApplicationManager* application_manager() { | 56 Shell* shell() { return shell_.get(); } |
57 return application_manager_.get(); | |
58 } | |
59 | 57 |
60 private: | 58 private: |
61 // edk::ProcessDelegate: | 59 // edk::ProcessDelegate: |
62 void OnShutdownComplete() override; | 60 void OnShutdownComplete() override; |
63 | 61 |
64 // Runs the app specified by |name|. | 62 // Runs the app specified by |name|. |
65 void Run(const std::string& name); | 63 void Run(const std::string& name); |
66 | 64 |
67 scoped_refptr<base::SingleThreadTaskRunner> shell_runner_; | 65 scoped_refptr<base::SingleThreadTaskRunner> shell_runner_; |
68 scoped_ptr<base::Thread> io_thread_; | 66 scoped_ptr<base::Thread> io_thread_; |
69 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | 67 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
70 | 68 |
71 // Ensure this is destructed before task_runners_ since it owns a message pipe | 69 // Ensure this is destructed before task_runners_ since it owns a message pipe |
72 // that needs the IO thread to destruct cleanly. | 70 // that needs the IO thread to destruct cleanly. |
73 Tracer tracer_; | 71 Tracer tracer_; |
74 scoped_ptr<ApplicationManager> application_manager_; | 72 scoped_ptr<Shell> shell_; |
75 base::Time main_entry_time_; | 73 base::Time main_entry_time_; |
76 | 74 |
77 DISALLOW_COPY_AND_ASSIGN(Context); | 75 DISALLOW_COPY_AND_ASSIGN(Context); |
78 }; | 76 }; |
79 | 77 |
80 } // namespace shell | 78 } // namespace shell |
81 } // namespace mojo | 79 } // namespace mojo |
82 | 80 |
83 #endif // MOJO_SHELL_STANDALONE_CONTEXT_H_ | 81 #endif // MOJO_SHELL_STANDALONE_CONTEXT_H_ |
OLD | NEW |