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

Side by Side Diff: content/public/browser/utility_process_host.h

Issue 9317074: Create an API around UtilityProcessHost and use that from chrome. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/browser/utility_process_host_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_HOST_H_
6 #define CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_HOST_H_
7 #pragma once
8
9 #include "base/process_util.h"
10 #include "content/common/content_export.h"
11 #include "content/public/browser/browser_thread.h"
12 #include "ipc/ipc_message.h"
13
14 class FilePath;
15
16 namespace content {
17
18 class UtilityProcessHostClient;
19
20 // This class acts as the browser-side host to a utility child process. A
21 // utility process is a short-lived process that is created to run a specific
22 // task. This class lives solely on the IO thread.
23 // If you need a single method call in the process, use StartFooBar(p).
24 // If you need multiple batches of work to be done in the process, use
25 // StartBatchMode(), then multiple calls to StartFooBar(p), then finish with
26 // EndBatchMode().
27 //
28 // Note: If your class keeps a ptr to an object of this type, grab a weak ptr to
29 // avoid a use after free since this object is deleted synchronously but the
30 // client notification is asynchronous. See http://crbug.com/108871.
31 class UtilityProcessHost : public IPC::Message::Sender,
32 public base::SupportsWeakPtr<UtilityProcessHost> {
33 public:
34 // Used to create a utility process.
35 static CONTENT_EXPORT UtilityProcessHost* Create(
36 UtilityProcessHostClient* client,
37 BrowserThread::ID client_thread_id);
38
39 virtual ~UtilityProcessHost() {}
40
41 // Starts utility process in batch mode. Caller must call EndBatchMode()
42 // to finish the utility process.
43 virtual bool StartBatchMode() = 0;
44
45 // Ends the utility process. Must be called after StartBatchMode().
46 virtual void EndBatchMode() = 0;
47
48 // Allows a directory to be opened through the sandbox, in case it's needed by
49 // the operation.
50 virtual void SetExposedDir(const FilePath& dir) = 0;
51
52 // Make the process run without a sandbox.
53 virtual void DisableSandbox() = 0;
54
55 // If the sandbox is being used and we are on Linux, launch the process from
56 // the zygote. Can only be used for tasks that do not require FS access.
57 virtual void EnableZygote() = 0;
58
59 #if defined(OS_POSIX)
60 virtual void SetEnv(const base::environment_vector& env) = 0;
61 #endif
62 };
63
64 }; // namespace content
65
66 #endif // CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/browser/utility_process_host_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698