| OLD | NEW |
| (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 MOJO_SHELL_BACKGROUND_BACKGROUND_SHELL_H_ | |
| 6 #define MOJO_SHELL_BACKGROUND_BACKGROUND_SHELL_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "mojo/public/cpp/bindings/interface_request.h" | |
| 13 #include "mojo/services/catalog/store.h" | |
| 14 #include "mojo/shell/public/interfaces/shell_client.mojom.h" | |
| 15 | |
| 16 namespace catalog { | |
| 17 class Store; | |
| 18 } | |
| 19 | |
| 20 namespace mojo { | |
| 21 namespace shell { | |
| 22 | |
| 23 class NativeRunnerDelegate; | |
| 24 class Shell; | |
| 25 | |
| 26 // BackgroundShell starts up the mojo shell on a background thread, and | |
| 27 // destroys the thread in the destructor. Once created use CreateApplication() | |
| 28 // to obtain an InterfaceRequest for the Application. The InterfaceRequest can | |
| 29 // then be bound to an ApplicationImpl. | |
| 30 class BackgroundShell { | |
| 31 public: | |
| 32 struct InitParams { | |
| 33 InitParams(); | |
| 34 ~InitParams(); | |
| 35 | |
| 36 NativeRunnerDelegate* native_runner_delegate = nullptr; | |
| 37 scoped_ptr<catalog::Store> catalog_store; | |
| 38 // If true the edk is initialized. | |
| 39 bool init_edk = true; | |
| 40 }; | |
| 41 | |
| 42 BackgroundShell(); | |
| 43 ~BackgroundShell(); | |
| 44 | |
| 45 // Starts the background shell. |command_line_switches| are additional | |
| 46 // switches applied to any processes spawned by this call. | |
| 47 void Init(scoped_ptr<InitParams> init_params); | |
| 48 | |
| 49 // Obtains an InterfaceRequest for the specified name. | |
| 50 mojom::ShellClientRequest CreateShellClientRequest( | |
| 51 const std::string& name); | |
| 52 | |
| 53 // Use to do processing on the thread running the shell. The callback is | |
| 54 // supplied a pointer to the Shell. The callback does *not* own the Shell. | |
| 55 using ShellThreadCallback = base::Callback<void(Shell*)>; | |
| 56 void ExecuteOnShellThread(const ShellThreadCallback& callback); | |
| 57 | |
| 58 private: | |
| 59 class MojoThread; | |
| 60 | |
| 61 scoped_ptr<MojoThread> thread_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(BackgroundShell); | |
| 64 }; | |
| 65 | |
| 66 } // namespace shell | |
| 67 } // namespace mojo | |
| 68 | |
| 69 #endif // MOJO_SHELL_BACKGROUND_BACKGROUND_SHELL_H_ | |
| OLD | NEW |