summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-20 18:44:14 +0000
committerteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-20 18:44:14 +0000
commit4f154c2deb5c4ab1010fb5ed85c6b05f56841139 (patch)
tree0f9eab39a319f018b785411029b134b04188e8b6 /components
parent855bba20e8b71f586cd63df0631714681cbd251d (diff)
downloadchromium_src-4f154c2deb5c4ab1010fb5ed85c6b05f56841139.zip
chromium_src-4f154c2deb5c4ab1010fb5ed85c6b05f56841139.tar.gz
chromium_src-4f154c2deb5c4ab1010fb5ed85c6b05f56841139.tar.bz2
Pepper: Manifest refactoring in trusted plugin.
This lifts more manifest processing code out of the trusted plugin. Specifically, instead of the trusted plugin receiving a PP_Var with the contents of the manifest and making another method to create the manifest id, the trusted plugin now simply receives the manifest ID directly. BUG=239656 Review URL: https://codereview.chromium.org/287153006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271719 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r--components/nacl/renderer/ppb_nacl_private_impl.cc38
1 files changed, 22 insertions, 16 deletions
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc
index 3f5685d..634bb81 100644
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -819,12 +819,16 @@ int64_t GetNexeSize(PP_Instance instance) {
}
void DownloadManifestToBuffer(PP_Instance instance,
- struct PP_Var* out_data,
+ int32_t* out_manifest_id,
struct PP_CompletionCallback callback);
+int32_t CreateJsonManifest(PP_Instance instance,
+ const std::string& manifest_url,
+ const std::string& manifest_data);
+
void RequestNaClManifest(PP_Instance instance,
const char* url,
- PP_Var* out_data,
+ int32_t* out_manifest_id,
PP_CompletionCallback callback) {
NexeLoadManager* load_manager = GetNexeLoadManager(instance);
DCHECK(load_manager);
@@ -854,7 +858,7 @@ void RequestNaClManifest(PP_Instance instance,
if (net::DataURL::Parse(gurl, &mime_type, &charset, &data)) {
if (data.size() <= ManifestDownloader::kNaClManifestMaxFileBytes) {
error = PP_OK;
- *out_data = ppapi::StringVar::StringToPPVar(data);
+ *out_manifest_id = CreateJsonManifest(instance, base_url.spec(), data);
} else {
load_manager->ReportLoadError(PP_NACL_ERROR_MANIFEST_TOO_LARGE,
"manifest file too large.");
@@ -867,7 +871,7 @@ void RequestNaClManifest(PP_Instance instance,
FROM_HERE,
base::Bind(callback.func, callback.user_data, error));
} else {
- DownloadManifestToBuffer(instance, out_data, callback);
+ DownloadManifestToBuffer(instance, out_manifest_id, callback);
}
}
@@ -918,13 +922,13 @@ PP_Bool DevInterfacesEnabled(PP_Instance instance) {
void DownloadManifestToBufferCompletion(PP_Instance instance,
struct PP_CompletionCallback callback,
- struct PP_Var* out_data,
+ int32_t* out_manifest_id,
base::Time start_time,
PP_NaClError pp_nacl_error,
const std::string& data);
void DownloadManifestToBuffer(PP_Instance instance,
- struct PP_Var* out_data,
+ int32_t* out_manifest_id,
struct PP_CompletionCallback callback) {
nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance);
DCHECK(load_manager);
@@ -949,13 +953,13 @@ void DownloadManifestToBuffer(PP_Instance instance,
url_loader.Pass(),
load_manager->is_installed(),
base::Bind(DownloadManifestToBufferCompletion,
- instance, callback, out_data, base::Time::Now()));
+ instance, callback, out_manifest_id, base::Time::Now()));
manifest_downloader->Load(request);
}
void DownloadManifestToBufferCompletion(PP_Instance instance,
struct PP_CompletionCallback callback,
- struct PP_Var* out_data,
+ int32_t* out_manifest_id,
base::Time start_time,
PP_NaClError pp_nacl_error,
const std::string& data) {
@@ -997,8 +1001,8 @@ void DownloadManifestToBufferCompletion(PP_Instance instance,
}
if (pp_error == PP_OK) {
- std::string contents;
- *out_data = ppapi::StringVar::StringToPPVar(data);
+ std::string base_url = load_manager->manifest_base_url().spec();
+ *out_manifest_id = CreateJsonManifest(instance, base_url, data);
}
callback.func(callback.user_data, pp_error);
}
@@ -1008,8 +1012,11 @@ int32_t CreatePNaClManifest(PP_Instance /* instance */) {
}
int32_t CreateJsonManifest(PP_Instance instance,
- const char* manifest_url,
- const char* manifest_data) {
+ const std::string& manifest_url,
+ const std::string& manifest_data) {
+ HistogramSizeKB("NaCl.Perf.Size.Manifest",
+ static_cast<int32_t>(manifest_data.length() / 1024));
+
nacl::NexeLoadManager* load_manager = GetNexeLoadManager(instance);
if (!load_manager)
return -1;
@@ -1024,12 +1031,12 @@ int32_t CreateJsonManifest(PP_Instance instance,
scoped_ptr<nacl::JsonManifest> j(
new nacl::JsonManifest(
- manifest_url,
+ manifest_url.c_str(),
isa_type,
IsNonSFIModeEnabled(),
- PP_ToBool(NaClDebugEnabledForURL(manifest_url))));
+ PP_ToBool(NaClDebugEnabledForURL(manifest_url.c_str()))));
JsonManifest::ErrorInfo error_info;
- if (j->Init(manifest_data, &error_info)) {
+ if (j->Init(manifest_data.c_str(), &error_info)) {
g_manifest_map.Get().add(manifest_id, j.Pass());
return manifest_id;
}
@@ -1461,7 +1468,6 @@ const PPB_NaCl_Private nacl_interface = {
&GetManifestURLArgument,
&DevInterfacesEnabled,
&CreatePNaClManifest,
- &CreateJsonManifest,
&DestroyManifest,
&ManifestGetProgramURL,
&ManifestResolveKey,