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

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

Issue 297763002: Pepper: Remove url_info_map from trusted plugin. (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
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 0e5422a86580321c5d9dfbf1f571c052d65ce3a2..94dde1cc1f3ffc75e9dd9688c7f469b16dd19c35 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -373,12 +373,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.
@@ -569,6 +563,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,
@@ -582,11 +577,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);
@@ -594,21 +585,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();
@@ -622,12 +600,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,
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/plugin.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