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

Unified Diff: chrome/browser/plugin_process_host.cc

Issue 18390: Change URLRequest to use a ref-counted buffer for actual IO.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 | « chrome/browser/net/url_fetcher.cc ('k') | chrome/browser/renderer_host/async_resource_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugin_process_host.cc
===================================================================
--- chrome/browser/plugin_process_host.cc (revision 8565)
+++ chrome/browser/plugin_process_host.cc (working copy)
@@ -36,6 +36,7 @@
#include "chrome/common/render_messages.h"
#include "chrome/common/win_util.h"
#include "net/base/cookie_monster.h"
+#include "net/base/io_buffer.h"
#include "net/proxy/proxy_service.h"
#include "net/url_request/url_request.h"
#include "sandbox/src/sandbox.h"
@@ -127,7 +128,7 @@
// The full path of the downloaded file.
std::wstring download_file_path_;
// The buffer passed off to URLRequest::Read.
- char download_file_buffer_[kDownloadFileBufferSize];
+ scoped_refptr<net::IOBuffer> download_file_buffer_;
// The window handle for sending the WM_COPYDATA notification,
// indicating that the download completed.
HWND download_file_caller_window_;
@@ -142,12 +143,13 @@
const std::string& download_url,
int source_pid, HWND caller_window)
: download_url_(download_url),
+ download_file_request_(NULL),
+ download_file_(INVALID_HANDLE_VALUE),
+ download_file_buffer_(new net::IOBuffer(kDownloadFileBufferSize)),
download_file_caller_window_(caller_window),
- download_source_pid_(source_pid),
- download_file_request_(NULL),
- download_file_(INVALID_HANDLE_VALUE) {
+ download_source_pid_(source_pid) {
DCHECK(::IsWindow(caller_window));
- memset(download_file_buffer_, 0, arraysize(download_file_buffer_));
+ memset(download_file_buffer_->data(), 0, kDownloadFileBufferSize);
}
PluginDownloadUrlHelper::~PluginDownloadUrlHelper() {
@@ -210,7 +212,7 @@
} else {
// Initiate a read.
int bytes_read = 0;
- if (!request->Read(download_file_buffer_, arraysize(download_file_buffer_),
+ if (!request->Read(download_file_buffer_, kDownloadFileBufferSize,
&bytes_read)) {
// If the error is not an IO pending, then we're done
// reading.
@@ -238,7 +240,8 @@
while (request->status().is_success()) {
unsigned long bytes_written = 0;
- BOOL write_result = WriteFile(download_file_, download_file_buffer_,
+ BOOL write_result = WriteFile(download_file_,
+ download_file_buffer_->data(),
request_bytes_read, &bytes_written, NULL);
DCHECK(!write_result || (bytes_written == request_bytes_read));
@@ -249,7 +252,7 @@
// Start reading
request_bytes_read = 0;
- if (!request->Read(download_file_buffer_, arraysize(download_file_buffer_),
+ if (!request->Read(download_file_buffer_, kDownloadFileBufferSize,
&request_bytes_read)) {
if (!request->status().is_io_pending()) {
// If the error is not an IO pending, then we're done
« no previous file with comments | « chrome/browser/net/url_fetcher.cc ('k') | chrome/browser/renderer_host/async_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698