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

Side by Side Diff: webkit/fileapi/file_writer_delegate.h

Issue 10197007: Change webkit/{fileapi,quota} code to use TaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixesz Created 8 years, 7 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
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 #ifndef WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_ 5 #ifndef WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_
6 #define WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_ 6 #define WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/message_loop_proxy.h"
12 #include "base/platform_file.h" 11 #include "base/platform_file.h"
13 #include "base/time.h" 12 #include "base/time.h"
14 #include "net/base/file_stream.h" 13 #include "net/base/file_stream.h"
15 #include "net/base/io_buffer.h" 14 #include "net/base/io_buffer.h"
16 #include "net/url_request/url_request.h" 15 #include "net/url_request/url_request.h"
17 #include "webkit/fileapi/file_system_path.h" 16 #include "webkit/fileapi/file_system_path.h"
18 17
18 namespace base {
19 class SequencedTaskRunner;
20 }
21
19 namespace fileapi { 22 namespace fileapi {
20 23
21 class FileSystemOperation; 24 class FileSystemOperation;
22 class FileSystemOperationContext; 25 class FileSystemOperationContext;
23 class FileSystemQuotaUtil; 26 class FileSystemQuotaUtil;
24 27
25 class FileWriterDelegate : public net::URLRequest::Delegate { 28 class FileWriterDelegate : public net::URLRequest::Delegate {
26 public: 29 public:
27 FileWriterDelegate( 30 FileWriterDelegate(
28 FileSystemOperation* write_operation, 31 FileSystemOperation* write_operation,
29 const FileSystemPath& path, 32 const FileSystemPath& path,
30 int64 offset, 33 int64 offset,
31 scoped_refptr<base::MessageLoopProxy> proxy); 34 base::SequencedTaskRunner* task_runner);
32 virtual ~FileWriterDelegate(); 35 virtual ~FileWriterDelegate();
33 36
34 void Start(base::PlatformFile file, 37 void Start(base::PlatformFile file,
35 net::URLRequest* request); 38 net::URLRequest* request);
36 base::PlatformFile file() { 39 base::PlatformFile file() {
37 return file_; 40 return file_;
38 } 41 }
39 42
40 virtual void OnReceivedRedirect(net::URLRequest* request, 43 virtual void OnReceivedRedirect(net::URLRequest* request,
41 const GURL& new_url, 44 const GURL& new_url,
(...skipping 22 matching lines...) Expand all
64 void OnProgress(int bytes_read, bool done); 67 void OnProgress(int bytes_read, bool done);
65 68
66 FileSystemOperationContext* file_system_operation_context() const; 69 FileSystemOperationContext* file_system_operation_context() const;
67 FileSystemQuotaUtil* quota_util() const; 70 FileSystemQuotaUtil* quota_util() const;
68 71
69 FileSystemOperation* file_system_operation_; 72 FileSystemOperation* file_system_operation_;
70 base::PlatformFile file_; 73 base::PlatformFile file_;
71 FileSystemPath path_; 74 FileSystemPath path_;
72 int64 size_; 75 int64 size_;
73 int64 offset_; 76 int64 offset_;
74 scoped_refptr<base::MessageLoopProxy> proxy_; 77 scoped_refptr<base::SequencedTaskRunner> task_runner_;
75 base::Time last_progress_event_time_; 78 base::Time last_progress_event_time_;
76 int bytes_written_backlog_; 79 int bytes_written_backlog_;
77 int bytes_written_; 80 int bytes_written_;
78 int bytes_read_; 81 int bytes_read_;
79 int64 total_bytes_written_; 82 int64 total_bytes_written_;
80 int64 allowed_bytes_to_write_; 83 int64 allowed_bytes_to_write_;
81 scoped_refptr<net::IOBufferWithSize> io_buffer_; 84 scoped_refptr<net::IOBufferWithSize> io_buffer_;
82 scoped_refptr<net::DrainableIOBuffer> cursor_; 85 scoped_refptr<net::DrainableIOBuffer> cursor_;
83 scoped_ptr<net::FileStream> file_stream_; 86 scoped_ptr<net::FileStream> file_stream_;
84 net::URLRequest* request_; 87 net::URLRequest* request_;
85 base::WeakPtrFactory<FileWriterDelegate> weak_factory_; 88 base::WeakPtrFactory<FileWriterDelegate> weak_factory_;
86 }; 89 };
87 90
88 } // namespace fileapi 91 } // namespace fileapi
89 92
90 #endif // WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_ 93 #endif // WEBKIT_FILEAPI_FILE_WRITER_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698