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

Side by Side Diff: shell/child_process_host.h

Issue 1378303005: Do some plumbing. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: review Created 5 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 | « shell/application_manager/native_runner.h ('k') | shell/child_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 SHELL_CHILD_PROCESS_HOST_H_ 5 #ifndef SHELL_CHILD_PROCESS_HOST_H_
6 #define SHELL_CHILD_PROCESS_HOST_H_ 6 #define SHELL_CHILD_PROCESS_HOST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/process/process.h" 14 #include "base/process/process.h"
15 #include "mojo/edk/embedder/channel_info_forward.h" 15 #include "mojo/edk/embedder/channel_info_forward.h"
16 #include "mojo/edk/embedder/scoped_platform_handle.h" 16 #include "mojo/edk/embedder/scoped_platform_handle.h"
17 #include "shell/child_controller.mojom.h" 17 #include "shell/child_controller.mojom.h"
18 18
19 namespace shell { 19 namespace shell {
20 20
21 class Context; 21 class Context;
22 struct NativeApplicationOptions;
22 23
23 // Child process host: parent-process representation of a child process, which 24 // Child process host: parent-process representation of a child process, which
24 // hosts/runs a native Mojo application loaded from the file system. This class 25 // hosts/runs a native Mojo application loaded from the file system. This class
25 // handles launching and communicating with the child process. 26 // handles launching and communicating with the child process.
26 // 27 //
27 // This class is not thread-safe. It should be created/used/destroyed on a 28 // This class is not thread-safe. It should be created/used/destroyed on a
28 // single thread. 29 // single thread.
29 class ChildProcessHost { 30 class ChildProcessHost {
30 public: 31 public:
31 explicit ChildProcessHost(Context* context); 32 explicit ChildProcessHost(Context* context);
32 // TODO(vtl): Virtual because |DidStart()| is, even though it shouldn't be 33 // TODO(vtl): Virtual because |DidStart()| is, even though it shouldn't be
33 // (see |DidStart()|). 34 // (see |DidStart()|).
34 virtual ~ChildProcessHost(); 35 virtual ~ChildProcessHost();
35 36
36 // |Start()|s the child process; calls |DidStart()| (on the thread on which 37 // |Start()|s the child process; calls |DidStart()| (on the thread on which
37 // |Start()| was called) when the child has been started (or failed to start). 38 // |Start()| was called) when the child has been started (or failed to start).
38 // After calling |Start()|, this object must not be destroyed until 39 // After calling |Start()|, this object must not be destroyed until
39 // |DidStart()| has been called. 40 // |DidStart()| has been called.
40 // TODO(vtl): Consider using weak pointers and removing this requirement. 41 // TODO(vtl): Consider using weak pointers and removing this requirement.
41 // TODO(vtl): This should probably take a callback instead. 42 // TODO(vtl): This should probably take a callback instead.
42 // TODO(vtl): Consider merging this with |StartApp()|. 43 // TODO(vtl): Consider merging this with |StartApp()|.
43 void Start(bool require_32_bit); 44 void Start(const NativeApplicationOptions& options);
44 45
45 // Waits for the child process to terminate, and returns its exit code. 46 // Waits for the child process to terminate, and returns its exit code.
46 // Note: If |Start()| has been called, this must not be called until the 47 // Note: If |Start()| has been called, this must not be called until the
47 // callback has been called. 48 // callback has been called.
48 int Join(); 49 int Join();
49 50
50 // Methods relayed to the |ChildController|. These methods may be only be 51 // Methods relayed to the |ChildController|. These methods may be only be
51 // called after |Start()|, but may be called immediately (without waiting for 52 // called after |Start()|, but may be called immediately (without waiting for
52 // |DidStart()|). 53 // |DidStart()|).
53 54
(...skipping 29 matching lines...) Expand all
83 ChildController::StartAppCallback on_app_complete_; 84 ChildController::StartAppCallback on_app_complete_;
84 85
85 base::Process child_process_; 86 base::Process child_process_;
86 87
87 DISALLOW_COPY_AND_ASSIGN(ChildProcessHost); 88 DISALLOW_COPY_AND_ASSIGN(ChildProcessHost);
88 }; 89 };
89 90
90 } // namespace shell 91 } // namespace shell
91 92
92 #endif // SHELL_CHILD_PROCESS_HOST_H_ 93 #endif // SHELL_CHILD_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « shell/application_manager/native_runner.h ('k') | shell/child_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698