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

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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 void SendErrorToRenderer(const std::string& error_message); 152 void SendErrorToRenderer(const std::string& error_message);
152 153
153 // Sends the reply message to the renderer. Either result or 154 // Sends the reply message to the renderer. Either result or
154 // error message must be empty. 155 // error message must be empty.
155 void SendMessageToRenderer(const NaClLaunchResult& result, 156 void SendMessageToRenderer(const NaClLaunchResult& result,
156 const std::string& error_message); 157 const std::string& error_message);
157 158
158 // Sends the message to the NaCl process to load the plugin. Returns true 159 // Sends the message to the NaCl process to load the plugin. Returns true
159 // on success. 160 // on success.
160 bool StartNaClExecution(); 161 bool StartNaClExecution();
161 162 void StartNaClExecutionAfterFileResolved(
162 void StartNaClFileResolved(
163 NaClStartParams params, 163 NaClStartParams params,
164 const base::FilePath& file_path, 164 scoped_ptr<base::FilePath> nexe_file_path,
165 scoped_ptr<std::vector<NaClResourcePrefetchResult> >
166 prefetched_resource_files,
165 base::File nexe_file); 167 base::File nexe_file);
166 168
167 // Does post-process-launching tasks for starting the NaCl process once 169 // Does post-process-launching tasks for starting the NaCl process once
168 // we have a connection. 170 // we have a connection.
169 // 171 //
170 // Returns false on failure. 172 // Returns false on failure.
171 bool StartWithLaunchedProcess(); 173 bool StartWithLaunchedProcess();
172 174
173 // Message handlers for validation caching. 175 // Message handlers for validation caching.
174 void OnQueryKnownToValidate(const std::string& signature, bool* result); 176 void OnQueryKnownToValidate(const std::string& signature, bool* result);
(...skipping 15 matching lines...) Expand all
190 // created. 192 // created.
191 void OnPpapiChannelsCreated( 193 void OnPpapiChannelsCreated(
192 const IPC::ChannelHandle& browser_channel_handle, 194 const IPC::ChannelHandle& browser_channel_handle,
193 const IPC::ChannelHandle& ppapi_renderer_channel_handle, 195 const IPC::ChannelHandle& ppapi_renderer_channel_handle,
194 const IPC::ChannelHandle& trusted_renderer_channel_handle, 196 const IPC::ChannelHandle& trusted_renderer_channel_handle,
195 const IPC::ChannelHandle& manifest_service_channel_handle); 197 const IPC::ChannelHandle& manifest_service_channel_handle);
196 198
197 GURL manifest_url_; 199 GURL manifest_url_;
198 base::File nexe_file_; 200 base::File nexe_file_;
199 NaClFileToken nexe_token_; 201 NaClFileToken nexe_token_;
200 std::vector<NaClResourcePrefetchResult> prefetched_resource_files_; 202 std::vector<NaClResourcePrefetchRequest> resource_prefetch_request_list_;
201 203
202 ppapi::PpapiPermissions permissions_; 204 ppapi::PpapiPermissions permissions_;
203 205
204 #if defined(OS_WIN) 206 #if defined(OS_WIN)
205 // This field becomes true when the broker successfully launched 207 // This field becomes true when the broker successfully launched
206 // the NaCl loader. 208 // the NaCl loader.
207 bool process_launched_by_broker_; 209 bool process_launched_by_broker_;
208 #endif 210 #endif
209 // The NaClHostMessageFilter that requested this NaCl process. We use 211 // The NaClHostMessageFilter that requested this NaCl process. We use
210 // this for sending the reply once the process has started. 212 // this for sending the reply once the process has started.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 base::File socket_for_sel_ldr_; 254 base::File socket_for_sel_ldr_;
253 255
254 base::WeakPtrFactory<NaClProcessHost> weak_factory_; 256 base::WeakPtrFactory<NaClProcessHost> weak_factory_;
255 257
256 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); 258 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost);
257 }; 259 };
258 260
259 } // namespace nacl 261 } // namespace nacl
260 262
261 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ 263 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698