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
3 // found in the LICENSE file.
5 #ifndef MOJO_SHELL_CHILD_PROCESS_H_
6 #define MOJO_SHELL_CHILD_PROCESS_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "mojo/embedder/scoped_platform_handle.h"
19 // A base class for child processes -- i.e., code that is actually run within
20 // the child process. (Instances are manufactured by |Create()|.)
25 // Hosts a single app (see app_child_process(_host).*).
29 virtual ~ChildProcess();
31 // Returns null if the command line doesn't indicate that this is a child
32 // process. |main()| should call this, and if it returns non-null it should
33 // call |Main()| (without a message loop on the current thread).
34 static scoped_ptr
<ChildProcess
> Create(const base::CommandLine
& command_line
);
36 // To be implemented by subclasses. This is the "entrypoint" for a child
37 // process. Run with no message loop for the main thread.
38 virtual void Main() = 0;
43 embedder::ScopedPlatformHandle
* platform_channel() {
44 return &platform_channel_
;
48 // Available in |Main()| (after a successful |Create()|).
49 embedder::ScopedPlatformHandle platform_channel_
;
51 DISALLOW_COPY_AND_ASSIGN(ChildProcess
);
57 #endif // MOJO_SHELL_CHILD_PROCESS_H_