Chromium Code Reviews| 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 eace43823b94c338274d2f29546141066f0bf6c1..0453d640885d6111fd4be551cbda186f40b30fe8 100644 |
| --- a/ppapi/native_client/src/trusted/plugin/plugin.cc |
| +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc |
| @@ -354,23 +354,12 @@ NaClSubprocess* Plugin::LoadHelperNaClModule(const nacl::string& helper_url, |
| return nacl_subprocess.release(); |
| } |
| -Plugin* Plugin::New(PP_Instance pp_instance) { |
| - PLUGIN_PRINTF(("Plugin::New (pp_instance=%" NACL_PRId32 ")\n", pp_instance)); |
| - Plugin* plugin = new Plugin(pp_instance); |
| - PLUGIN_PRINTF(("Plugin::New (plugin=%p)\n", static_cast<void*>(plugin))); |
| - return plugin; |
| -} |
| - |
| // All failures of this function will show up as "Missing Plugin-in", so |
| // there is no need to log to JS console that there was an initialization |
| // failure. Note that module loading functions will log their own errors. |
| bool Plugin::Init(uint32_t argc, const char* argn[], const char* argv[]) { |
| PLUGIN_PRINTF(("Plugin::Init (argc=%" NACL_PRIu32 ")\n", argc)); |
| nacl_interface_->InitializePlugin(pp_instance(), argc, argn, argv); |
| - url_util_ = pp::URLUtil_Dev::Get(); |
| - if (url_util_ == NULL) |
| - return false; |
| - |
| wrapper_factory_ = new nacl::DescWrapperFactory(); |
| pp::Var manifest_url(pp::PASS_REF, nacl_interface_->GetManifestURLArgument( |
| pp_instance())); |
| @@ -654,15 +643,13 @@ void Plugin::NaClManifestFileDidOpen(int32_t pp_error) { |
| void Plugin::ProcessNaClManifest(const nacl::string& manifest_json) { |
| HistogramSizeKB("NaCl.Perf.Size.Manifest", |
| static_cast<int32_t>(manifest_json.length() / 1024)); |
| - ErrorInfo error_info; |
| - if (!SetManifestObject(manifest_json, &error_info)) { |
| - ReportLoadError(error_info); |
| + if (!SetManifestObject(manifest_json)) |
| return; |
| - } |
| nacl::string program_url; |
| PP_PNaClOptions pnacl_options = {PP_FALSE, PP_FALSE, 2}; |
| bool uses_nonsfi_mode; |
| + ErrorInfo error_info; |
| if (manifest_->GetProgramURL( |
| &program_url, &pnacl_options, &uses_nonsfi_mode, &error_info)) { |
| // TODO(teravest): Make ProcessNaClManifest take responsibility for more of |
| @@ -742,12 +729,11 @@ void Plugin::RequestNaClManifest(const nacl::string& url) { |
| } |
| -bool Plugin::SetManifestObject(const nacl::string& manifest_json, |
| - ErrorInfo* error_info) { |
| +bool Plugin::SetManifestObject(const nacl::string& manifest_json) { |
| PLUGIN_PRINTF(("Plugin::SetManifestObject(): manifest_json='%s'.\n", |
| manifest_json.c_str())); |
| - if (error_info == NULL) |
| - return false; |
| + ErrorInfo error_info; |
| + |
| // Determine whether lookups should use portable (i.e., pnacl versions) |
| // rather than platform-specific files. |
| bool is_pnacl = nacl_interface_->IsPNaCl(pp_instance()); |
| @@ -760,12 +746,13 @@ bool Plugin::SetManifestObject(const nacl::string& manifest_json, |
| manifest_base_url_str.c_str()); |
| const char* sandbox_isa = nacl_interface_->GetSandboxArch(); |
| nacl::scoped_ptr<JsonManifest> json_manifest( |
| - new JsonManifest(url_util_, |
| + new JsonManifest(pp::URLUtil_Dev::Get(), |
| manifest_base_url_str, |
| (is_pnacl ? kPortableArch : sandbox_isa), |
| nonsfi_mode_enabled, |
| pnacl_debug)); |
| - if (!json_manifest->Init(manifest_json, error_info)) { |
| + if (!json_manifest->Init(manifest_json, &error_info)) { |
| + ReportLoadError(error_info); |
| return false; |
| } |
| manifest_.reset(json_manifest.release()); |
| @@ -790,9 +777,8 @@ void Plugin::UrlDidOpenForStreamAsFile( |
| } else if (info->get_desc() > NACL_NO_FILE_DESC) { |
| std::map<nacl::string, NaClFileInfoAutoCloser*>::iterator it = |
| url_file_info_map_.find(url_downloader->url()); |
| - if (it != url_file_info_map_.end()) { |
| + if (it != url_file_info_map_.end()) |
| delete it->second; |
| - } |
| url_file_info_map_[url_downloader->url()] = info; |
| callback.Run(PP_OK); |
| } else { |
| @@ -974,8 +960,8 @@ bool Plugin::OpenURLFast(const nacl::string& url, |
| } |
| bool Plugin::DocumentCanRequest(const std::string& url) { |
| - CHECK(url_util_ != NULL); |
| - return url_util_->DocumentCanRequest(this, pp::Var(url)); |
| + CHECK(pp::URLUtil_Dev::Get() != NULL); |
| + return pp::URLUtil_Dev::Get()->DocumentCanRequest(this, pp::Var(url)); |
|
dmichael (off chromium)
2014/04/28 23:01:44
Hopefully this doesn't matter, but *if* this ever
|
| } |
| void Plugin::set_exit_status(int exit_status) { |