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

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

Issue 10870040: Rename FileSystemOperationInterface to FileSystemOperation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/tools/test_shell/simple_file_system.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "net/url_request/url_request_context.h" 11 #include "net/url_request/url_request_context.h"
12 #include "webkit/fileapi/file_system_context.h" 12 #include "webkit/fileapi/file_system_context.h"
13 #include "webkit/fileapi/file_system_operation_interface.h" 13 #include "webkit/fileapi/file_system_operation.h"
14 #include "webkit/fileapi/file_system_types.h" 14 #include "webkit/fileapi/file_system_types.h"
15 #include "webkit/fileapi/file_system_url.h" 15 #include "webkit/fileapi/file_system_url.h"
16 #include "webkit/glue/webkit_glue.h" 16 #include "webkit/glue/webkit_glue.h"
17 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" 17 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
18 18
19 using fileapi::FileSystemURL; 19 using fileapi::FileSystemURL;
20 using fileapi::FileSystemContext; 20 using fileapi::FileSystemContext;
21 using fileapi::FileSystemOperationInterface; 21 using fileapi::FileSystemOperation;
22 using fileapi::WebFileWriterBase; 22 using fileapi::WebFileWriterBase;
23 using WebKit::WebFileWriterClient; 23 using WebKit::WebFileWriterClient;
24 using WebKit::WebString; 24 using WebKit::WebString;
25 using WebKit::WebURL; 25 using WebKit::WebURL;
26 26
27 net::URLRequestContext* SimpleFileWriter::request_context_ = NULL; 27 net::URLRequestContext* SimpleFileWriter::request_context_ = NULL;
28 28
29 // Helper class to proxy to write and truncate calls to the IO thread, 29 // Helper class to proxy to write and truncate calls to the IO thread,
30 // and to proxy the results back to the main thead. There is a one-to-one 30 // and to proxy the results back to the main thead. There is a one-to-one
31 // relationship between SimpleFileWriters and IOThreadBackends. 31 // relationship between SimpleFileWriters and IOThreadBackends.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 DidFailOnMainThread(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); 85 DidFailOnMainThread(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
86 return; 86 return;
87 } 87 }
88 operation_->Cancel(base::Bind(&IOThreadProxy::DidFinish, this)); 88 operation_->Cancel(base::Bind(&IOThreadProxy::DidFinish, this));
89 } 89 }
90 90
91 private: 91 private:
92 friend class base::RefCountedThreadSafe<IOThreadProxy>; 92 friend class base::RefCountedThreadSafe<IOThreadProxy>;
93 virtual ~IOThreadProxy() {} 93 virtual ~IOThreadProxy() {}
94 94
95 FileSystemOperationInterface* GetNewOperation( const FileSystemURL& url) { 95 FileSystemOperation* GetNewOperation( const FileSystemURL& url) {
96 return file_system_context_->CreateFileSystemOperation(url); 96 return file_system_context_->CreateFileSystemOperation(url);
97 } 97 }
98 98
99 // Returns true if it is not writable. 99 // Returns true if it is not writable.
100 bool FailIfNotWritable(const FileSystemURL& url) { 100 bool FailIfNotWritable(const FileSystemURL& url) {
101 if (url.type() == fileapi::kFileSystemTypeIsolated) { 101 if (url.type() == fileapi::kFileSystemTypeIsolated) {
102 // Write is not allowed in isolate file system in SimpleFileWriter. 102 // Write is not allowed in isolate file system in SimpleFileWriter.
103 DidFailOnMainThread(base::PLATFORM_FILE_ERROR_SECURITY); 103 DidFailOnMainThread(base::PLATFORM_FILE_ERROR_SECURITY);
104 return true; 104 return true;
105 } 105 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 164 }
165 } 165 }
166 166
167 scoped_refptr<base::MessageLoopProxy> io_thread_; 167 scoped_refptr<base::MessageLoopProxy> io_thread_;
168 scoped_refptr<base::MessageLoopProxy> main_thread_; 168 scoped_refptr<base::MessageLoopProxy> main_thread_;
169 169
170 // Only used on the main thread. 170 // Only used on the main thread.
171 base::WeakPtr<SimpleFileWriter> simple_writer_; 171 base::WeakPtr<SimpleFileWriter> simple_writer_;
172 172
173 // Only used on the io thread. 173 // Only used on the io thread.
174 FileSystemOperationInterface* operation_; 174 FileSystemOperation* operation_;
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),
(...skipping 10 matching lines...) Expand all
195 195
196 void SimpleFileWriter::DoWrite( 196 void SimpleFileWriter::DoWrite(
197 const GURL& path, const GURL& blob_url, int64 offset) { 197 const GURL& path, const GURL& blob_url, int64 offset) {
198 FileSystemURL url(path); 198 FileSystemURL url(path);
199 io_thread_proxy_->Write(url, blob_url, offset); 199 io_thread_proxy_->Write(url, blob_url, offset);
200 } 200 }
201 201
202 void SimpleFileWriter::DoCancel() { 202 void SimpleFileWriter::DoCancel() {
203 io_thread_proxy_->Cancel(); 203 io_thread_proxy_->Cancel();
204 } 204 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/simple_file_system.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698