OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ | 5 #ifndef CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ |
6 #define CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ | 6 #define CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "content/public/browser/file_descriptor_info.h" |
12 | 13 |
13 class CommandLine; | 14 class CommandLine; |
14 | 15 |
15 // Launches a process asynchronously and notifies the client of the process | 16 // Launches a process asynchronously and notifies the client of the process |
16 // handle when it's available. It's used to avoid blocking the calling thread | 17 // handle when it's available. It's used to avoid blocking the calling thread |
17 // on the OS since often it can take > 100 ms to create the process. | 18 // on the OS since often it can take > 100 ms to create the process. |
18 class CONTENT_EXPORT ChildProcessLauncher { | 19 class CONTENT_EXPORT ChildProcessLauncher { |
19 public: | 20 public: |
20 class CONTENT_EXPORT Client { | 21 class CONTENT_EXPORT Client { |
21 public: | 22 public: |
22 // Will be called on the thread that the ChildProcessLauncher was | 23 // Will be called on the thread that the ChildProcessLauncher was |
23 // constructed on. | 24 // constructed on. |
24 virtual void OnProcessLaunched() = 0; | 25 // |mapped_files| contains the list of FDs that have been mapped in the |
| 26 // created process (passed through the |
| 27 // ContentBrowserClient::GetAdditionalMappedFilesForChildProcess call). |
| 28 virtual void OnProcessLaunched(const content::FDInfoList& mapped_files) = 0; |
25 | 29 |
26 protected: | 30 protected: |
27 virtual ~Client() {} | 31 virtual ~Client() {} |
28 }; | 32 }; |
29 | 33 |
30 // Launches the process asynchronously, calling the client when the result is | 34 // Launches the process asynchronously, calling the client when the result is |
31 // ready. Deleting this object before the process is created is safe, since | 35 // ready. Deleting this object before the process is created is safe, since |
32 // the callback won't be called. If the process is still running by the time | 36 // the callback won't be called. If the process is still running by the time |
33 // this object destructs, it will be terminated. | 37 // this object destructs, it will be terminated. |
34 // Takes ownership of cmd_line. | 38 // Takes ownership of cmd_line. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 70 |
67 private: | 71 private: |
68 class Context; | 72 class Context; |
69 | 73 |
70 scoped_refptr<Context> context_; | 74 scoped_refptr<Context> context_; |
71 | 75 |
72 DISALLOW_COPY_AND_ASSIGN(ChildProcessLauncher); | 76 DISALLOW_COPY_AND_ASSIGN(ChildProcessLauncher); |
73 }; | 77 }; |
74 | 78 |
75 #endif // CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ | 79 #endif // CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ |
OLD | NEW |