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

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

Issue 307933005: Pepper: Refactor PNaCl OpenManifestEntry logic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment for bbudge 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: ppapi/native_client/src/trusted/plugin/pnacl_resources.cc
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc b/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc
index c7cf91b7e6f712ef9887bf13c01665ce42566268..7868f4a56d31b872cdb6555a460c257b13e10615 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_resources.cc
@@ -25,34 +25,6 @@ nacl::string GetFullUrl(const nacl::string& partial_url) {
} // namespace
-// Determine if a URL is for a pnacl-component file, or if it is some other
-// type of URL (e.g., http://, https://, chrome-extension://).
-// The URL could be one of the other variants for shared libraries
-// served from the web.
-bool PnaclUrls::IsPnaclComponent(const nacl::string& full_url) {
- return full_url.find(kPnaclBaseUrl, 0) == 0;
-}
-
-// Convert a URL to a filename accepted by GetReadonlyPnaclFd.
-// Must be kept in sync with chrome/browser/nacl_host/nacl_file_host.
-nacl::string PnaclUrls::PnaclComponentURLToFilename(
- const nacl::string& full_url) {
- // strip component scheme.
- nacl::string r = full_url.substr(nacl::string(kPnaclBaseUrl).length());
-
- // Use white-listed-chars.
- size_t replace_pos;
- static const char* white_list = "abcdefghijklmnopqrstuvwxyz0123456789_";
- replace_pos = r.find_first_not_of(white_list);
- while(replace_pos != nacl::string::npos) {
- r = r.replace(replace_pos, 1, "_");
- replace_pos = r.find_first_not_of(white_list);
- }
- return r;
-}
-
-//////////////////////////////////////////////////////////////////////
-
PnaclResources::~PnaclResources() {
if (llc_file_handle_ != PP_kInvalidFileHandle)
CloseFileHandle(llc_file_handle_);
@@ -62,17 +34,11 @@ PnaclResources::~PnaclResources() {
void PnaclResources::ReadResourceInfo(
const pp::CompletionCallback& resource_info_read_cb) {
- nacl::string full_url = "chrome://pnacl-translator/pnacl.json";
- nacl::string resource_info_filename =
- PnaclUrls::PnaclComponentURLToFilename(full_url);
-
- PLUGIN_PRINTF(("Pnacl-converted resources info url: %s\n",
- resource_info_filename.c_str()));
PP_Var pp_llc_tool_name_var;
PP_Var pp_ld_tool_name_var;
if (!plugin_->nacl_interface()->GetPnaclResourceInfo(
plugin_->pp_instance(),
- resource_info_filename.c_str(),
+ "chrome://pnacl-translator/pnacl.json",
&pp_llc_tool_name_var,
&pp_ld_tool_name_var)) {
coordinator_->ExitWithError();
@@ -102,15 +68,10 @@ void PnaclResources::StartLoad(
PLUGIN_PRINTF(("PnaclResources::StartLoad\n"));
// Do a blocking load of each of the resources.
- nacl::string llc_filename =
- PnaclUrls::PnaclComponentURLToFilename(llc_tool_name_);
llc_file_handle_ =
- plugin_->nacl_interface()->GetReadonlyPnaclFd(llc_filename.c_str());
-
- nacl::string ld_filename =
- PnaclUrls::PnaclComponentURLToFilename(ld_tool_name_);
+ plugin_->nacl_interface()->GetReadonlyPnaclFd(llc_tool_name_.c_str());
ld_file_handle_ =
- plugin_->nacl_interface()->GetReadonlyPnaclFd(ld_filename.c_str());
+ plugin_->nacl_interface()->GetReadonlyPnaclFd(ld_tool_name_.c_str());
int32_t result = PP_OK;
if (llc_file_handle_ == PP_kInvalidFileHandle ||
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/pnacl_resources.h ('k') | ppapi/native_client/src/trusted/plugin/service_runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698