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

Unified Diff: trunk/src/components/nacl/renderer/ppb_nacl_private_impl.cc

Issue 265393004: Revert 268280 "Pepper: Move manifest logic to components/nacl." (Closed) Base URL: svn://svn.chromium.org/chrome/
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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/components/nacl/renderer/ppb_nacl_private_impl.cc
===================================================================
--- trunk/src/components/nacl/renderer/ppb_nacl_private_impl.cc (revision 268294)
+++ trunk/src/components/nacl/renderer/ppb_nacl_private_impl.cc (working copy)
@@ -16,7 +16,6 @@
#include "components/nacl/common/nacl_switches.h"
#include "components/nacl/common/nacl_types.h"
#include "components/nacl/renderer/histogram.h"
-#include "components/nacl/renderer/json_manifest.h"
#include "components/nacl/renderer/manifest_downloader.h"
#include "components/nacl/renderer/manifest_service_channel.h"
#include "components/nacl/renderer/nexe_load_manager.h"
@@ -88,16 +87,7 @@
base::LazyInstance<NexeLoadManagerMap> g_load_manager_map =
LAZY_INSTANCE_INITIALIZER;
-typedef base::ScopedPtrHashMap<int32_t, nacl::JsonManifest> JsonManifestMap;
-
-base::LazyInstance<JsonManifestMap> g_manifest_map =
- LAZY_INSTANCE_INITIALIZER;
-
-const int32_t kPNaClManifestId = std::numeric_limits<int32_t>::max();
-base::LazyInstance<int32_t> g_next_manifest_id =
- LAZY_INSTANCE_INITIALIZER;
-
-nacl::NexeLoadManager* GetNexeLoadManager(PP_Instance instance) {
+NexeLoadManager* GetNexeLoadManager(PP_Instance instance) {
NexeLoadManagerMap& map = g_load_manager_map.Get();
NexeLoadManagerMap::iterator iter = map.find(instance);
if (iter != map.end())
@@ -1001,111 +991,6 @@
callback.func(callback.user_data, pp_error);
}
-int32_t CreatePNaClManifest(PP_Instance /* instance */) {
- return kPNaClManifestId;
-}
-
-int32_t CreateJsonManifest(PP_Instance instance,
- const char* manifest_url,
- const char* isa_type,
- const char* manifest_data) {
- int32_t manifest_id = g_next_manifest_id.Get();
- g_next_manifest_id.Get()++;
-
- scoped_ptr<nacl::JsonManifest> j(
- new nacl::JsonManifest(
- manifest_url,
- isa_type,
- PP_ToBool(IsNonSFIModeEnabled()),
- PP_ToBool(NaClDebugEnabledForURL(manifest_url))));
- JsonManifest::ErrorInfo error_info;
- if (j->Init(manifest_data, &error_info)) {
- g_manifest_map.Get().add(manifest_id, j.Pass());
- return manifest_id;
- }
- nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance);
- if (load_manager)
- load_manager->ReportLoadError(error_info.error, error_info.string);
- return -1;
-}
-
-void DestroyManifest(PP_Instance /* instance */,
- int32_t manifest_id) {
- if (manifest_id == kPNaClManifestId)
- return;
- g_manifest_map.Get().erase(manifest_id);
-}
-
-PP_Bool ManifestGetProgramURL(PP_Instance instance,
- int32_t manifest_id,
- PP_Var* pp_full_url,
- PP_PNaClOptions* pnacl_options,
- PP_Bool* pp_uses_nonsfi_mode) {
- nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance);
- if (manifest_id == kPNaClManifestId) {
- if (load_manager) {
- load_manager->ReportLoadError(
- PP_NACL_ERROR_MANIFEST_GET_NEXE_URL,
- "pnacl manifest does not contain a program.");
- }
- return PP_FALSE;
- }
-
- JsonManifestMap::iterator it = g_manifest_map.Get().find(manifest_id);
- if (it == g_manifest_map.Get().end())
- return PP_FALSE;
-
- bool uses_nonsfi_mode;
- std::string full_url;
- JsonManifest::ErrorInfo error_info;
- if (it->second->GetProgramURL(&full_url, pnacl_options, &uses_nonsfi_mode,
- &error_info)) {
- *pp_full_url = ppapi::StringVar::StringToPPVar(full_url);
- *pp_uses_nonsfi_mode = PP_FromBool(uses_nonsfi_mode);
- return PP_TRUE;
- }
-
- if (load_manager)
- load_manager->ReportLoadError(error_info.error, error_info.string);
- return PP_FALSE;
-}
-
-PP_Bool ManifestResolveKey(PP_Instance instance,
- int32_t manifest_id,
- const char* key,
- PP_Var* pp_full_url,
- PP_PNaClOptions* pnacl_options) {
- if (manifest_id == kPNaClManifestId) {
- pnacl_options->translate = PP_FALSE;
- // We can only resolve keys in the files/ namespace.
- const std::string kFilesPrefix = "files/";
- std::string key_string(key);
- if (key_string.find(kFilesPrefix) == std::string::npos) {
- nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance);
- if (load_manager)
- load_manager->ReportLoadError(PP_NACL_ERROR_MANIFEST_RESOLVE_URL,
- "key did not start with files/");
- return PP_FALSE;
- }
- std::string key_basename = key_string.substr(kFilesPrefix.length());
- std::string pnacl_url =
- std::string("chrome://pnacl-translator/") + GetSandboxArch() + "/" +
- key_basename;
- *pp_full_url = ppapi::StringVar::StringToPPVar(pnacl_url);
- return PP_TRUE;
- }
-
- JsonManifestMap::iterator it = g_manifest_map.Get().find(manifest_id);
- if (it == g_manifest_map.Get().end())
- return PP_FALSE;
-
- std::string full_url;
- bool ok = it->second->ResolveKey(key, &full_url, pnacl_options);
- if (ok)
- *pp_full_url = ppapi::StringVar::StringToPPVar(full_url);
- return PP_FromBool(ok);
-}
-
const PPB_NaCl_Private nacl_interface = {
&LaunchSelLdr,
&StartPpapiProxy,
@@ -1145,12 +1030,7 @@
&GetManifestURLArgument,
&IsPNaCl,
&DevInterfacesEnabled,
- &DownloadManifestToBuffer,
- &CreatePNaClManifest,
- &CreateJsonManifest,
- &DestroyManifest,
- &ManifestGetProgramURL,
- &ManifestResolveKey
+ &DownloadManifestToBuffer
};
} // namespace
« no previous file with comments | « trunk/src/components/nacl/renderer/json_manifest.cc ('k') | trunk/src/ppapi/api/private/ppb_nacl_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698