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

Side by Side Diff: ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc

Issue 10815080: Add an interface for nacl to create delete-on-close temp files, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert buildbot hack Created 8 years, 4 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 #include "native_client/src/trusted/plugin/pnacl_translate_thread.h" 5 #include "native_client/src/trusted/plugin/pnacl_translate_thread.h"
6 6
7 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" 7 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
8 #include "native_client/src/trusted/plugin/plugin.h" 8 #include "native_client/src/trusted/plugin/plugin.h"
9 #include "native_client/src/trusted/plugin/pnacl_resources.h" 9 #include "native_client/src/trusted/plugin/pnacl_resources.h"
10 #include "native_client/src/trusted/plugin/srpc_params.h" 10 #include "native_client/src/trusted/plugin/srpc_params.h"
11 #include "native_client/src/trusted/plugin/temporary_file.h"
11 #include "native_client/src/trusted/plugin/utility.h" 12 #include "native_client/src/trusted/plugin/utility.h"
12 13
13 namespace plugin { 14 namespace plugin {
14 15
15 PnaclTranslateThread::PnaclTranslateThread() : subprocesses_should_die_(false), 16 PnaclTranslateThread::PnaclTranslateThread() : subprocesses_should_die_(false),
16 manifest_(NULL), 17 manifest_(NULL),
17 ld_manifest_(NULL), 18 ld_manifest_(NULL),
18 obj_file_(NULL), 19 obj_file_(NULL),
19 nexe_file_(NULL), 20 nexe_file_(NULL),
20 coordinator_error_info_(NULL), 21 coordinator_error_info_(NULL),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 ErrorInfo error_info; 54 ErrorInfo error_info;
54 nacl::scoped_ptr<NaClSubprocess> ld_subprocess( 55 nacl::scoped_ptr<NaClSubprocess> ld_subprocess(
55 StartSubprocess(PnaclUrls::GetLdUrl(), ld_manifest_, &error_info)); 56 StartSubprocess(PnaclUrls::GetLdUrl(), ld_manifest_, &error_info));
56 if (ld_subprocess == NULL) { 57 if (ld_subprocess == NULL) {
57 TranslateFailed("Link process could not be created: " + 58 TranslateFailed("Link process could not be created: " +
58 error_info.message()); 59 error_info.message());
59 return false; 60 return false;
60 } 61 }
61 // Run LD. 62 // Run LD.
62 SrpcParams params; 63 SrpcParams params;
63 nacl::DescWrapper* ld_in_file = obj_file_->read_wrapper(); 64
65 // Reset object file for reading first.
66 if (!obj_file_->Reset()) {
67 TranslateFailed("Link process could not reset object file");
68 return false;
69 }
70 nacl::DescWrapper* ld_in_file = obj_file_->get_wrapper();
64 nacl::DescWrapper* ld_out_file = nexe_file_->write_wrapper(); 71 nacl::DescWrapper* ld_out_file = nexe_file_->write_wrapper();
65 PluginReverseInterface* ld_reverse = 72 PluginReverseInterface* ld_reverse =
66 ld_subprocess->service_runtime()->rev_interface(); 73 ld_subprocess->service_runtime()->rev_interface();
67 ld_reverse->AddQuotaManagedFile(nexe_file_->identifier(), 74 ld_reverse->AddQuotaManagedFile(nexe_file_->identifier(),
68 nexe_file_->write_file_io()); 75 nexe_file_->write_file_io());
69 if (!ld_subprocess->InvokeSrpcMethod("RunWithDefaultCommandLine", 76 if (!ld_subprocess->InvokeSrpcMethod("RunWithDefaultCommandLine",
70 "hhiss", 77 "hhiss",
71 &params, 78 &params,
72 ld_in_file->desc(), 79 ld_in_file->desc(),
73 ld_out_file->desc(), 80 ld_out_file->desc(),
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 translate_thread_.get())); 125 translate_thread_.get()));
119 if (translate_thread_ != NULL) { 126 if (translate_thread_ != NULL) {
120 SetSubprocessesShouldDie(); 127 SetSubprocessesShouldDie();
121 NaClThreadJoin(translate_thread_.get()); 128 NaClThreadJoin(translate_thread_.get());
122 PLUGIN_PRINTF(("~PnaclTranslateThread joined\n")); 129 PLUGIN_PRINTF(("~PnaclTranslateThread joined\n"));
123 } 130 }
124 NaClMutexDtor(&subprocess_mu_); 131 NaClMutexDtor(&subprocess_mu_);
125 } 132 }
126 133
127 } // namespace plugin 134 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698