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

Side by Side Diff: components/nacl/browser/nacl_process_host.h

Issue 1117883002: Reduce resource leak code for StartNaClExecution. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ 5 #ifndef COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_
6 #define COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ 6 #define COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #include <vector> 10 #include <vector>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // render_view_id: RenderView routing id, to control access to private APIs. 67 // render_view_id: RenderView routing id, to control access to private APIs.
68 // permission_bits: controls which interfaces the NaCl plugin can use. 68 // permission_bits: controls which interfaces the NaCl plugin can use.
69 // uses_nonsfi_mode: whether the program should be loaded under non-SFI mode. 69 // uses_nonsfi_mode: whether the program should be loaded under non-SFI mode.
70 // off_the_record: was the process launched from an incognito renderer? 70 // off_the_record: was the process launched from an incognito renderer?
71 // process_type: the type of NaCl process. 71 // process_type: the type of NaCl process.
72 // profile_directory: is the path of current profile directory. 72 // profile_directory: is the path of current profile directory.
73 NaClProcessHost( 73 NaClProcessHost(
74 const GURL& manifest_url, 74 const GURL& manifest_url,
75 base::File nexe_file, 75 base::File nexe_file,
76 const NaClFileToken& nexe_token, 76 const NaClFileToken& nexe_token,
77 const std::vector<NaClResourcePrefetchResult>& prefetched_resource_files, 77 const std::vector<NaClResourcePrefetchRequest>&
78 resource_prefetch_request_list,
78 ppapi::PpapiPermissions permissions, 79 ppapi::PpapiPermissions permissions,
79 int render_view_id, 80 int render_view_id,
80 uint32 permission_bits, 81 uint32 permission_bits,
81 bool uses_nonsfi_mode, 82 bool uses_nonsfi_mode,
82 bool off_the_record, 83 bool off_the_record,
83 NaClAppProcessType process_type, 84 NaClAppProcessType process_type,
84 const base::FilePath& profile_directory); 85 const base::FilePath& profile_directory);
85 ~NaClProcessHost() override; 86 ~NaClProcessHost() override;
86 87
87 void OnProcessCrashed(int exit_status) override; 88 void OnProcessCrashed(int exit_status) override;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 void SendErrorToRenderer(const std::string& error_message); 154 void SendErrorToRenderer(const std::string& error_message);
154 155
155 // Sends the reply message to the renderer. Either result or 156 // Sends the reply message to the renderer. Either result or
156 // error message must be empty. 157 // error message must be empty.
157 void SendMessageToRenderer(const NaClLaunchResult& result, 158 void SendMessageToRenderer(const NaClLaunchResult& result,
158 const std::string& error_message); 159 const std::string& error_message);
159 160
160 // Sends the message to the NaCl process to load the plugin. Returns true 161 // Sends the message to the NaCl process to load the plugin. Returns true
161 // on success. 162 // on success.
162 bool StartNaClExecution(); 163 bool StartNaClExecution();
163 164 void StartNaClExecutionAfterFileResolved(
164 void StartNaClFileResolved(
165 NaClStartParams params, 165 NaClStartParams params,
166 const base::FilePath& file_path, 166 scoped_ptr<base::FilePath> nexe_file_path,
167 scoped_ptr<std::vector<NaClResourcePrefetchResult> >
168 prefetched_resource_files,
167 base::File nexe_file); 169 base::File nexe_file);
168 170
169 #if defined(OS_LINUX) 171 #if defined(OS_LINUX)
170 // Creates a pair of IPC::ChannelHandle. Returns true on success. 172 // Creates a pair of IPC::ChannelHandle. Returns true on success.
171 static bool CreateChannelHandlePair(ScopedChannelHandle* channel_handle1, 173 static bool CreateChannelHandlePair(ScopedChannelHandle* channel_handle1,
172 ScopedChannelHandle* channel_handle2); 174 ScopedChannelHandle* channel_handle2);
173 #endif 175 #endif
174 176
175 // Starts browser PPAPI proxy. Returns true on success. 177 // Starts browser PPAPI proxy. Returns true on success.
176 bool StartPPAPIProxy(ScopedChannelHandle channel_handle); 178 bool StartPPAPIProxy(ScopedChannelHandle channel_handle);
(...skipping 24 matching lines...) Expand all
201 // created. 203 // created.
202 void OnPpapiChannelsCreated( 204 void OnPpapiChannelsCreated(
203 const IPC::ChannelHandle& ppapi_browser_channel_handle, 205 const IPC::ChannelHandle& ppapi_browser_channel_handle,
204 const IPC::ChannelHandle& ppapi_renderer_channel_handle, 206 const IPC::ChannelHandle& ppapi_renderer_channel_handle,
205 const IPC::ChannelHandle& trusted_renderer_channel_handle, 207 const IPC::ChannelHandle& trusted_renderer_channel_handle,
206 const IPC::ChannelHandle& manifest_service_channel_handle); 208 const IPC::ChannelHandle& manifest_service_channel_handle);
207 209
208 GURL manifest_url_; 210 GURL manifest_url_;
209 base::File nexe_file_; 211 base::File nexe_file_;
210 NaClFileToken nexe_token_; 212 NaClFileToken nexe_token_;
211 std::vector<NaClResourcePrefetchResult> prefetched_resource_files_; 213 std::vector<NaClResourcePrefetchRequest> resource_prefetch_request_list_;
212 214
213 ppapi::PpapiPermissions permissions_; 215 ppapi::PpapiPermissions permissions_;
214 216
215 #if defined(OS_WIN) 217 #if defined(OS_WIN)
216 // This field becomes true when the broker successfully launched 218 // This field becomes true when the broker successfully launched
217 // the NaCl loader. 219 // the NaCl loader.
218 bool process_launched_by_broker_; 220 bool process_launched_by_broker_;
219 #endif 221 #endif
220 // The NaClHostMessageFilter that requested this NaCl process. We use 222 // The NaClHostMessageFilter that requested this NaCl process. We use
221 // this for sending the reply once the process has started. 223 // this for sending the reply once the process has started.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 base::File socket_for_sel_ldr_; 265 base::File socket_for_sel_ldr_;
264 266
265 base::WeakPtrFactory<NaClProcessHost> weak_factory_; 267 base::WeakPtrFactory<NaClProcessHost> weak_factory_;
266 268
267 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); 269 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost);
268 }; 270 };
269 271
270 } // namespace nacl 272 } // namespace nacl
271 273
272 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ 274 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « components/nacl/browser/nacl_host_message_filter.cc ('k') | components/nacl/browser/nacl_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698