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

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

Issue 9235052: Fix race condition in utility process clients (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync to ToT Created 8 years, 11 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/browser/plugin_loader_posix.cc ('k') | content/browser/utility_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 CONTENT_BROWSER_UTILITY_PROCESS_HOST_H_ 5 #ifndef CONTENT_BROWSER_UTILITY_PROCESS_HOST_H_
6 #define CONTENT_BROWSER_UTILITY_PROCESS_HOST_H_ 6 #define CONTENT_BROWSER_UTILITY_PROCESS_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/process_util.h" 14 #include "base/process_util.h"
15 #include "base/memory/weak_ptr.h"
15 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
16 #include "content/public/browser/browser_child_process_host_delegate.h" 17 #include "content/public/browser/browser_child_process_host_delegate.h"
17 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
18 #include "ipc/ipc_message.h" 19 #include "ipc/ipc_message.h"
19 20
20 class BrowserChildProcessHostImpl; 21 class BrowserChildProcessHostImpl;
21 22
22 // This class acts as the browser-side host to a utility child process. A 23 // This class acts as the browser-side host to a utility child process. A
23 // utility process is a short-lived sandboxed process that is created to run 24 // utility process is a short-lived sandboxed process that is created to run
24 // a specific task. This class lives solely on the IO thread. 25 // a specific task. This class lives solely on the IO thread.
25 // If you need a single method call in the sandbox, use StartFooBar(p). 26 // If you need a single method call in the sandbox, use StartFooBar(p).
26 // If you need multiple batches of work to be done in the sandboxed process, 27 // If you need multiple batches of work to be done in the sandboxed process,
27 // use StartBatchMode(), then multiple calls to StartFooBar(p), 28 // use StartBatchMode(), then multiple calls to StartFooBar(p),
28 // then finish with EndBatchMode(). 29 // then finish with EndBatchMode().
30 //
31 // Note: If your class keeps a ptr to an object of this type, grab a weak ptr to
32 // avoid a use after free. See http://crbug.com/108871.
29 class CONTENT_EXPORT UtilityProcessHost 33 class CONTENT_EXPORT UtilityProcessHost
30 : public content::BrowserChildProcessHostDelegate, 34 : public content::BrowserChildProcessHostDelegate,
31 public IPC::Message::Sender { 35 public IPC::Message::Sender,
36 public base::SupportsWeakPtr<UtilityProcessHost> {
32 public: 37 public:
33 // An interface to be implemented by consumers of the utility process to 38 // An interface to be implemented by consumers of the utility process to
34 // get results back. All functions are called on the thread passed along 39 // get results back. All functions are called on the thread passed along
35 // to UtilityProcessHost. 40 // to UtilityProcessHost.
36 class CONTENT_EXPORT Client : public base::RefCountedThreadSafe<Client> { 41 class CONTENT_EXPORT Client : public base::RefCountedThreadSafe<Client> {
37 public: 42 public:
38 Client(); 43 Client();
39 44
40 // Called when the process has crashed. 45 // Called when the process has crashed.
41 virtual void OnProcessCrashed(int exit_code); 46 virtual void OnProcessCrashed(int exit_code);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 base::environment_vector env_; 119 base::environment_vector env_;
115 120
116 bool started_; 121 bool started_;
117 122
118 scoped_ptr<BrowserChildProcessHostImpl> process_; 123 scoped_ptr<BrowserChildProcessHostImpl> process_;
119 124
120 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHost); 125 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHost);
121 }; 126 };
122 127
123 #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_H_ 128 #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/plugin_loader_posix.cc ('k') | content/browser/utility_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698