OLD | NEW |
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/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/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 if (!operation_) { | 80 if (!operation_) { |
81 DidFailOnMainThread(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 81 DidFailOnMainThread(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); |
82 return; | 82 return; |
83 } | 83 } |
84 operation_->Cancel(base::Bind(&IOThreadProxy::DidFinish, this)); | 84 operation_->Cancel(base::Bind(&IOThreadProxy::DidFinish, this)); |
85 } | 85 } |
86 | 86 |
87 private: | 87 private: |
88 FileSystemOperationInterface* GetNewOperation(const GURL& path) { | 88 FileSystemOperationInterface* GetNewOperation(const GURL& path) { |
89 return file_system_context_->CreateFileSystemOperation(path, io_thread_); | 89 return file_system_context_->CreateFileSystemOperation(path); |
90 } | 90 } |
91 | 91 |
92 void DidSucceedOnMainThread() { | 92 void DidSucceedOnMainThread() { |
93 if (!main_thread_->BelongsToCurrentThread()) { | 93 if (!main_thread_->BelongsToCurrentThread()) { |
94 main_thread_->PostTask( | 94 main_thread_->PostTask( |
95 FROM_HERE, | 95 FROM_HERE, |
96 base::Bind(&IOThreadProxy::DidSucceedOnMainThread, this)); | 96 base::Bind(&IOThreadProxy::DidSucceedOnMainThread, this)); |
97 return; | 97 return; |
98 } | 98 } |
99 if (simple_writer_) | 99 if (simple_writer_) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 176 } |
177 | 177 |
178 void SimpleFileWriter::DoWrite( | 178 void SimpleFileWriter::DoWrite( |
179 const GURL& path, const GURL& blob_url, int64 offset) { | 179 const GURL& path, const GURL& blob_url, int64 offset) { |
180 io_thread_proxy_->Write(path, blob_url, offset); | 180 io_thread_proxy_->Write(path, blob_url, offset); |
181 } | 181 } |
182 | 182 |
183 void SimpleFileWriter::DoCancel() { | 183 void SimpleFileWriter::DoCancel() { |
184 io_thread_proxy_->Cancel(); | 184 io_thread_proxy_->Cancel(); |
185 } | 185 } |
OLD | NEW |