summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-02 00:59:58 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-02 00:59:58 +0000
commitaa3c64b26eced83e5f7544d7243061e5c39e8d18 (patch)
tree9b37f424f002d7fc39a35f30f158ae54f059968c
parentfadf207088f23c736492e814be97c18369be52e7 (diff)
downloadchromium_src-aa3c64b26eced83e5f7544d7243061e5c39e8d18.zip
chromium_src-aa3c64b26eced83e5f7544d7243061e5c39e8d18.tar.gz
chromium_src-aa3c64b26eced83e5f7544d7243061e5c39e8d18.tar.bz2
Revert bad changes from r132747 to fix NP_ASFILE regression in NPAPI plugins.
BUG=128693 TEST=see bug 125189. Review URL: https://chromiumcodereview.appspot.com/10443079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140145 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/plugins/npapi/plugin_stream.cc3
-rw-r--r--webkit/plugins/npapi/plugin_stream.h7
-rw-r--r--webkit/plugins/npapi/plugin_stream_posix.cc12
-rw-r--r--webkit/plugins/npapi/plugin_stream_win.cc10
4 files changed, 20 insertions, 12 deletions
diff --git a/webkit/plugins/npapi/plugin_stream.cc b/webkit/plugins/npapi/plugin_stream.cc
index 2cfde67..5b637fa 100644
--- a/webkit/plugins/npapi/plugin_stream.cc
+++ b/webkit/plugins/npapi/plugin_stream.cc
@@ -36,7 +36,8 @@ PluginStream::PluginStream(
seekable_stream_(false) {
memset(&stream_, 0, sizeof(stream_));
stream_.url = base::strdup(url);
- ResetTempFilenameAndHandle();
+ ResetTempFileHandle();
+ ResetTempFileName();
}
PluginStream::~PluginStream() {
diff --git a/webkit/plugins/npapi/plugin_stream.h b/webkit/plugins/npapi/plugin_stream.h
index 2c18a1e..72fb2d2 100644
--- a/webkit/plugins/npapi/plugin_stream.h
+++ b/webkit/plugins/npapi/plugin_stream.h
@@ -94,8 +94,11 @@ class PluginStream : public base::RefCounted<PluginStream> {
std::string pending_redirect_url_;
private:
- // Per platform method to reset the temporary file name and handle.
- void ResetTempFilenameAndHandle();
+ // Per platform method to reset the temporary file handle.
+ void ResetTempFileHandle();
+
+ // Per platform method to reset the temporary file name.
+ void ResetTempFileName();
// Open a temporary file for this stream.
// If successful, will set temp_file_name_, temp_file_handle_, and
diff --git a/webkit/plugins/npapi/plugin_stream_posix.cc b/webkit/plugins/npapi/plugin_stream_posix.cc
index fd275a2..888ad14 100644
--- a/webkit/plugins/npapi/plugin_stream_posix.cc
+++ b/webkit/plugins/npapi/plugin_stream_posix.cc
@@ -14,11 +14,14 @@
namespace webkit {
namespace npapi {
-void PluginStream::ResetTempFilenameAndHandle() {
- temp_file_path_ = FilePath();
+void PluginStream::ResetTempFileHandle() {
temp_file_ = NULL;
}
+void PluginStream::ResetTempFileName() {
+ temp_file_path_ = FilePath();
+}
+
void PluginStream::WriteAsFile() {
if (requested_plugin_mode_ == NP_ASFILE ||
requested_plugin_mode_ == NP_ASFILEONLY) {
@@ -38,7 +41,7 @@ bool PluginStream::OpenTempFile() {
if (!temp_file_) {
file_util::Delete(temp_file_path_, false);
- temp_file_path_ = FilePath();
+ ResetTempFileName();
return false;
}
return true;
@@ -49,8 +52,7 @@ void PluginStream::CloseTempFile() {
return;
file_util::CloseFile(temp_file_);
- file_util::Delete(temp_file_path_, false);
- ResetTempFilenameAndHandle();
+ ResetTempFileHandle();
}
bool PluginStream::TempFileIsValid() const {
diff --git a/webkit/plugins/npapi/plugin_stream_win.cc b/webkit/plugins/npapi/plugin_stream_win.cc
index 62ecc11d9..70c0fda 100644
--- a/webkit/plugins/npapi/plugin_stream_win.cc
+++ b/webkit/plugins/npapi/plugin_stream_win.cc
@@ -10,8 +10,11 @@
namespace webkit {
namespace npapi {
-void PluginStream::ResetTempFilenameAndHandle() {
+void PluginStream::ResetTempFileHandle() {
temp_file_handle_ = INVALID_HANDLE_VALUE;
+}
+
+void PluginStream::ResetTempFileName() {
temp_file_name_[0] = '\0';
}
@@ -57,7 +60,7 @@ bool PluginStream::OpenTempFile() {
FILE_ATTRIBUTE_NORMAL,
0);
if (temp_file_handle_ == INVALID_HANDLE_VALUE) {
- temp_file_name_[0] = '\0';
+ ResetTempFileName();
return false;
}
return true;
@@ -68,8 +71,7 @@ void PluginStream::CloseTempFile() {
return;
CloseHandle(temp_file_handle_);
- DeleteFileA(temp_file_name_);
- ResetTempFilenameAndHandle();
+ ResetTempFileHandle();
}
bool PluginStream::TempFileIsValid() const {