| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 scoped_refptr<FileSystemContext> file_system_context_; | 176 scoped_refptr<FileSystemContext> file_system_context_; |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 | 179 |
| 180 SimpleFileWriter::SimpleFileWriter( | 180 SimpleFileWriter::SimpleFileWriter( |
| 181 const GURL& path, | 181 const GURL& path, |
| 182 WebFileWriterClient* client, | 182 WebFileWriterClient* client, |
| 183 FileSystemContext* file_system_context) | 183 FileSystemContext* file_system_context) |
| 184 : WebFileWriterBase(path, client), | 184 : WebFileWriterBase(path, client), |
| 185 file_system_context_(file_system_context), |
| 185 io_thread_proxy_(new IOThreadProxy(AsWeakPtr(), file_system_context)) { | 186 io_thread_proxy_(new IOThreadProxy(AsWeakPtr(), file_system_context)) { |
| 186 } | 187 } |
| 187 | 188 |
| 188 SimpleFileWriter::~SimpleFileWriter() { | 189 SimpleFileWriter::~SimpleFileWriter() { |
| 189 } | 190 } |
| 190 | 191 |
| 191 void SimpleFileWriter::DoTruncate(const GURL& path, int64 offset) { | 192 void SimpleFileWriter::DoTruncate(const GURL& path, int64 offset) { |
| 192 FileSystemURL url(path); | 193 FileSystemURL url = file_system_context_->CrackURL(path); |
| 193 io_thread_proxy_->Truncate(url, offset); | 194 io_thread_proxy_->Truncate(url, offset); |
| 194 } | 195 } |
| 195 | 196 |
| 196 void SimpleFileWriter::DoWrite( | 197 void SimpleFileWriter::DoWrite( |
| 197 const GURL& path, const GURL& blob_url, int64 offset) { | 198 const GURL& path, const GURL& blob_url, int64 offset) { |
| 198 FileSystemURL url(path); | 199 FileSystemURL url = file_system_context_->CrackURL(path); |
| 199 io_thread_proxy_->Write(url, blob_url, offset); | 200 io_thread_proxy_->Write(url, blob_url, offset); |
| 200 } | 201 } |
| 201 | 202 |
| 202 void SimpleFileWriter::DoCancel() { | 203 void SimpleFileWriter::DoCancel() { |
| 203 io_thread_proxy_->Cancel(); | 204 io_thread_proxy_->Cancel(); |
| 204 } | 205 } |
| OLD | NEW |