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

Unified Diff: webkit/plugins/npapi/plugin_stream.cc

Issue 10495008: Further cleanup in PluginStream. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 8 years, 4 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
« no previous file with comments | « webkit/plugins/npapi/plugin_stream.h ('k') | webkit/plugins/npapi/plugin_stream_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/npapi/plugin_stream.cc
===================================================================
--- webkit/plugins/npapi/plugin_stream.cc (revision 150590)
+++ webkit/plugins/npapi/plugin_stream.cc (working copy)
@@ -109,8 +109,7 @@
}
// If the plugin has requested certain modes, then we need a copy
// of this file on disk. Open it and save it as we go.
- if (requested_plugin_mode_ == NP_ASFILEONLY ||
- requested_plugin_mode_ == NP_ASFILE) {
+ if (RequestedPluginModeIsAsFile()) {
if (OpenTempFile() == false) {
return false;
}
@@ -141,17 +140,16 @@
bool PluginStream::WriteToFile(const char* buf, size_t length) {
// For ASFILEONLY, ASFILE, and SEEK modes, we need to write
// to the disk
- if (TempFileIsValid() &&
- (requested_plugin_mode_ == NP_ASFILE ||
- requested_plugin_mode_ == NP_ASFILEONLY) ) {
+ if (TempFileIsValid() && RequestedPluginModeIsAsFile()) {
size_t totalBytesWritten = 0, bytes;
do {
bytes = WriteBytes(buf, length);
totalBytesWritten += bytes;
} while (bytes > 0U && totalBytesWritten < length);
- if (totalBytesWritten != length)
+ if (totalBytesWritten != length) {
return false;
+ }
}
return true;
@@ -191,8 +189,7 @@
return;
int size = static_cast<int>(delivery_data_.size());
- int written = TryWriteToPlugin(&delivery_data_.front(), size,
- data_offset_);
+ int written = TryWriteToPlugin(&delivery_data_.front(), size, data_offset_);
if (written > 0) {
// Remove the data that we already wrote.
delivery_data_.erase(delivery_data_.begin(),
@@ -287,5 +284,10 @@
}
}
+bool PluginStream::RequestedPluginModeIsAsFile() const {
+ return (requested_plugin_mode_ == NP_ASFILE ||
+ requested_plugin_mode_ == NP_ASFILEONLY);
+}
+
} // namespace npapi
} // namespace webkit
« no previous file with comments | « webkit/plugins/npapi/plugin_stream.h ('k') | webkit/plugins/npapi/plugin_stream_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698