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

Side by Side Diff: content/browser/utility_process_host_impl.h

Issue 940813003: Use a utility process for the Mojo v8 proxy resolver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8-pac-in-process-enable
Patch Set: Remove unneeded forward decl. Created 5 years, 9 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
OLDNEW
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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
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/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "content/public/browser/browser_child_process_host_delegate.h" 17 #include "content/public/browser/browser_child_process_host_delegate.h"
18 #include "content/public/browser/utility_process_host.h" 18 #include "content/public/browser/utility_process_host.h"
19 19
20 namespace base { 20 namespace base {
21 class SequencedTaskRunner; 21 class SequencedTaskRunner;
22 class Thread; 22 class Thread;
23 } 23 }
24 24
25 namespace content { 25 namespace content {
26 class BrowserChildProcessHostImpl; 26 class BrowserChildProcessHostImpl;
27 class MojoApplicationHost;
27 28
28 typedef base::Thread* (*UtilityMainThreadFactoryFunction)( 29 typedef base::Thread* (*UtilityMainThreadFactoryFunction)(
29 const std::string& id); 30 const std::string& id);
30 31
31 class CONTENT_EXPORT UtilityProcessHostImpl 32 class CONTENT_EXPORT UtilityProcessHostImpl
32 : public NON_EXPORTED_BASE(UtilityProcessHost), 33 : public NON_EXPORTED_BASE(UtilityProcessHost),
33 public BrowserChildProcessHostDelegate { 34 public BrowserChildProcessHostDelegate {
34 public: 35 public:
35 static void RegisterUtilityMainThreadFactory( 36 static void RegisterUtilityMainThreadFactory(
36 UtilityMainThreadFactoryFunction create); 37 UtilityMainThreadFactoryFunction create);
(...skipping 10 matching lines...) Expand all
47 void SetExposedDir(const base::FilePath& dir) override; 48 void SetExposedDir(const base::FilePath& dir) override;
48 void EnableMDns() override; 49 void EnableMDns() override;
49 void DisableSandbox() override; 50 void DisableSandbox() override;
50 #if defined(OS_WIN) 51 #if defined(OS_WIN)
51 void ElevatePrivileges() override; 52 void ElevatePrivileges() override;
52 #endif 53 #endif
53 const ChildProcessData& GetData() override; 54 const ChildProcessData& GetData() override;
54 #if defined(OS_POSIX) 55 #if defined(OS_POSIX)
55 void SetEnv(const base::EnvironmentMap& env) override; 56 void SetEnv(const base::EnvironmentMap& env) override;
56 #endif 57 #endif
58 bool StartMojoMode() override;
59 ServiceRegistry* GetServiceRegistry() override;
57 60
58 void set_child_flags(int flags) { child_flags_ = flags; } 61 void set_child_flags(int flags) { child_flags_ = flags; }
59 62
60 private: 63 private:
61 // Starts a process if necessary. Returns true if it succeeded or a process 64 // Starts a process if necessary. Returns true if it succeeded or a process
62 // has already been started via StartBatchMode(). 65 // has already been started via StartBatchMode().
63 bool StartProcess(); 66 bool StartProcess();
64 67
65 // BrowserChildProcessHost: 68 // BrowserChildProcessHost:
66 bool OnMessageReceived(const IPC::Message& message) override; 69 bool OnMessageReceived(const IPC::Message& message) override;
67 void OnProcessLaunchFailed() override; 70 void OnProcessLaunchFailed() override;
68 void OnProcessCrashed(int exit_code) override; 71 void OnProcessCrashed(int exit_code) override;
72 void OnProcessLaunched() override;
69 73
70 // A pointer to our client interface, who will be informed of progress. 74 // A pointer to our client interface, who will be informed of progress.
71 scoped_refptr<UtilityProcessHostClient> client_; 75 scoped_refptr<UtilityProcessHostClient> client_;
72 scoped_refptr<base::SequencedTaskRunner> client_task_runner_; 76 scoped_refptr<base::SequencedTaskRunner> client_task_runner_;
73 // True when running in batch mode, i.e., StartBatchMode() has been called 77 // True when running in batch mode, i.e., StartBatchMode() has been called
74 // and the utility process will run until EndBatchMode(). 78 // and the utility process will run until EndBatchMode().
75 bool is_batch_mode_; 79 bool is_batch_mode_;
76 80
77 base::FilePath exposed_dir_; 81 base::FilePath exposed_dir_;
78 82
(...skipping 12 matching lines...) Expand all
91 95
92 base::EnvironmentMap env_; 96 base::EnvironmentMap env_;
93 97
94 bool started_; 98 bool started_;
95 99
96 scoped_ptr<BrowserChildProcessHostImpl> process_; 100 scoped_ptr<BrowserChildProcessHostImpl> process_;
97 101
98 // Used in single-process mode instead of process_. 102 // Used in single-process mode instead of process_.
99 scoped_ptr<base::Thread> in_process_thread_; 103 scoped_ptr<base::Thread> in_process_thread_;
100 104
105 // Browser-side Mojo endpoint which sets up a Mojo channel with the child
106 // process and contains the browser's ServiceRegistry.
107 scoped_ptr<MojoApplicationHost> mojo_application_host_;
108
101 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHostImpl); 109 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHostImpl);
102 }; 110 };
103 111
104 } // namespace content 112 } // namespace content
105 113
106 #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ 114 #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/utility/chrome_content_utility_client.cc ('k') | content/browser/utility_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698