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_UTILITY_PROCESS_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ |
6 #define CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "content/public/browser/browser_child_process_host_delegate.h" | 18 #include "content/public/browser/browser_child_process_host_delegate.h" |
19 #include "content/public/browser/utility_process_host.h" | 19 #include "content/public/browser/utility_process_host.h" |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 class SequencedTaskRunner; | 22 class SequencedTaskRunner; |
23 class Thread; | 23 class Thread; |
24 } | 24 } |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 class BrowserChildProcessHostImpl; | 27 class BrowserChildProcessHostImpl; |
28 class InProcessChildThreadParams; | 28 class InProcessChildThreadParams; |
29 class MojoApplicationHost; | 29 class MojoChildConnection; |
30 | 30 |
31 typedef base::Thread* (*UtilityMainThreadFactoryFunction)( | 31 typedef base::Thread* (*UtilityMainThreadFactoryFunction)( |
32 const InProcessChildThreadParams&); | 32 const InProcessChildThreadParams&); |
33 | 33 |
34 class CONTENT_EXPORT UtilityProcessHostImpl | 34 class CONTENT_EXPORT UtilityProcessHostImpl |
35 : public NON_EXPORTED_BASE(UtilityProcessHost), | 35 : public NON_EXPORTED_BASE(UtilityProcessHost), |
36 public BrowserChildProcessHostDelegate { | 36 public BrowserChildProcessHostDelegate { |
37 public: | 37 public: |
38 static void RegisterUtilityMainThreadFactory( | 38 static void RegisterUtilityMainThreadFactory( |
39 UtilityMainThreadFactoryFunction create); | 39 UtilityMainThreadFactoryFunction create); |
(...skipping 11 matching lines...) Expand all Loading... |
51 void SetExposedDir(const base::FilePath& dir) override; | 51 void SetExposedDir(const base::FilePath& dir) override; |
52 void DisableSandbox() override; | 52 void DisableSandbox() override; |
53 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
54 void ElevatePrivileges() override; | 54 void ElevatePrivileges() override; |
55 #endif | 55 #endif |
56 const ChildProcessData& GetData() override; | 56 const ChildProcessData& GetData() override; |
57 #if defined(OS_POSIX) | 57 #if defined(OS_POSIX) |
58 void SetEnv(const base::EnvironmentMap& env) override; | 58 void SetEnv(const base::EnvironmentMap& env) override; |
59 #endif | 59 #endif |
60 bool Start() override; | 60 bool Start() override; |
61 ServiceRegistry* GetServiceRegistry() override; | 61 shell::InterfaceRegistry* GetInterfaceRegistry() override; |
| 62 shell::InterfaceProvider* GetRemoteInterfaces() override; |
62 void SetName(const base::string16& name) override; | 63 void SetName(const base::string16& name) override; |
63 | 64 |
64 void set_child_flags(int flags) { child_flags_ = flags; } | 65 void set_child_flags(int flags) { child_flags_ = flags; } |
65 | 66 |
66 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 67 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
67 // Launch the zygote early in the browser startup. | 68 // Launch the zygote early in the browser startup. |
68 static void EarlyZygoteLaunch(); | 69 static void EarlyZygoteLaunch(); |
69 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 70 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
70 | 71 |
71 private: | 72 private: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // A user-visible name identifying this process. Used to indentify this | 112 // A user-visible name identifying this process. Used to indentify this |
112 // process in the task manager. | 113 // process in the task manager. |
113 base::string16 name_; | 114 base::string16 name_; |
114 | 115 |
115 std::unique_ptr<BrowserChildProcessHostImpl> process_; | 116 std::unique_ptr<BrowserChildProcessHostImpl> process_; |
116 | 117 |
117 // Used in single-process mode instead of process_. | 118 // Used in single-process mode instead of process_. |
118 std::unique_ptr<base::Thread> in_process_thread_; | 119 std::unique_ptr<base::Thread> in_process_thread_; |
119 | 120 |
120 // Browser-side Mojo endpoint which sets up a Mojo channel with the child | 121 // Browser-side Mojo endpoint which sets up a Mojo channel with the child |
121 // process and contains the browser's ServiceRegistry. | 122 // process and contains the browser's shell::InterfaceRegistry. |
122 const std::string child_token_; | 123 const std::string child_token_; |
123 std::unique_ptr<MojoApplicationHost> mojo_application_host_; | 124 std::unique_ptr<MojoChildConnection> mojo_child_connection_; |
124 | 125 |
125 // Used to vend weak pointers, and should always be declared last. | 126 // Used to vend weak pointers, and should always be declared last. |
126 base::WeakPtrFactory<UtilityProcessHostImpl> weak_ptr_factory_; | 127 base::WeakPtrFactory<UtilityProcessHostImpl> weak_ptr_factory_; |
127 | 128 |
128 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHostImpl); | 129 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHostImpl); |
129 }; | 130 }; |
130 | 131 |
131 } // namespace content | 132 } // namespace content |
132 | 133 |
133 #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ | 134 #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ |
OLD | NEW |