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

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

Issue 263683002: Set file tokens for NaCl main nexe if available to enable validation caching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 #ifdef _MSC_VER 5 #ifdef _MSC_VER
6 // Do not warn about use of std::copy with raw pointers. 6 // Do not warn about use of std::copy with raw pointers.
7 #pragma warning(disable : 4996) 7 #pragma warning(disable : 4996)
8 #endif 8 #endif
9 9
10 #include "ppapi/native_client/src/trusted/plugin/plugin.h" 10 #include "ppapi/native_client/src/trusted/plugin/plugin.h"
11 11
12 #include <sys/stat.h> 12 #include <sys/stat.h>
13 #include <sys/types.h> 13 #include <sys/types.h>
14 14
15 #include <algorithm> 15 #include <algorithm>
16 #include <string> 16 #include <string>
17 #include <vector> 17 #include <vector>
18 18
19 #include "native_client/src/include/nacl_base.h" 19 #include "native_client/src/include/nacl_base.h"
20 #include "native_client/src/include/nacl_macros.h" 20 #include "native_client/src/include/nacl_macros.h"
21 #include "native_client/src/include/nacl_scoped_ptr.h" 21 #include "native_client/src/include/nacl_scoped_ptr.h"
22 #include "native_client/src/include/nacl_string.h" 22 #include "native_client/src/include/nacl_string.h"
23 #include "native_client/src/include/portability.h" 23 #include "native_client/src/include/portability.h"
24 #include "native_client/src/include/portability_io.h" 24 #include "native_client/src/include/portability_io.h"
25 #include "native_client/src/include/portability_string.h" 25 #include "native_client/src/include/portability_string.h"
26 #include "native_client/src/shared/platform/nacl_check.h" 26 #include "native_client/src/shared/platform/nacl_check.h"
27 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" 27 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
28 #include "native_client/src/trusted/desc_cacheability/desc_cacheability.h"
28 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" 29 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h"
29 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" 30 #include "native_client/src/trusted/service_runtime/nacl_error_code.h"
30 31
31 #include "ppapi/c/pp_errors.h" 32 #include "ppapi/c/pp_errors.h"
32 #include "ppapi/c/ppb_var.h" 33 #include "ppapi/c/ppb_var.h"
33 #include "ppapi/c/private/ppb_nacl_private.h" 34 #include "ppapi/c/private/ppb_nacl_private.h"
34 #include "ppapi/cpp/dev/url_util_dev.h" 35 #include "ppapi/cpp/dev/url_util_dev.h"
35 #include "ppapi/cpp/module.h" 36 #include "ppapi/cpp/module.h"
36 37
37 #include "ppapi/native_client/src/trusted/plugin/file_utils.h" 38 #include "ppapi/native_client/src/trusted/plugin/file_utils.h"
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 pp_error, 482 pp_error,
482 info.get_desc(), 483 info.get_desc(),
483 nexe_downloader_.status_code(), 484 nexe_downloader_.status_code(),
484 nexe_bytes_read, 485 nexe_bytes_read,
485 nexe_downloader_.url().c_str(), 486 nexe_downloader_.url().c_str(),
486 download_time / 1000); 487 download_time / 1000);
487 488
488 if (nexe_bytes_read == -1) 489 if (nexe_bytes_read == -1)
489 return; 490 return;
490 491
492 // Hand desc ownership over to the wrapper. Keep the tokens in tmp_info
493 // before losing the tokens.
494 tmp_info = info.Release();
491 nacl::scoped_ptr<nacl::DescWrapper> 495 nacl::scoped_ptr<nacl::DescWrapper>
492 wrapper(wrapper_factory()->MakeFileDesc(info.Release().desc, O_RDONLY)); 496 wrapper(wrapper_factory()->MakeFileDesc(tmp_info.desc, O_RDONLY));
497 tmp_info.desc = -1;
498 if (tmp_info.file_token.lo != 0 && tmp_info.file_token.hi != 0) {
teravest 2014/04/30 20:12:54 Should this be ||, not &&? Is it possible that lo
jvoung (off chromium) 2014/04/30 21:49:02 Yeah I think having only one of them be 0 is still
teravest 2014/05/02 15:07:25 I'm confused. If you want to use && here, you shou
jvoung (off chromium) 2014/05/02 15:33:23 Oops sorry, messed up the negation logic. Changed
Nick Bray (chromium) 2014/05/02 18:18:19 Justin is correct, although I'd go further and sug
jvoung (off chromium) 2014/05/02 19:26:15 Yeah, I could put something in nacl_file_info.h, s
499 if (!NaClDescSetFileToken(wrapper->desc(), &tmp_info.file_token)) {
teravest 2014/04/30 20:12:54 It's a shame that there's not a call to MakeFileDe
jvoung (off chromium) 2014/04/30 21:49:02 Okay, maybe we can add that: https://codereview.ch
jvoung (off chromium) 2014/05/20 16:12:42 Changed to use the new ctor function that passes b
500 NaClLog(4, "NexeFileDidOpen: NaClDescSetFileToken failed\n");
501 }
502 } else {
503 NaClLog(4, "NexeFileDidOpen: No file tokens for NaCl main nexe\n");
504 }
493 NaClLog(4, "NexeFileDidOpen: invoking LoadNaClModule\n"); 505 NaClLog(4, "NexeFileDidOpen: invoking LoadNaClModule\n");
494 LoadNaClModule( 506 LoadNaClModule(
495 wrapper.release(), 507 wrapper.release(),
496 uses_nonsfi_mode_, 508 uses_nonsfi_mode_,
497 true, /* enable_dyncode_syscalls */ 509 true, /* enable_dyncode_syscalls */
498 true, /* enable_exception_handling */ 510 true, /* enable_exception_handling */
499 false, /* enable_crash_throttling */ 511 false, /* enable_crash_throttling */
500 callback_factory_.NewCallback(&Plugin::NexeFileDidOpenContinuation), 512 callback_factory_.NewCallback(&Plugin::NexeFileDidOpenContinuation),
501 callback_factory_.NewCallback(&Plugin::NexeDidCrash)); 513 callback_factory_.NewCallback(&Plugin::NexeDidCrash));
502 } 514 }
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 991
980 void Plugin::SetExitStatusOnMainThread(int32_t pp_error, 992 void Plugin::SetExitStatusOnMainThread(int32_t pp_error,
981 int exit_status) { 993 int exit_status) {
982 DCHECK(pp::Module::Get()->core()->IsMainThread()); 994 DCHECK(pp::Module::Get()->core()->IsMainThread());
983 DCHECK(nacl_interface_); 995 DCHECK(nacl_interface_);
984 nacl_interface_->SetExitStatus(pp_instance(), exit_status); 996 nacl_interface_->SetExitStatus(pp_instance(), exit_status);
985 } 997 }
986 998
987 999
988 } // namespace plugin 1000 } // namespace plugin
OLDNEW
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/DEPS ('k') | ppapi/native_client/src/trusted/plugin/plugin.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698