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

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

Issue 12623004: Allow PNaCl NMF to set translator optimization options for experimentation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Default to -O0 instead of the default for now Created 7 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
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/service_runtime.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #define NACL_LOG_MODULE_NAME "Plugin::ServiceRuntime" 7 #define NACL_LOG_MODULE_NAME "Plugin::ServiceRuntime"
8 8
9 #include "native_client/src/trusted/plugin/service_runtime.h" 9 #include "native_client/src/trusted/plugin/service_runtime.h"
10 10
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation( 252 void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation(
253 OpenManifestEntryResource* p, 253 OpenManifestEntryResource* p,
254 int32_t err) { 254 int32_t err) {
255 OpenManifestEntryResource *open_cont; 255 OpenManifestEntryResource *open_cont;
256 UNREFERENCED_PARAMETER(err); 256 UNREFERENCED_PARAMETER(err);
257 // CallOnMainThread continuations always called with err == PP_OK. 257 // CallOnMainThread continuations always called with err == PP_OK.
258 258
259 NaClLog(4, "Entered OpenManifestEntry_MainThreadContinuation\n"); 259 NaClLog(4, "Entered OpenManifestEntry_MainThreadContinuation\n");
260 260
261 std::string mapped_url; 261 std::string mapped_url;
262 std::string cache_identity; 262 PnaclOptions pnacl_options;
263 if (!manifest_->ResolveKey(p->url, &mapped_url, &cache_identity, 263 if (!manifest_->ResolveKey(p->url, &mapped_url,
264 p->error_info, &p->pnacl_translate)) { 264 &pnacl_options, p->error_info)) {
265 NaClLog(4, "OpenManifestEntry_MainThreadContinuation: ResolveKey failed\n"); 265 NaClLog(4, "OpenManifestEntry_MainThreadContinuation: ResolveKey failed\n");
266 // Failed, and error_info has the details on what happened. Wake 266 // Failed, and error_info has the details on what happened. Wake
267 // up requesting thread -- we are done. 267 // up requesting thread -- we are done.
268 nacl::MutexLocker take(&mu_); 268 nacl::MutexLocker take(&mu_);
269 *p->op_complete_ptr = true; // done... 269 *p->op_complete_ptr = true; // done...
270 *p->out_desc = -1; // but failed. 270 *p->out_desc = -1; // but failed.
271 NaClXCondVarBroadcast(&cv_); 271 NaClXCondVarBroadcast(&cv_);
272 return; 272 return;
273 } 273 }
274 NaClLog(4, 274 NaClLog(4,
275 "OpenManifestEntry_MainThreadContinuation: " 275 "OpenManifestEntry_MainThreadContinuation: "
276 "ResolveKey: %s -> %s (pnacl_translate(%d))\n", 276 "ResolveKey: %s -> %s (pnacl_translate(%d))\n",
277 p->url.c_str(), mapped_url.c_str(), p->pnacl_translate); 277 p->url.c_str(), mapped_url.c_str(), pnacl_options.translate());
278 278
279 open_cont = new OpenManifestEntryResource(*p); // copy ctor! 279 open_cont = new OpenManifestEntryResource(*p); // copy ctor!
280 CHECK(open_cont != NULL); 280 CHECK(open_cont != NULL);
281 open_cont->url = mapped_url; 281 open_cont->url = mapped_url;
282 if (!open_cont->pnacl_translate) { 282 if (!pnacl_options.translate()) {
283 pp::CompletionCallback stream_cc = WeakRefNewCallback( 283 pp::CompletionCallback stream_cc = WeakRefNewCallback(
284 anchor_, 284 anchor_,
285 this, 285 this,
286 &PluginReverseInterface::StreamAsFile_MainThreadContinuation, 286 &PluginReverseInterface::StreamAsFile_MainThreadContinuation,
287 open_cont); 287 open_cont);
288 // 288 // Normal files.
289 if (!PnaclUrls::IsPnaclComponent(mapped_url)) { 289 if (!PnaclUrls::IsPnaclComponent(mapped_url)) {
290 if (!plugin_->StreamAsFile(mapped_url, 290 if (!plugin_->StreamAsFile(mapped_url,
291 stream_cc.pp_completion_callback())) { 291 stream_cc.pp_completion_callback())) {
292 NaClLog(4, 292 NaClLog(4,
293 "OpenManifestEntry_MainThreadContinuation: " 293 "OpenManifestEntry_MainThreadContinuation: "
294 "StreamAsFile failed\n"); 294 "StreamAsFile failed\n");
295 nacl::MutexLocker take(&mu_); 295 nacl::MutexLocker take(&mu_);
296 *p->op_complete_ptr = true; // done... 296 *p->op_complete_ptr = true; // done...
297 *p->out_desc = -1; // but failed. 297 *p->out_desc = -1; // but failed.
298 p->error_info->SetReport(ERROR_MANIFEST_OPEN, 298 p->error_info->SetReport(ERROR_MANIFEST_OPEN,
299 "ServiceRuntime: StreamAsFile failed"); 299 "ServiceRuntime: StreamAsFile failed");
300 NaClXCondVarBroadcast(&cv_); 300 NaClXCondVarBroadcast(&cv_);
301 return; 301 return;
302 } 302 }
303 NaClLog(4, 303 NaClLog(4,
304 "OpenManifestEntry_MainThreadContinuation: StreamAsFile okay\n"); 304 "OpenManifestEntry_MainThreadContinuation: StreamAsFile okay\n");
305 } else { 305 } else {
306 // Special PNaCl support files, that are installed on the
307 // user machine.
306 int32_t fd = PnaclResources::GetPnaclFD( 308 int32_t fd = PnaclResources::GetPnaclFD(
307 plugin_, 309 plugin_,
308 PnaclUrls::PnaclComponentURLToFilename(mapped_url).c_str()); 310 PnaclUrls::PnaclComponentURLToFilename(mapped_url).c_str());
309 if (fd < 0) { 311 if (fd < 0) {
310 // We should check earlier if the pnacl component wasn't installed 312 // We should check earlier if the pnacl component wasn't installed
311 // yet. At this point, we can't do much anymore, so just continue 313 // yet. At this point, we can't do much anymore, so just continue
312 // with an invalid fd. 314 // with an invalid fd.
313 NaClLog(4, 315 NaClLog(4,
314 "OpenManifestEntry_MainThreadContinuation: " 316 "OpenManifestEntry_MainThreadContinuation: "
315 "GetReadonlyPnaclFd failed\n"); 317 "GetReadonlyPnaclFd failed\n");
316 // TODO(jvoung): Separate the error codes? 318 // TODO(jvoung): Separate the error codes?
317 p->error_info->SetReport(ERROR_MANIFEST_OPEN, 319 p->error_info->SetReport(ERROR_MANIFEST_OPEN,
318 "ServiceRuntime: GetPnaclFd failed"); 320 "ServiceRuntime: GetPnaclFd failed");
319 } 321 }
320 nacl::MutexLocker take(&mu_); 322 nacl::MutexLocker take(&mu_);
321 *p->op_complete_ptr = true; // done! 323 *p->op_complete_ptr = true; // done!
322 *p->out_desc = fd; 324 *p->out_desc = fd;
323 NaClXCondVarBroadcast(&cv_); 325 NaClXCondVarBroadcast(&cv_);
324 NaClLog(4, 326 NaClLog(4,
325 "OpenManifestEntry_MainThreadContinuation: GetPnaclFd okay\n"); 327 "OpenManifestEntry_MainThreadContinuation: GetPnaclFd okay\n");
326 } 328 }
327 } else { 329 } else {
330 // Requires PNaCl translation.
328 NaClLog(4, 331 NaClLog(4,
329 "OpenManifestEntry_MainThreadContinuation: " 332 "OpenManifestEntry_MainThreadContinuation: "
330 "pulling down and translating.\n"); 333 "pulling down and translating.\n");
331 if (plugin_->nacl_interface()->IsPnaclEnabled()) { 334 if (plugin_->nacl_interface()->IsPnaclEnabled()) {
332 pp::CompletionCallback translate_callback = 335 pp::CompletionCallback translate_callback =
333 WeakRefNewCallback( 336 WeakRefNewCallback(
334 anchor_, 337 anchor_,
335 this, 338 this,
336 &PluginReverseInterface::BitcodeTranslate_MainThreadContinuation, 339 &PluginReverseInterface::BitcodeTranslate_MainThreadContinuation,
337 open_cont); 340 open_cont);
338 // Will always call the callback on success or failure. 341 // Will always call the callback on success or failure.
339 pnacl_coordinator_.reset( 342 pnacl_coordinator_.reset(
340 PnaclCoordinator::BitcodeToNative(plugin_, 343 PnaclCoordinator::BitcodeToNative(plugin_,
341 mapped_url, 344 mapped_url,
342 cache_identity, 345 pnacl_options,
343 translate_callback)); 346 translate_callback));
344 } else { 347 } else {
345 nacl::MutexLocker take(&mu_); 348 nacl::MutexLocker take(&mu_);
346 *p->op_complete_ptr = true; // done... 349 *p->op_complete_ptr = true; // done...
347 *p->out_desc = -1; // but failed. 350 *p->out_desc = -1; // but failed.
348 p->error_info->SetReport(ERROR_PNACL_NOT_ENABLED, 351 p->error_info->SetReport(ERROR_PNACL_NOT_ENABLED,
349 "ServiceRuntime: GetPnaclFd failed -- pnacl not " 352 "ServiceRuntime: GetPnaclFd failed -- pnacl not "
350 "enabled with --enable-pnacl."); 353 "enabled with --enable-pnacl.");
351 NaClXCondVarBroadcast(&cv_); 354 NaClXCondVarBroadcast(&cv_);
352 return; 355 return;
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 844
842 nacl::string ServiceRuntime::GetCrashLogOutput() { 845 nacl::string ServiceRuntime::GetCrashLogOutput() {
843 if (NULL != subprocess_.get()) { 846 if (NULL != subprocess_.get()) {
844 return subprocess_->GetCrashLogOutput(); 847 return subprocess_->GetCrashLogOutput();
845 } else { 848 } else {
846 return ""; 849 return "";
847 } 850 }
848 } 851 }
849 852
850 } // namespace plugin 853 } // namespace plugin
OLDNEW
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/service_runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698