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

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

Issue 310113002: Pepper: Move JsonManifestMap to json_manifest.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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: components/nacl/renderer/ppb_nacl_private_impl.cc
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc
index 0aca3a17193a449bb57c8c38b917630f34b5a9f1..07149aca1d144ae28f85fe1b89bad2f19e928005 100644
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -105,11 +105,6 @@ typedef base::ScopedPtrHashMap<PP_Instance, NexeLoadManager>
base::LazyInstance<NexeLoadManagerMap> g_load_manager_map =
LAZY_INSTANCE_INITIALIZER;
-typedef base::ScopedPtrHashMap<PP_Instance, nacl::JsonManifest> JsonManifestMap;
-
-base::LazyInstance<JsonManifestMap> g_manifest_map =
- LAZY_INSTANCE_INITIALIZER;
-
nacl::NexeLoadManager* GetNexeLoadManager(PP_Instance instance) {
NexeLoadManagerMap& map = g_load_manager_map.Get();
NexeLoadManagerMap::iterator iter = map.find(instance);
@@ -764,7 +759,7 @@ void InstanceCreated(PP_Instance instance) {
}
void InstanceDestroyed(PP_Instance instance) {
- g_manifest_map.Get().erase(instance);
+ DeleteJsonManifest(instance);
NexeLoadManagerMap& map = g_load_manager_map.Get();
DLOG_IF(ERROR, map.count(instance) == 0) << "Could not find instance ID";
@@ -1048,7 +1043,7 @@ bool CreateJsonManifest(PP_Instance instance,
PP_ToBool(NaClDebugEnabledForURL(manifest_url.c_str()))));
JsonManifest::ErrorInfo error_info;
if (j->Init(manifest_data.c_str(), &error_info)) {
- g_manifest_map.Get().add(instance, j.Pass());
+ AddJsonManifest(instance, j.Pass());
return true;
}
load_manager->ReportLoadError(error_info.error, error_info.string);
@@ -1061,15 +1056,15 @@ PP_Bool ManifestGetProgramURL(PP_Instance instance,
PP_Bool* pp_uses_nonsfi_mode) {
nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance);
- JsonManifestMap::iterator it = g_manifest_map.Get().find(instance);
- if (it == g_manifest_map.Get().end())
+ JsonManifest* manifest = GetJsonManifest(instance);
+ if (manifest == NULL)
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)) {
+ if (manifest->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;
@@ -1116,8 +1111,8 @@ void OpenManifestEntry(PP_Instance instance,
std::string(kPNaClTranslatorBaseUrl) + GetSandboxArch() + "/" +
key_basename;
} else {
- JsonManifestMap::iterator it = g_manifest_map.Get().find(instance);
- if (it == g_manifest_map.Get().end()) {
+ JsonManifest* manifest = GetJsonManifest(instance);
+ if (manifest == NULL) {
ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
FROM_HERE,
base::Bind(callback.func, callback.user_data,
@@ -1126,7 +1121,7 @@ void OpenManifestEntry(PP_Instance instance,
}
PP_PNaClOptions pnacl_options;
- bool ok = it->second->ResolveKey(key, &resolved_url, &pnacl_options);
+ bool ok = manifest->ResolveKey(key, &resolved_url, &pnacl_options);
// We don't support OpenManifestEntry for files that require PNaCl
// translation.
if (!ok || pnacl_options.translate) {
« components/nacl/renderer/json_manifest.h ('K') | « components/nacl/renderer/json_manifest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698