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

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

Issue 193313002: Pepper: Move GetSandboxISA() to PPB_NaCl_Private. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes for dmichael Created 6 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 #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"
(...skipping 24 matching lines...) Expand all
35 #include "ppapi/c/ppp_instance.h" 35 #include "ppapi/c/ppp_instance.h"
36 #include "ppapi/c/private/ppb_nacl_private.h" 36 #include "ppapi/c/private/ppb_nacl_private.h"
37 #include "ppapi/cpp/dev/url_util_dev.h" 37 #include "ppapi/cpp/dev/url_util_dev.h"
38 #include "ppapi/cpp/module.h" 38 #include "ppapi/cpp/module.h"
39 #include "ppapi/cpp/text_input_controller.h" 39 #include "ppapi/cpp/text_input_controller.h"
40 40
41 #include "ppapi/native_client/src/trusted/plugin/file_utils.h" 41 #include "ppapi/native_client/src/trusted/plugin/file_utils.h"
42 #include "ppapi/native_client/src/trusted/plugin/json_manifest.h" 42 #include "ppapi/native_client/src/trusted/plugin/json_manifest.h"
43 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h" 43 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h"
44 #include "ppapi/native_client/src/trusted/plugin/nacl_subprocess.h" 44 #include "ppapi/native_client/src/trusted/plugin/nacl_subprocess.h"
45 #include "ppapi/native_client/src/trusted/plugin/nexe_arch.h"
46 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h" 45 #include "ppapi/native_client/src/trusted/plugin/plugin_error.h"
47 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" 46 #include "ppapi/native_client/src/trusted/plugin/service_runtime.h"
48 #include "ppapi/native_client/src/trusted/plugin/utility.h" 47 #include "ppapi/native_client/src/trusted/plugin/utility.h"
49 48
50 namespace plugin { 49 namespace plugin {
51 50
52 namespace { 51 namespace {
53 52
54 const char* const kTypeAttribute = "type"; 53 const char* const kTypeAttribute = "type";
55 // The "src" attribute of the <embed> tag. The value is expected to be either 54 // The "src" attribute of the <embed> tag. The value is expected to be either
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 PLUGIN_PRINTF(("Plugin::New (plugin=%p)\n", static_cast<void*>(plugin))); 522 PLUGIN_PRINTF(("Plugin::New (plugin=%p)\n", static_cast<void*>(plugin)));
524 return plugin; 523 return plugin;
525 } 524 }
526 525
527 526
528 // All failures of this function will show up as "Missing Plugin-in", so 527 // All failures of this function will show up as "Missing Plugin-in", so
529 // there is no need to log to JS console that there was an initialization 528 // there is no need to log to JS console that there was an initialization
530 // failure. Note that module loading functions will log their own errors. 529 // failure. Note that module loading functions will log their own errors.
531 bool Plugin::Init(uint32_t argc, const char* argn[], const char* argv[]) { 530 bool Plugin::Init(uint32_t argc, const char* argn[], const char* argv[]) {
532 PLUGIN_PRINTF(("Plugin::Init (argc=%" NACL_PRIu32 ")\n", argc)); 531 PLUGIN_PRINTF(("Plugin::Init (argc=%" NACL_PRIu32 ")\n", argc));
533 HistogramEnumerateOsArch(GetSandboxISA()); 532 HistogramEnumerateOsArch(nacl_interface_->GetSandboxISA());
534 init_time_ = NaClGetTimeOfDayMicroseconds(); 533 init_time_ = NaClGetTimeOfDayMicroseconds();
535 url_util_ = pp::URLUtil_Dev::Get(); 534 url_util_ = pp::URLUtil_Dev::Get();
536 if (url_util_ == NULL) 535 if (url_util_ == NULL)
537 return false; 536 return false;
538 537
539 PLUGIN_PRINTF(("Plugin::Init (url_util_=%p)\n", 538 PLUGIN_PRINTF(("Plugin::Init (url_util_=%p)\n",
540 static_cast<const void*>(url_util_))); 539 static_cast<const void*>(url_util_)));
541 540
542 bool status = EarlyInit(static_cast<int>(argc), argn, argv); 541 bool status = EarlyInit(static_cast<int>(argc), argn, argv);
543 if (status) { 542 if (status) {
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 PLUGIN_PRINTF(("Plugin::SetManifestObject(): manifest_json='%s'.\n", 1146 PLUGIN_PRINTF(("Plugin::SetManifestObject(): manifest_json='%s'.\n",
1148 manifest_json.c_str())); 1147 manifest_json.c_str()));
1149 if (error_info == NULL) 1148 if (error_info == NULL)
1150 return false; 1149 return false;
1151 // Determine whether lookups should use portable (i.e., pnacl versions) 1150 // Determine whether lookups should use portable (i.e., pnacl versions)
1152 // rather than platform-specific files. 1151 // rather than platform-specific files.
1153 bool is_pnacl = (mime_type() == kPnaclMIMEType); 1152 bool is_pnacl = (mime_type() == kPnaclMIMEType);
1154 bool nonsfi_mode_enabled = 1153 bool nonsfi_mode_enabled =
1155 PP_ToBool(nacl_interface_->IsNonSFIModeEnabled()); 1154 PP_ToBool(nacl_interface_->IsNonSFIModeEnabled());
1156 bool pnacl_debug = GetNaClInterface()->NaClDebugStubEnabled(); 1155 bool pnacl_debug = GetNaClInterface()->NaClDebugStubEnabled();
1156 const char* sandbox_isa = nacl_interface_->GetSandboxISA();
1157 nacl::scoped_ptr<JsonManifest> json_manifest( 1157 nacl::scoped_ptr<JsonManifest> json_manifest(
1158 new JsonManifest(url_util_, 1158 new JsonManifest(url_util_,
1159 manifest_base_url(), 1159 manifest_base_url(),
1160 (is_pnacl ? kPortableISA : GetSandboxISA()), 1160 (is_pnacl ? kPortableISA : sandbox_isa),
1161 nonsfi_mode_enabled, 1161 nonsfi_mode_enabled,
1162 pnacl_debug)); 1162 pnacl_debug));
1163 if (!json_manifest->Init(manifest_json, error_info)) { 1163 if (!json_manifest->Init(manifest_json, error_info)) {
1164 return false; 1164 return false;
1165 } 1165 }
1166 manifest_.reset(json_manifest.release()); 1166 manifest_.reset(json_manifest.release());
1167 return true; 1167 return true;
1168 } 1168 }
1169 1169
1170 void Plugin::UrlDidOpenForStreamAsFile(int32_t pp_error, 1170 void Plugin::UrlDidOpenForStreamAsFile(int32_t pp_error,
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 DCHECK(pp::Module::Get()->core()->IsMainThread()); 1496 DCHECK(pp::Module::Get()->core()->IsMainThread());
1497 DCHECK(nacl_interface_); 1497 DCHECK(nacl_interface_);
1498 exit_status_ = exit_status; 1498 exit_status_ = exit_status;
1499 nacl_interface_->SetReadOnlyProperty(pp_instance(), 1499 nacl_interface_->SetReadOnlyProperty(pp_instance(),
1500 pp::Var("exitStatus").pp_var(), 1500 pp::Var("exitStatus").pp_var(),
1501 pp::Var(exit_status_).pp_var()); 1501 pp::Var(exit_status_).pp_var());
1502 } 1502 }
1503 1503
1504 1504
1505 } // namespace plugin 1505 } // namespace plugin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698