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

Side by Side Diff: ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h

Issue 9561004: Close and delete pnacl temp files when compile or link fails. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments, remove printf Created 8 years, 9 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
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 NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_
6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_
7 7
8 #include <set> 8 #include <set>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 void ResourcesDidLoad(int32_t pp_error); 254 void ResourcesDidLoad(int32_t pp_error);
255 255
256 // Callbacks for temporary file related stages. 256 // Callbacks for temporary file related stages.
257 // They are invoked from ResourcesDidLoad and proceed in declaration order. 257 // They are invoked from ResourcesDidLoad and proceed in declaration order.
258 // Invoked when the temporary file system is successfully opened in PPAPI. 258 // Invoked when the temporary file system is successfully opened in PPAPI.
259 void FileSystemDidOpen(int32_t pp_error); 259 void FileSystemDidOpen(int32_t pp_error);
260 // Invoked after we are sure the PNaCl temporary directory exists. 260 // Invoked after we are sure the PNaCl temporary directory exists.
261 void DirectoryWasCreated(int32_t pp_error); 261 void DirectoryWasCreated(int32_t pp_error);
262 // Invoked after we have checked the PNaCl cache for a translated version. 262 // Invoked after we have checked the PNaCl cache for a translated version.
263 void CachedFileDidOpen(int32_t pp_error); 263 void CachedFileDidOpen(int32_t pp_error);
264 // Invoked after we have started pulling down the bitcode file.
265 void BitcodeFileDidOpen(int32_t pp_error);
264 // Invoked when the write descriptor for obj_file_ is created. 266 // Invoked when the write descriptor for obj_file_ is created.
265 void ObjectWriteDidOpen(int32_t pp_error); 267 void ObjectWriteDidOpen(int32_t pp_error);
266 // Invoked when the read descriptor for obj_file_ is created. 268 // Invoked when the read descriptor for obj_file_ is created.
267 void ObjectReadDidOpen(int32_t pp_error); 269 void ObjectReadDidOpen(int32_t pp_error);
268 // Invoked when the read descriptor for nexe_file_ is created.
269 void NexeWriteDidOpen(int32_t pp_error);
270 // Invoked when the descriptors for obj_file_ have been closed. 270 // Invoked when the descriptors for obj_file_ have been closed.
271 void ObjectFileWasClosed(int32_t pp_error); 271 void ObjectFileWasClosed(int32_t pp_error);
272 // Invoked when the obj_file_ temporary has been deleted. 272 // Invoked when the obj_file_ temporary has been deleted.
273 void ObjectFileWasDeleted(int32_t pp_error); 273 void ObjectFileWasDeleted(int32_t pp_error);
274 // Invoked when the descriptors for nexe_file_ have been closed. 274 // Invoked when the descriptors for nexe_file_ have been closed.
275 void NexeFileWasClosed(int32_t pp_error); 275 void NexeFileWasClosed(int32_t pp_error);
276 // Invoked when the nexe_file_ temporary has been renamed to the nexe name. 276 // Invoked when the nexe_file_ temporary has been renamed to the nexe name.
277 void NexeFileWasRenamed(int32_t pp_error); 277 void NexeFileWasRenamed(int32_t pp_error);
278 // Invoked when the read descriptor for nexe_file_ is created. 278 // Invoked when the read descriptor for nexe_file_ is created.
279 void NexeReadDidOpen(int32_t pp_error); 279 void NexeReadDidOpen(int32_t pp_error);
280 // Invoked if there was an error and we've cleaned up the nexe_file_ temp.
281 void NexeFileWasDeleted(int32_t pp_error);
280 282
281 // Once llc and ld nexes have been loaded and the two temporary files have 283 // Once llc and ld nexes have been loaded and the two temporary files have
282 // been created, this starts the translation. Translation starts two 284 // been created, this starts the translation. Translation starts two
283 // subprocesses, one for llc and one for ld. 285 // subprocesses, one for llc and one for ld.
284 void RunTranslate(int32_t pp_error); 286 void RunTranslate(int32_t pp_error);
285 // Starts an individual llc or ld subprocess used for translation. 287 // Starts an individual llc or ld subprocess used for translation.
286 NaClSubprocess* StartSubprocess(const nacl::string& url, 288 NaClSubprocess* StartSubprocess(const nacl::string& url,
287 const Manifest* manifest); 289 const Manifest* manifest);
288 // PnaclCoordinator creates a helper thread to allow translations to be 290 // PnaclCoordinator creates a helper thread to allow translations to be
289 // invoked via SRPC. This is the helper thread function for translation. 291 // invoked via SRPC. This is the helper thread function for translation.
290 static void WINAPI DoTranslateThread(void* arg); 292 static void WINAPI DoTranslateThread(void* arg);
291 // Returns true if a the translate thread and subprocesses should stop. 293 // Returns true if a the translate thread and subprocesses should stop.
292 bool SubprocessesShouldDie(); 294 bool SubprocessesShouldDie();
293 // Signal the translate thread and subprocesses that they should stop. 295 // Signal the translate thread and subprocesses that they should stop.
294 void SetSubprocessesShouldDie(bool subprocesses_should_die); 296 void SetSubprocessesShouldDie(bool subprocesses_should_die);
295 // Signal that Pnacl translation completed normally. 297 // Signal that Pnacl translation completed normally.
296 void TranslateFinished(int32_t pp_error); 298 void TranslateFinished(int32_t pp_error);
299 // Keeps track of the pp_error upon entry to TranslateFinished,
300 // for inspection after cleanup.
301 int32_t translate_finish_error_;
302
297 // Signal that Pnacl translation failed, from the translation thread only. 303 // Signal that Pnacl translation failed, from the translation thread only.
298 void TranslateFailed(const nacl::string& error_string); 304 void TranslateFailed(const nacl::string& error_string);
299 305
300 // The plugin owning the nexe for which we are doing translation. 306 // The plugin owning the nexe for which we are doing translation.
301 Plugin* plugin_; 307 Plugin* plugin_;
302 308
303 pp::CompletionCallback translate_notify_callback_; 309 pp::CompletionCallback translate_notify_callback_;
304 // PnaclRefCount is only needed to support file lookups. 310 // PnaclRefCount is only needed to support file lookups.
305 // TODO(sehr): remove this when file lookup is through ReverseService. 311 // TODO(sehr): remove this when file lookup is through ReverseService.
306 pp::CompletionCallbackFactory<PnaclCoordinator, 312 pp::CompletionCallbackFactory<PnaclCoordinator,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // The URL for the pexe file. 345 // The URL for the pexe file.
340 nacl::string pexe_url_; 346 nacl::string pexe_url_;
341 // Optional cache identity for translation caching. 347 // Optional cache identity for translation caching.
342 nacl::string cache_identity_; 348 nacl::string cache_identity_;
343 // Borrowed reference which must outlive the thread. 349 // Borrowed reference which must outlive the thread.
344 nacl::scoped_ptr<nacl::DescWrapper> pexe_wrapper_; 350 nacl::scoped_ptr<nacl::DescWrapper> pexe_wrapper_;
345 // Object file, produced by the translator and consumed by the linker. 351 // Object file, produced by the translator and consumed by the linker.
346 nacl::scoped_ptr<LocalTempFile> obj_file_; 352 nacl::scoped_ptr<LocalTempFile> obj_file_;
347 // Translated nexe file, produced by the linker and consumed by sel_ldr. 353 // Translated nexe file, produced by the linker and consumed by sel_ldr.
348 nacl::scoped_ptr<LocalTempFile> nexe_file_; 354 nacl::scoped_ptr<LocalTempFile> nexe_file_;
349 // Callbacks to run when tasks or completed or an error has occurred. 355 // Callback to run when tasks are completed or an error has occurred.
350 pp::CompletionCallback report_translate_finished_; 356 pp::CompletionCallback report_translate_finished_;
351 357
352 // Used to report information when errors (PPAPI or otherwise) are reported. 358 // Used to report information when errors (PPAPI or otherwise) are reported.
353 ErrorInfo error_info_; 359 ErrorInfo error_info_;
354 // True if an error was already reported, and translate_notify_callback_ 360 // True if an error was already reported, and translate_notify_callback_
355 // was already run/consumed. 361 // was already run/consumed.
356 bool error_already_reported_; 362 bool error_already_reported_;
357 }; 363 };
358 364
359 //---------------------------------------------------------------------- 365 //----------------------------------------------------------------------
360 366
361 } // namespace plugin; 367 } // namespace plugin;
362 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_ 368 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_COORDINATOR_H_
OLDNEW
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/json_manifest.cc ('k') | ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698