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

Unified Diff: webkit/tools/test_shell/simple_resource_loader_bridge.cc

Issue 10701050: net: Implement canceling of all async operations in FileStream. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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: webkit/tools/test_shell/simple_resource_loader_bridge.cc
diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
index 0fd2439af9e6fb62d6c13dd4ab4aa0a5477a4b19..bee0294a11cbdd4a442c5a8879496945c6087b67 100644
--- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc
+++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
@@ -299,7 +299,6 @@ class RequestProxy
// Takes ownership of the params.
RequestProxy()
: download_to_file_(false),
- file_stream_(NULL),
buf_(new net::IOBuffer(kDataSize)),
last_upload_position_(0) {
}
@@ -444,7 +443,8 @@ class RequestProxy
downloaded_file_ = ShareableFileReference::GetOrCreate(
path, ShareableFileReference::DELETE_ON_FINAL_RELEASE,
base::MessageLoopProxy::current());
- file_stream_.OpenSync(
+ file_stream_.reset(new net::FileStream(NULL));
+ file_stream_->OpenSync(
path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE);
}
}
@@ -522,7 +522,7 @@ class RequestProxy
virtual void OnReceivedData(int bytes_read) {
if (download_to_file_) {
- file_stream_.WriteSync(buf_->data(), bytes_read);
+ file_stream_->WriteSync(buf_->data(), bytes_read);
owner_loop_->PostTask(
FROM_HERE,
base::Bind(&RequestProxy::NotifyDownloadedData, this, bytes_read));
@@ -538,7 +538,7 @@ class RequestProxy
const std::string& security_info,
const base::TimeTicks& complete_time) {
if (download_to_file_)
- file_stream_.CloseSync();
+ file_stream_.reset();
owner_loop_->PostTask(
FROM_HERE,
base::Bind(&RequestProxy::NotifyCompletedRequest, this, error_code,
@@ -743,7 +743,7 @@ class RequestProxy
// Support for request.download_to_file behavior.
bool download_to_file_;
- net::FileStream file_stream_;
+ scoped_ptr<net::FileStream> file_stream_;
scoped_refptr<ShareableFileReference> downloaded_file_;
// Size of our async IO data buffers
@@ -819,7 +819,7 @@ class SyncRequestProxy : public RequestProxy {
virtual void OnReceivedData(int bytes_read) OVERRIDE {
if (download_to_file_)
- file_stream_.WriteSync(buf_->data(), bytes_read);
+ file_stream_->WriteSync(buf_->data(), bytes_read);
else
result_->data.append(buf_->data(), bytes_read);
AsyncReadData(); // read more (may recurse)
@@ -830,7 +830,7 @@ class SyncRequestProxy : public RequestProxy {
const std::string& security_info,
const base::TimeTicks& complete_time) OVERRIDE {
if (download_to_file_)
- file_stream_.CloseSync();
+ file_stream_.reset();
result_->error_code = error_code;
event_.Signal();
}
« tools/valgrind/memcheck/suppressions.txt ('K') | « webkit/glue/webfileutilities_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698