summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-21 19:21:29 +0000
committerteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-21 19:21:29 +0000
commit7d28e0c3facbec17f162ecaea0dbe0ded982e1f8 (patch)
tree45950cf58b3c731d5a38abd79b52b51c1019aa4c
parentad88ec0d628aaa483942aa9762ed52845dd3e919 (diff)
downloadchromium_src-7d28e0c3facbec17f162ecaea0dbe0ded982e1f8.zip
chromium_src-7d28e0c3facbec17f162ecaea0dbe0ded982e1f8.tar.gz
chromium_src-7d28e0c3facbec17f162ecaea0dbe0ded982e1f8.tar.bz2
Pepper: Remove url_info_map from trusted plugin.
This appears to be a vestigal part of some StreamAsFile() operation that no longer exists. It's not necessary to cache this file info in the plugin, as we only ever return it once. I've split this off from a bigger StreamAsFile() refactoring to make the diff smaller, to help debug Windows failures on that patch. BUG=239656 R=bbudge@chromium.org Review URL: https://codereview.chromium.org/297763002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271940 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.cc32
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.h13
-rw-r--r--ppapi/native_client/src/trusted/plugin/service_runtime.cc6
3 files changed, 9 insertions, 42 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index 56d4441..f88c754 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -355,12 +355,6 @@ Plugin::~Plugin() {
// Destroy the coordinator while the rest of the data is still there
pnacl_coordinator_.reset(NULL);
- for (std::map<nacl::string, NaClFileInfoAutoCloser*>::iterator it =
- url_file_info_map_.begin();
- it != url_file_info_map_.end();
- ++it) {
- delete it->second;
- }
url_downloaders_.erase(url_downloaders_.begin(), url_downloaders_.end());
// Clean up accounting for our instance inside the NaCl interface.
@@ -551,6 +545,7 @@ void Plugin::RequestNaClManifest(const nacl::string& url) {
void Plugin::UrlDidOpenForStreamAsFile(
int32_t pp_error,
FileDownloader* url_downloader,
+ NaClFileInfo* out_file_info,
pp::CompletionCallback callback) {
PLUGIN_PRINTF(("Plugin::UrlDidOpen (pp_error=%" NACL_PRId32
", url_downloader=%p)\n", pp_error,
@@ -564,11 +559,7 @@ void Plugin::UrlDidOpenForStreamAsFile(
callback.Run(pp_error);
delete info;
} 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())
- delete it->second;
- url_file_info_map_[url_downloader->url()] = info;
+ *out_file_info = info->Release();
callback.Run(PP_OK);
} else {
callback.Run(PP_ERROR_FAILED);
@@ -576,21 +567,8 @@ void Plugin::UrlDidOpenForStreamAsFile(
}
}
-struct NaClFileInfo Plugin::GetFileInfo(const nacl::string& url) {
- struct NaClFileInfo info;
- memset(&info, 0, sizeof(info));
- std::map<nacl::string, NaClFileInfoAutoCloser*>::iterator it =
- url_file_info_map_.find(url);
- if (it != url_file_info_map_.end()) {
- info = it->second->get();
- info.desc = DUP(info.desc);
- } else {
- info.desc = -1;
- }
- return info;
-}
-
bool Plugin::StreamAsFile(const nacl::string& url,
+ NaClFileInfo* out_file_info,
const pp::CompletionCallback& callback) {
PLUGIN_PRINTF(("Plugin::StreamAsFile (url='%s')\n", url.c_str()));
FileDownloader* downloader = new FileDownloader();
@@ -604,12 +582,12 @@ bool Plugin::StreamAsFile(const nacl::string& url,
// Try the fast path first. This will only block if the file is installed.
if (OpenURLFast(url, downloader)) {
- UrlDidOpenForStreamAsFile(PP_OK, downloader, callback);
+ UrlDidOpenForStreamAsFile(PP_OK, downloader, out_file_info, callback);
return true;
}
pp::CompletionCallback open_callback = callback_factory_.NewCallback(
- &Plugin::UrlDidOpenForStreamAsFile, downloader, callback);
+ &Plugin::UrlDidOpenForStreamAsFile, downloader, out_file_info, callback);
// If true, will always call the callback on success or failure.
return downloader->Open(url,
DOWNLOAD_TO_FILE,
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h
index bd32913..244c824 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.h
+++ b/ppapi/native_client/src/trusted/plugin/plugin.h
@@ -149,16 +149,11 @@ class Plugin : public pp::Instance {
void DispatchProgressEvent(int32_t result);
// Requests a URL asynchronously resulting in a call to pp_callback with
- // a PP_Error indicating status. On success an open file descriptor
- // corresponding to the url body is recorded for further lookup.
+ // a PP_Error indicating status.
bool StreamAsFile(const nacl::string& url,
+ NaClFileInfo *out_file_info,
const pp::CompletionCallback& callback);
- // Returns rich information for a file retrieved by StreamAsFile(). This info
- // contains a file descriptor. The caller must take ownership of this
- // descriptor.
- struct NaClFileInfo GetFileInfo(const nacl::string& url);
-
// A helper function that indicates if |url| can be requested by the document
// under the same-origin policy. Strictly speaking, it may be possible for the
// document to request the URL using CORS even if this function returns false.
@@ -255,6 +250,7 @@ class Plugin : public pp::Instance {
// Callback used when loading a URL for SRPC-based StreamAsFile().
void UrlDidOpenForStreamAsFile(int32_t pp_error,
FileDownloader* url_downloader,
+ NaClFileInfo* out_file_info,
pp::CompletionCallback pp_callback);
// Open an app file by requesting a file descriptor from the browser. This
@@ -280,9 +276,6 @@ class Plugin : public pp::Instance {
// Keep track of the FileDownloaders created to fetch urls.
std::set<FileDownloader*> url_downloaders_;
- // Keep track of file descriptors opened by StreamAsFile().
- // These are owned by the browser.
- std::map<nacl::string, NaClFileInfoAutoCloser*> url_file_info_map_;
// Callback to receive .nexe and .dso download progress notifications.
static void UpdateDownloadProgress(
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index e4f1450..06d03ba 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -411,7 +411,7 @@ void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation(
&PluginReverseInterface::StreamAsFile_MainThreadContinuation,
open_cont);
- if (!plugin_->StreamAsFile(mapped_url, stream_cc)) {
+ if (!plugin_->StreamAsFile(mapped_url, p->file_info, stream_cc)) {
NaClLog(4,
"OpenManifestEntry_MainThreadContinuation: "
"StreamAsFile failed\n");
@@ -435,10 +435,6 @@ void PluginReverseInterface::StreamAsFile_MainThreadContinuation(
{
nacl::MutexLocker take(&mu_);
if (result == PP_OK) {
- NaClLog(4, "StreamAsFile_MainThreadContinuation: GetFileInfo(%s)\n",
- p->url.c_str());
- *p->file_info = plugin_->GetFileInfo(p->url);
-
NaClLog(4,
"StreamAsFile_MainThreadContinuation: PP_OK, desc %d\n",
p->file_info->desc);