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

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

Issue 288773002: Pepper: Simplify manifest download logic. (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
« no previous file with comments | « ppapi/c/private/ppb_nacl_private.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/native_client/src/trusted/plugin/plugin.cc
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index b2e4cc82fcd59d90dbb47badf3c6a9ce7c6273e9..226cb59771ef9a7c84d6ec8a57c9da6178cb1a24 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -44,11 +44,6 @@ namespace plugin {
namespace {
-// This is a pretty arbitrary limit on the byte size of the NaCl manfest file.
-// Note that the resulting string object has to have at least one byte extra
-// for the null termination character.
-const size_t kNaClManifestMaxFileBytes = 1024 * 1024;
-
// Up to 20 seconds
const int64_t kTimeSmallMin = 1; // in ms
const int64_t kTimeSmallMax = 20000; // in ms
@@ -598,38 +593,12 @@ void Plugin::ProcessNaClManifest(const nacl::string& manifest_json) {
void Plugin::RequestNaClManifest(const nacl::string& url) {
PLUGIN_PRINTF(("Plugin::RequestNaClManifest (url='%s')\n", url.c_str()));
- PP_Bool is_data_uri;
- ErrorInfo error_info;
- if (!nacl_interface_->RequestNaClManifest(pp_instance(), url.c_str(),
- &is_data_uri))
- return;
- pp::Var nmf_resolved_url =
- pp::Var(pp::PASS_REF, nacl_interface_->GetManifestBaseURL(pp_instance()));
- if (is_data_uri) {
- std::string string_nmf_resolved_url = nmf_resolved_url.AsString();
- pp::Var nmf_data = pp::Var(
- pp::PASS_REF,
- nacl_interface_->ParseDataURL(string_nmf_resolved_url.c_str()));
- if (!nmf_data.is_string()) {
- error_info.SetReport(PP_NACL_ERROR_MANIFEST_LOAD_URL,
- "could not load manifest url.");
- ReportLoadError(error_info);
- } else if (nmf_data.AsString().size() > kNaClManifestMaxFileBytes) {
- error_info.SetReport(PP_NACL_ERROR_MANIFEST_TOO_LARGE,
- "manifest file too large.");
- ReportLoadError(error_info);
- } else {
- ProcessNaClManifest(nmf_data.AsString());
- }
- } else {
- pp::CompletionCallback open_callback =
- callback_factory_.NewCallback(&Plugin::NaClManifestFileDidOpen);
- std::string nmf_resolved_url_str = nmf_resolved_url.AsString();
- nacl_interface_->DownloadManifestToBuffer(
- pp_instance(),
- &manifest_data_var_,
- open_callback.pp_completion_callback());
- }
+ pp::CompletionCallback open_callback =
+ callback_factory_.NewCallback(&Plugin::NaClManifestFileDidOpen);
+ nacl_interface_->RequestNaClManifest(pp_instance(),
+ url.c_str(),
+ &manifest_data_var_,
+ open_callback.pp_completion_callback());
}
« no previous file with comments | « ppapi/c/private/ppb_nacl_private.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698