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

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

Issue 224803002: Enable mmap and identity-based validation caching on pnacl-{llc,ld}.nexe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix token handover for main nexe Created 6 years, 8 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 #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 <deque> 16 #include <deque>
17 #include <string> 17 #include <string>
18 #include <vector> 18 #include <vector>
19 19
20 #include "native_client/src/include/nacl_base.h" 20 #include "native_client/src/include/nacl_base.h"
21 #include "native_client/src/include/nacl_macros.h" 21 #include "native_client/src/include/nacl_macros.h"
22 #include "native_client/src/include/nacl_scoped_ptr.h" 22 #include "native_client/src/include/nacl_scoped_ptr.h"
23 #include "native_client/src/include/nacl_string.h" 23 #include "native_client/src/include/nacl_string.h"
24 #include "native_client/src/include/portability.h" 24 #include "native_client/src/include/portability.h"
25 #include "native_client/src/include/portability_io.h" 25 #include "native_client/src/include/portability_io.h"
26 #include "native_client/src/include/portability_string.h" 26 #include "native_client/src/include/portability_string.h"
27 #include "native_client/src/shared/platform/nacl_check.h" 27 #include "native_client/src/shared/platform/nacl_check.h"
28 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h" 28 #include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
29 #include "native_client/src/trusted/desc_cacheability/desc_cacheability.h"
29 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" 30 #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h"
30 #include "native_client/src/trusted/service_runtime/nacl_error_code.h" 31 #include "native_client/src/trusted/service_runtime/nacl_error_code.h"
31 32
32 #include "ppapi/c/pp_errors.h" 33 #include "ppapi/c/pp_errors.h"
33 #include "ppapi/c/ppb_console.h" 34 #include "ppapi/c/ppb_console.h"
34 #include "ppapi/c/ppb_var.h" 35 #include "ppapi/c/ppb_var.h"
35 #include "ppapi/c/private/ppb_nacl_private.h" 36 #include "ppapi/c/private/ppb_nacl_private.h"
36 #include "ppapi/cpp/dev/url_util_dev.h" 37 #include "ppapi/cpp/dev/url_util_dev.h"
37 #include "ppapi/cpp/module.h" 38 #include "ppapi/cpp/module.h"
38 #include "ppapi/cpp/text_input_controller.h" 39 #include "ppapi/cpp/text_input_controller.h"
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 pp_error, 598 pp_error,
598 info.get_desc(), 599 info.get_desc(),
599 nexe_downloader_.status_code(), 600 nexe_downloader_.status_code(),
600 nexe_bytes_read, 601 nexe_bytes_read,
601 nexe_downloader_.url().c_str(), 602 nexe_downloader_.url().c_str(),
602 nexe_downloader_.TimeSinceOpenMilliseconds()); 603 nexe_downloader_.TimeSinceOpenMilliseconds());
603 604
604 if (nexe_bytes_read == -1) 605 if (nexe_bytes_read == -1)
605 return; 606 return;
606 607
608 // Handing desc ownership to the wrapper.
609 // However, we still need the tokens so keep that in the tmp_info.
610 tmp_info = info.Release();
607 nacl::scoped_ptr<nacl::DescWrapper> 611 nacl::scoped_ptr<nacl::DescWrapper>
608 wrapper(wrapper_factory()->MakeFileDesc(info.Release().desc, O_RDONLY)); 612 wrapper(wrapper_factory()->MakeFileDesc(tmp_info.desc, O_RDONLY));
609 NaClLog(4, "NexeFileDidOpen: invoking LoadNaClModule\n"); 613 tmp_info.desc = -1;
614 if (tmp_info.file_token.lo != 0 && tmp_info.file_token.hi != 0) {
615 if (!NaClDescSetFileToken(wrapper->desc(), &tmp_info.file_token)) {
616 PLUGIN_PRINTF((
617 "NexeFileDidOpen: NaClDescSetFileToken failed\n"));
618 } else {
619 PLUGIN_PRINTF((
620 "NexeFileDidOpen: NaClDescSetFileToken success\n"));
621 }
622 } else {
623 PLUGIN_PRINTF(("NexeFileDidOpen: No file tokens for NaCl main nexe\n"));
624 }
625 PLUGIN_PRINTF(("NexeFileDidOpen: invoking LoadNaClModule\n"));
610 LoadNaClModule( 626 LoadNaClModule(
611 wrapper.release(), 627 wrapper.release(),
612 uses_nonsfi_mode_, 628 uses_nonsfi_mode_,
613 true, /* enable_dyncode_syscalls */ 629 true, /* enable_dyncode_syscalls */
614 true, /* enable_exception_handling */ 630 true, /* enable_exception_handling */
615 false, /* enable_crash_throttling */ 631 false, /* enable_crash_throttling */
616 callback_factory_.NewCallback(&Plugin::NexeFileDidOpenContinuation), 632 callback_factory_.NewCallback(&Plugin::NexeFileDidOpenContinuation),
617 callback_factory_.NewCallback(&Plugin::NexeDidCrash)); 633 callback_factory_.NewCallback(&Plugin::NexeDidCrash));
618 } 634 }
619 635
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 1176
1161 void Plugin::SetExitStatusOnMainThread(int32_t pp_error, 1177 void Plugin::SetExitStatusOnMainThread(int32_t pp_error,
1162 int exit_status) { 1178 int exit_status) {
1163 DCHECK(pp::Module::Get()->core()->IsMainThread()); 1179 DCHECK(pp::Module::Get()->core()->IsMainThread());
1164 DCHECK(nacl_interface_); 1180 DCHECK(nacl_interface_);
1165 nacl_interface_->SetExitStatus(pp_instance(), exit_status); 1181 nacl_interface_->SetExitStatus(pp_instance(), exit_status);
1166 } 1182 }
1167 1183
1168 1184
1169 } // namespace plugin 1185 } // namespace plugin
OLDNEW
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/file_utils.cc ('k') | ppapi/native_client/src/trusted/plugin/plugin.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698