Index: chrome/service/service_utility_process_host.h |
=================================================================== |
--- chrome/service/service_utility_process_host.h (revision 112597) |
+++ chrome/service/service_utility_process_host.h (working copy) |
@@ -14,11 +14,15 @@ |
#include "base/basictypes.h" |
#include "base/file_path.h" |
#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/process.h" |
#include "base/task.h" |
#include "ipc/ipc_channel.h" |
-#include "chrome/service/service_child_process_host.h" |
+#include "content/public/common/child_process_host_delegate.h" |
#include "printing/pdf_render_settings.h" |
+class ChildProcessHost; |
+class CommandLine; |
class ScopedTempDir; |
namespace base { |
@@ -34,7 +38,7 @@ |
// Acts as the service-side host to a utility child process. A |
// utility process is a short-lived sandboxed process that is created to run |
// a specific task. |
-class ServiceUtilityProcessHost : public ServiceChildProcessHost { |
+class ServiceUtilityProcessHost : public content::ChildProcessHostDelegate { |
public: |
// Consumers of ServiceUtilityProcessHost must implement this interface to |
// get results back. All functions are called on the thread passed along |
@@ -101,9 +105,11 @@ |
// Allows this method to be overridden for tests. |
virtual FilePath GetUtilityProcessCmd(); |
- // ChildProcessHost implementation. |
+ // ChildProcessHostDelegate implementation: |
virtual bool CanShutdown() OVERRIDE; |
- virtual void OnChildDied() OVERRIDE; |
+ virtual void OnChildDisconnected() OVERRIDE; |
+ virtual void ShutdownStarted() OVERRIDE; |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
private: |
// Starts a process. Returns true iff it succeeded. |exposed_dir| is the |
@@ -111,22 +117,26 @@ |
// true. |
bool StartProcess(bool no_sandbox, const FilePath& exposed_dir); |
- // IPC messages: |
- virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
- // Called when at least one page in the specified PDF has been rendered |
- // successfully into metafile_path_; |
+ // Launch the child process synchronously. |
+ // TODO(sanjeevr): Determine whether we need to make the launch asynchronous. |
+ // |exposed_dir| is the path to tbe exposed to the sandbox. This is ignored |
+ // if |no_sandbox| is true. |
+ bool Launch(CommandLine* cmd_line, |
+ bool no_sandbox, |
+ const FilePath& exposed_dir); |
+ |
+ base::ProcessHandle handle() const { return handle_; } |
+ |
+ // Messages handlers: |
void OnRenderPDFPagesToMetafileSucceeded(int highest_rendered_page_number); |
- // Called when PDF rendering failed. |
void OnRenderPDFPagesToMetafileFailed(); |
- // Called when the printer capabilities and defaults have been |
- // retrieved successfully. |
void OnGetPrinterCapsAndDefaultsSucceeded( |
const std::string& printer_name, |
const printing::PrinterCapsAndDefaults& caps_and_defaults); |
- // Called when the printer capabilities and defaults could not be |
- // retrieved successfully. |
void OnGetPrinterCapsAndDefaultsFailed(const std::string& printer_name); |
+ scoped_ptr<ChildProcessHost> child_process_host_; |
+ base::ProcessHandle handle_; |
// A pointer to our client interface, who will be informed of progress. |
scoped_refptr<Client> client_; |
scoped_refptr<base::MessageLoopProxy> client_message_loop_proxy_; |