| 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 <vector> | |
| 9 | |
| 10 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 11 #include "base/macros.h" | 9 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 15 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 16 #include "mojo/edk/embedder/process_delegate.h" | 14 #include "mojo/edk/embedder/process_delegate.h" |
| 17 #include "mojo/shell/application_manager.h" | 15 #include "mojo/shell/application_manager.h" |
| 18 #include "mojo/shell/runner/host/command_line_switch.h" | |
| 19 #include "mojo/shell/standalone/tracer.h" | 16 #include "mojo/shell/standalone/tracer.h" |
| 20 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 21 | 18 |
| 22 namespace base { | 19 namespace base { |
| 23 class SingleThreadTaskRunner; | 20 class SingleThreadTaskRunner; |
| 24 } | 21 } |
| 25 | 22 |
| 26 namespace mojo { | 23 namespace mojo { |
| 27 namespace shell { | 24 namespace shell { |
| 28 struct CommandLineSwitch; | 25 class NativeRunnerDelegate; |
| 29 | 26 |
| 30 // The "global" context for the shell's main process. | 27 // The "global" context for the shell's main process. |
| 31 class Context : public edk::ProcessDelegate { | 28 class Context : public edk::ProcessDelegate { |
| 32 public: | 29 public: |
| 33 Context(); | 30 Context(); |
| 34 ~Context() override; | 31 ~Context() override; |
| 35 | 32 |
| 36 static void EnsureEmbedderIsInitialized(); | 33 static void EnsureEmbedderIsInitialized(); |
| 37 | 34 |
| 38 void set_command_line_switches( | 35 void set_native_runner_delegate(NativeRunnerDelegate* delegate) { |
| 39 const std::vector<CommandLineSwitch>& command_line_switches) { | 36 native_runner_delegate_ = delegate; |
| 40 command_line_switches_ = command_line_switches; | |
| 41 } | 37 } |
| 42 | 38 |
| 43 // This must be called with a message loop set up for the current thread, | 39 // This must be called with a message loop set up for the current thread, |
| 44 // which must remain alive until after Shutdown() is called. | 40 // which must remain alive until after Shutdown() is called. |
| 45 void Init(const base::FilePath& shell_file_root); | 41 void Init(const base::FilePath& shell_file_root); |
| 46 | 42 |
| 47 // If Init() was called and succeeded, this must be called before destruction. | 43 // If Init() was called and succeeded, this must be called before destruction. |
| 48 void Shutdown(); | 44 void Shutdown(); |
| 49 | 45 |
| 50 // Run the application specified on the command line. | 46 // Run the application specified on the command line. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 63 | 59 |
| 64 scoped_refptr<base::SingleThreadTaskRunner> shell_runner_; | 60 scoped_refptr<base::SingleThreadTaskRunner> shell_runner_; |
| 65 scoped_ptr<base::Thread> io_thread_; | 61 scoped_ptr<base::Thread> io_thread_; |
| 66 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | 62 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
| 67 | 63 |
| 68 // Ensure this is destructed before task_runners_ since it owns a message pipe | 64 // Ensure this is destructed before task_runners_ since it owns a message pipe |
| 69 // that needs the IO thread to destruct cleanly. | 65 // that needs the IO thread to destruct cleanly. |
| 70 Tracer tracer_; | 66 Tracer tracer_; |
| 71 scoped_ptr<ApplicationManager> application_manager_; | 67 scoped_ptr<ApplicationManager> application_manager_; |
| 72 base::Time main_entry_time_; | 68 base::Time main_entry_time_; |
| 73 std::vector<CommandLineSwitch> command_line_switches_; | 69 |
| 70 NativeRunnerDelegate* native_runner_delegate_; |
| 74 | 71 |
| 75 DISALLOW_COPY_AND_ASSIGN(Context); | 72 DISALLOW_COPY_AND_ASSIGN(Context); |
| 76 }; | 73 }; |
| 77 | 74 |
| 78 } // namespace shell | 75 } // namespace shell |
| 79 } // namespace mojo | 76 } // namespace mojo |
| 80 | 77 |
| 81 #endif // MOJO_SHELL_STANDALONE_CONTEXT_H_ | 78 #endif // MOJO_SHELL_STANDALONE_CONTEXT_H_ |
| OLD | NEW |