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

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

Issue 2832633002: Add PDF compositor service (Closed)
Patch Set: remove headers Created 3 years, 8 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 <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 service_manager {
27 class BinderRegistry;
28 }
29
26 namespace content { 30 namespace content {
27 class BrowserChildProcessHostImpl; 31 class BrowserChildProcessHostImpl;
28 class InProcessChildThreadParams; 32 class InProcessChildThreadParams;
29 33
30 typedef base::Thread* (*UtilityMainThreadFactoryFunction)( 34 typedef base::Thread* (*UtilityMainThreadFactoryFunction)(
31 const InProcessChildThreadParams&); 35 const InProcessChildThreadParams&);
32 36
33 class CONTENT_EXPORT UtilityProcessHostImpl 37 class CONTENT_EXPORT UtilityProcessHostImpl
34 : public NON_EXPORTED_BASE(UtilityProcessHost), 38 : public NON_EXPORTED_BASE(UtilityProcessHost),
35 public BrowserChildProcessHostDelegate { 39 public BrowserChildProcessHostDelegate {
(...skipping 17 matching lines...) Expand all
53 void ElevatePrivileges() override; 57 void ElevatePrivileges() override;
54 #endif 58 #endif
55 const ChildProcessData& GetData() override; 59 const ChildProcessData& GetData() override;
56 #if defined(OS_POSIX) 60 #if defined(OS_POSIX)
57 void SetEnv(const base::EnvironmentMap& env) override; 61 void SetEnv(const base::EnvironmentMap& env) override;
58 #endif 62 #endif
59 bool Start() override; 63 bool Start() override;
60 void BindInterface(const std::string& interface_name, 64 void BindInterface(const std::string& interface_name,
61 mojo::ScopedMessagePipeHandle interface_pipe) override; 65 mojo::ScopedMessagePipeHandle interface_pipe) override;
62 void SetName(const base::string16& name) override; 66 void SetName(const base::string16& name) override;
67 void RegisterMojoServices() override;
63 68
64 void set_child_flags(int flags) { child_flags_ = flags; } 69 void set_child_flags(int flags) { child_flags_ = flags; }
65 70
66 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) 71 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
67 // Launch the zygote early in the browser startup. 72 // Launch the zygote early in the browser startup.
68 static void EarlyZygoteLaunch(); 73 static void EarlyZygoteLaunch();
69 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) 74 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
70 75
71 private: 76 private:
72 // Starts a process if necessary. Returns true if it succeeded or a process 77 // Starts a process if necessary. Returns true if it succeeded or a process
73 // has already been started via StartBatchMode(). 78 // has already been started via StartBatchMode().
74 bool StartProcess(); 79 bool StartProcess();
75 80
76 // BrowserChildProcessHost: 81 // BrowserChildProcessHost:
77 bool OnMessageReceived(const IPC::Message& message) override; 82 bool OnMessageReceived(const IPC::Message& message) override;
78 void OnProcessLaunchFailed(int error_code) override; 83 void OnProcessLaunchFailed(int error_code) override;
79 void OnProcessCrashed(int exit_code) override; 84 void OnProcessCrashed(int exit_code) override;
80 85
81 // Cleans up |this| as a result of a failed Start(). 86 // Cleans up |this| as a result of a failed Start().
82 void NotifyAndDelete(int error_code); 87 void NotifyAndDelete(int error_code);
83 88
89 void RegisterMojoServicesOnUIThread(
90 service_manager::BinderRegistry* registry);
91
84 // Notifies the client that the launch failed and deletes |host|. 92 // Notifies the client that the launch failed and deletes |host|.
85 static void NotifyLaunchFailedAndDelete( 93 static void NotifyLaunchFailedAndDelete(
86 base::WeakPtr<UtilityProcessHostImpl> host, 94 base::WeakPtr<UtilityProcessHostImpl> host,
87 int error_code); 95 int error_code);
88 96
89 // A pointer to our client interface, who will be informed of progress. 97 // A pointer to our client interface, who will be informed of progress.
90 scoped_refptr<UtilityProcessHostClient> client_; 98 scoped_refptr<UtilityProcessHostClient> client_;
91 scoped_refptr<base::SequencedTaskRunner> client_task_runner_; 99 scoped_refptr<base::SequencedTaskRunner> client_task_runner_;
92 // True when running in batch mode, i.e., StartBatchMode() has been called 100 // True when running in batch mode, i.e., StartBatchMode() has been called
93 // and the utility process will run until EndBatchMode(). 101 // and the utility process will run until EndBatchMode().
(...skipping 25 matching lines...) Expand all
119 127
120 // Used to vend weak pointers, and should always be declared last. 128 // Used to vend weak pointers, and should always be declared last.
121 base::WeakPtrFactory<UtilityProcessHostImpl> weak_ptr_factory_; 129 base::WeakPtrFactory<UtilityProcessHostImpl> weak_ptr_factory_;
122 130
123 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHostImpl); 131 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHostImpl);
124 }; 132 };
125 133
126 } // namespace content 134 } // namespace content
127 135
128 #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ 136 #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698