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

Unified Diff: ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc

Issue 264943003: Pepper: Move manifest logic to components/nacl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
index 93d2220a14d4477ce67accc413d9739445119991..626536afa888c54c816154b67bcb22e72eeedd21 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
@@ -16,7 +16,6 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_uma_private.h"
-#include "ppapi/native_client/src/trusted/plugin/manifest.h"
#include "ppapi/native_client/src/trusted/plugin/plugin.h"
#include "ppapi/native_client/src/trusted/plugin/plugin_error.h"
#include "ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.h"
@@ -26,62 +25,6 @@
namespace plugin {
//////////////////////////////////////////////////////////////////////
-// Pnacl-specific manifest support.
-//////////////////////////////////////////////////////////////////////
-
-// The PNaCl linker gets file descriptors via the service runtime's
-// reverse service lookup. The reverse service lookup requires a manifest.
-// Normally, that manifest is an NMF containing mappings for shared libraries.
-// Here, we provide a manifest that redirects to PNaCl component files
-// that are part of Chrome.
-class PnaclManifest : public Manifest {
- public:
- PnaclManifest(const nacl::string& sandbox_arch)
- : sandbox_arch_(sandbox_arch) { }
-
- virtual ~PnaclManifest() { }
-
- virtual bool GetProgramURL(nacl::string* full_url,
- PP_PNaClOptions* pnacl_options,
- bool* uses_nonsfi_mode,
- ErrorInfo* error_info) const {
- // Does not contain program urls.
- UNREFERENCED_PARAMETER(full_url);
- UNREFERENCED_PARAMETER(pnacl_options);
- UNREFERENCED_PARAMETER(uses_nonsfi_mode);
- UNREFERENCED_PARAMETER(error_info);
- PLUGIN_PRINTF(("PnaclManifest does not contain a program\n"));
- error_info->SetReport(PP_NACL_ERROR_MANIFEST_GET_NEXE_URL,
- "pnacl manifest does not contain a program.");
- return false;
- }
-
- virtual bool ResolveKey(const nacl::string& key,
- nacl::string* full_url,
- PP_PNaClOptions* pnacl_options) const {
- // All of the component files are native (do not require pnacl translate).
- pnacl_options->translate = PP_FALSE;
- // We can only resolve keys in the files/ namespace.
- const nacl::string kFilesPrefix = "files/";
- size_t files_prefix_pos = key.find(kFilesPrefix);
- if (files_prefix_pos == nacl::string::npos) {
- PLUGIN_PRINTF(("key did not start with files/"));
- return false;
- }
- // Resolve the full URL to the file. Provide it with a platform-specific
- // prefix.
- nacl::string key_basename = key.substr(kFilesPrefix.length());
- *full_url = PnaclUrls::GetBaseUrl() + sandbox_arch_ + "/" + key_basename;
- return true;
- }
-
- private:
- NACL_DISALLOW_COPY_AND_ASSIGN(PnaclManifest);
-
- nacl::string sandbox_arch_;
-};
-
-//////////////////////////////////////////////////////////////////////
// UMA stat helpers.
//////////////////////////////////////////////////////////////////////
@@ -180,10 +123,10 @@ PnaclCoordinator* PnaclCoordinator::BitcodeToNative(
new PnaclCoordinator(plugin, pexe_url,
pnacl_options,
translate_notify_callback);
- coordinator->pnacl_init_time_ = NaClGetTimeOfDayMicroseconds();
- PLUGIN_PRINTF(("PnaclCoordinator::BitcodeToNative (manifest=%p, ",
- reinterpret_cast<const void*>(coordinator->manifest_.get())));
+ PLUGIN_PRINTF(("PnaclCoordinator::BitcodeToNative (manifest_id=%d)\n",
+ coordinator->manifest_id_));
+ coordinator->pnacl_init_time_ = NaClGetTimeOfDayMicroseconds();
int cpus = plugin->nacl_interface()->GetNumberOfProcessors();
coordinator->split_module_count_ = std::min(4, std::max(1, cpus));
@@ -204,7 +147,8 @@ PnaclCoordinator::PnaclCoordinator(
plugin_(plugin),
translate_notify_callback_(translate_notify_callback),
translation_finished_reported_(false),
- manifest_(new PnaclManifest(plugin->nacl_interface()->GetSandboxArch())),
+ manifest_id_(
+ GetNaClInterface()->CreatePnaclManifest(plugin->pp_instance())),
pexe_url_(pexe_url),
pnacl_options_(pnacl_options),
split_module_count_(1),
@@ -668,7 +612,7 @@ void PnaclCoordinator::RunTranslate(int32_t pp_error) {
CHECK(translate_thread_ != NULL);
translate_thread_->RunTranslate(report_translate_finished,
- manifest_.get(),
+ manifest_id_,
&obj_files_,
temp_nexe_file_.get(),
invalid_desc_wrapper_.get(),
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h ('k') | ppapi/native_client/src/trusted/plugin/pnacl_resources.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698