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

Side by Side Diff: webkit/plugins/npapi/plugin_stream_win.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/npapi/plugin_stream_posix.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/plugins/npapi/plugin_stream.h" 5 #include "webkit/plugins/npapi/plugin_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "webkit/plugins/npapi/plugin_instance.h" 8 #include "webkit/plugins/npapi/plugin_instance.h"
9 9
10 namespace webkit { 10 namespace webkit {
11 namespace npapi { 11 namespace npapi {
12 12
13 void PluginStream::ResetTempFileHandle() { 13 void PluginStream::ResetTempFileHandle() {
14 temp_file_handle_ = INVALID_HANDLE_VALUE; 14 temp_file_handle_ = INVALID_HANDLE_VALUE;
15 } 15 }
16 16
17 void PluginStream::ResetTempFileName() { 17 void PluginStream::ResetTempFileName() {
18 temp_file_name_[0] = '\0'; 18 temp_file_name_[0] = '\0';
19 } 19 }
20 20
21 void PluginStream::WriteAsFile() { 21 void PluginStream::WriteAsFile() {
22 if (requested_plugin_mode_ == NP_ASFILE || 22 if (RequestedPluginModeIsAsFile())
23 requested_plugin_mode_ == NP_ASFILEONLY)
24 instance_->NPP_StreamAsFile(&stream_, temp_file_name_); 23 instance_->NPP_StreamAsFile(&stream_, temp_file_name_);
25 } 24 }
26 25
27 size_t PluginStream::WriteBytes(const char *buf, size_t length) { 26 size_t PluginStream::WriteBytes(const char *buf, size_t length) {
28 DWORD bytes; 27 DWORD bytes;
29 28
30 if (!WriteFile(temp_file_handle_, buf, length, &bytes, 0)) 29 if (!WriteFile(temp_file_handle_, buf, length, &bytes, 0))
31 return 0U; 30 return 0U;
32 31
33 return static_cast<size_t>(bytes); 32 return static_cast<size_t>(bytes);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 CloseHandle(temp_file_handle_); 72 CloseHandle(temp_file_handle_);
74 ResetTempFileHandle(); 73 ResetTempFileHandle();
75 } 74 }
76 75
77 bool PluginStream::TempFileIsValid() const { 76 bool PluginStream::TempFileIsValid() const {
78 return temp_file_handle_ != INVALID_HANDLE_VALUE; 77 return temp_file_handle_ != INVALID_HANDLE_VALUE;
79 } 78 }
80 79
81 } // namespace npapi 80 } // namespace npapi
82 } // namespace webkit 81 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/plugin_stream_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698