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

Side by Side Diff: webkit/tools/test_shell/simple_file_writer.cc

Issue 9016020: Cleanup FileSystemOperation for preparing for adding FSO-factory method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tools/test_shell/simple_file_writer.h" 5 #include "webkit/tools/test_shell/simple_file_writer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "net/url_request/url_request_context.h" 10 #include "net/url_request/url_request_context.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if (!io_thread_->BelongsToCurrentThread()) { 73 if (!io_thread_->BelongsToCurrentThread()) {
74 io_thread_->PostTask( 74 io_thread_->PostTask(
75 FROM_HERE, 75 FROM_HERE,
76 base::Bind(&IOThreadProxy::Cancel, this)); 76 base::Bind(&IOThreadProxy::Cancel, this));
77 return; 77 return;
78 } 78 }
79 if (!operation_) { 79 if (!operation_) {
80 DidFail(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); 80 DidFail(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
81 return; 81 return;
82 } 82 }
83 operation_->Cancel(GetNewOperation()); 83 operation_->Cancel(new CallbackDispatcher(this));
84 } 84 }
85 85
86 private: 86 private:
87 // Inner class to receive callbacks from FileSystemOperation. 87 // Inner class to receive callbacks from FileSystemOperation.
88 class CallbackDispatcher : public FileSystemCallbackDispatcher { 88 class CallbackDispatcher : public FileSystemCallbackDispatcher {
89 public: 89 public:
90 explicit CallbackDispatcher(IOThreadProxy* proxy) : proxy_(proxy) { 90 explicit CallbackDispatcher(IOThreadProxy* proxy) : proxy_(proxy) {
91 } 91 }
92 92
93 ~CallbackDispatcher() { 93 ~CallbackDispatcher() {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 200 }
201 201
202 void SimpleFileWriter::DoWrite( 202 void SimpleFileWriter::DoWrite(
203 const GURL& path, const GURL& blob_url, int64 offset) { 203 const GURL& path, const GURL& blob_url, int64 offset) {
204 io_thread_proxy_->Write(path, blob_url, offset); 204 io_thread_proxy_->Write(path, blob_url, offset);
205 } 205 }
206 206
207 void SimpleFileWriter::DoCancel() { 207 void SimpleFileWriter::DoCancel() {
208 io_thread_proxy_->Cancel(); 208 io_thread_proxy_->Cancel();
209 } 209 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698