OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ | 5 #ifndef CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ |
6 #define CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ | 6 #define CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 const gfx::Rect& render_area, | 100 const gfx::Rect& render_area, |
101 int render_dpi, | 101 int render_dpi, |
102 const std::vector<printing::PageRange>& page_ranges); | 102 const std::vector<printing::PageRange>& page_ranges); |
103 | 103 |
104 // Starts a process to get capabilities and defaults for the specified | 104 // Starts a process to get capabilities and defaults for the specified |
105 // printer. Used on Windows to isolate the service process from printer driver | 105 // printer. Used on Windows to isolate the service process from printer driver |
106 // crashes by executing this in a separate process. The process does not run | 106 // crashes by executing this in a separate process. The process does not run |
107 // in a sandbox. | 107 // in a sandbox. |
108 bool StartGetPrinterCapsAndDefaults(const std::string& printer_name); | 108 bool StartGetPrinterCapsAndDefaults(const std::string& printer_name); |
109 | 109 |
110 // Getter of unique process id for this process. | |
111 int unique_process_id(); | |
jam
2011/09/19 16:31:17
no need for this getter since it's only used in th
arthurhsu
2011/09/19 18:22:51
Done.
| |
112 | |
110 protected: | 113 protected: |
111 // Allows this method to be overridden for tests. | 114 // Allows this method to be overridden for tests. |
112 virtual FilePath GetUtilityProcessCmd(); | 115 virtual FilePath GetUtilityProcessCmd(); |
113 | 116 |
114 // Overriden from ChildProcessHost. | 117 // Overriden from ChildProcessHost. |
115 virtual bool CanShutdown(); | 118 virtual bool CanShutdown(); |
116 virtual void OnChildDied(); | 119 virtual void OnChildDied(); |
117 | 120 |
118 private: | 121 private: |
119 // Starts a process. Returns true iff it succeeded. |exposed_dir| is the | 122 // Starts a process. Returns true iff it succeeded. |exposed_dir| is the |
120 // path to tbe exposed to the sandbox. This is ignored if |no_sandbox| is | 123 // path to tbe exposed to the sandbox. This is ignored if |no_sandbox| is |
121 // true. | 124 // true. |
122 bool StartProcess(bool no_sandbox, const FilePath& exposed_dir); | 125 bool StartProcess(bool no_sandbox, const FilePath& exposed_dir); |
123 | 126 |
124 // IPC messages: | 127 // IPC messages: |
125 virtual bool OnMessageReceived(const IPC::Message& message); | 128 virtual bool OnMessageReceived(const IPC::Message& message); |
126 // Called when at least one page in the specified PDF has been rendered | 129 // Called when at least one page in the specified PDF has been rendered |
127 // successfully into metafile_path_; | 130 // successfully into metafile_path_; |
128 void OnRenderPDFPagesToMetafileSucceeded(int highest_rendered_page_number); | 131 void OnRenderPDFPagesToMetafileSucceeded(int highest_rendered_page_number); |
129 // Any other messages to be handled by the client. | 132 // Any other messages to be handled by the client. |
130 bool MessageForClient(const IPC::Message& message); | 133 bool MessageForClient(const IPC::Message& message); |
131 | 134 |
132 #if defined(OS_WIN) // This hack is Windows-specific. | 135 #if defined(OS_WIN) // This hack is Windows-specific. |
133 void OnPreCacheFont(const LOGFONT& font); | 136 void OnPreCacheFont(const LOGFONT& font); |
137 void OnReleaseCachedFonts(); | |
134 #endif // defined(OS_WIN) | 138 #endif // defined(OS_WIN) |
135 | 139 |
136 // A pointer to our client interface, who will be informed of progress. | 140 // A pointer to our client interface, who will be informed of progress. |
137 scoped_refptr<Client> client_; | 141 scoped_refptr<Client> client_; |
138 scoped_refptr<base::MessageLoopProxy> client_message_loop_proxy_; | 142 scoped_refptr<base::MessageLoopProxy> client_message_loop_proxy_; |
139 bool waiting_for_reply_; | 143 bool waiting_for_reply_; |
140 // The path to the temp file where the metafile will be written to. | 144 // The path to the temp file where the metafile will be written to. |
141 FilePath metafile_path_; | 145 FilePath metafile_path_; |
142 // The temporary folder created for the metafile. | 146 // The temporary folder created for the metafile. |
143 scoped_ptr<ScopedTempDir> scratch_metafile_dir_; | 147 scoped_ptr<ScopedTempDir> scratch_metafile_dir_; |
148 // The unique id created for the process. | |
149 int unique_process_id_; | |
jam
2011/09/19 16:31:17
nit: this should just be called process_id_ to be
arthurhsu
2011/09/19 18:22:51
Done.
| |
144 | 150 |
145 DISALLOW_COPY_AND_ASSIGN(ServiceUtilityProcessHost); | 151 DISALLOW_COPY_AND_ASSIGN(ServiceUtilityProcessHost); |
146 }; | 152 }; |
147 | 153 |
148 #endif // CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ | 154 #endif // CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ |
OLD | NEW |