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

Side by Side Diff: storage/browser/fileapi/sandbox_file_stream_writer.h

Issue 1498003003: Remove kint64max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: INT64_MAX Created 5 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
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 STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_ 5 #ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_
6 #define STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_ 6 #define STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_
7 7
8 #include <stdint.h>
9
8 #include "base/files/file.h" 10 #include "base/files/file.h"
9 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
11 #include "storage/browser/blob/shareable_file_reference.h" 14 #include "storage/browser/blob/shareable_file_reference.h"
12 #include "storage/browser/fileapi/file_stream_writer.h" 15 #include "storage/browser/fileapi/file_stream_writer.h"
13 #include "storage/browser/fileapi/file_system_url.h" 16 #include "storage/browser/fileapi/file_system_url.h"
14 #include "storage/browser/fileapi/task_runner_bound_observer_list.h" 17 #include "storage/browser/fileapi/task_runner_bound_observer_list.h"
15 #include "storage/browser/storage_browser_export.h" 18 #include "storage/browser/storage_browser_export.h"
16 #include "storage/common/fileapi/file_system_types.h" 19 #include "storage/common/fileapi/file_system_types.h"
17 #include "storage/common/quota/quota_types.h" 20 #include "storage/common/quota/quota_types.h"
18 #include "url/gurl.h" 21 #include "url/gurl.h"
19 22
20 namespace storage { 23 namespace storage {
21 24
22 class FileSystemContext; 25 class FileSystemContext;
23 class FileSystemQuotaUtil; 26 class FileSystemQuotaUtil;
24 class FileStreamWriter; 27 class FileStreamWriter;
25 28
26 class STORAGE_EXPORT SandboxFileStreamWriter 29 class STORAGE_EXPORT SandboxFileStreamWriter
27 : public NON_EXPORTED_BASE(FileStreamWriter) { 30 : public NON_EXPORTED_BASE(FileStreamWriter) {
28 public: 31 public:
29 SandboxFileStreamWriter(FileSystemContext* file_system_context, 32 SandboxFileStreamWriter(FileSystemContext* file_system_context,
30 const FileSystemURL& url, 33 const FileSystemURL& url,
31 int64 initial_offset, 34 int64_t initial_offset,
32 const UpdateObserverList& observers); 35 const UpdateObserverList& observers);
33 ~SandboxFileStreamWriter() override; 36 ~SandboxFileStreamWriter() override;
34 37
35 // FileStreamWriter overrides. 38 // FileStreamWriter overrides.
36 int Write(net::IOBuffer* buf, 39 int Write(net::IOBuffer* buf,
37 int buf_len, 40 int buf_len,
38 const net::CompletionCallback& callback) override; 41 const net::CompletionCallback& callback) override;
39 int Cancel(const net::CompletionCallback& callback) override; 42 int Cancel(const net::CompletionCallback& callback) override;
40 int Flush(const net::CompletionCallback& callback) override; 43 int Flush(const net::CompletionCallback& callback) override;
41 44
42 // Used only by tests. 45 // Used only by tests.
43 void set_default_quota(int64 quota) { 46 void set_default_quota(int64_t quota) { default_quota_ = quota; }
44 default_quota_ = quota;
45 }
46 47
47 private: 48 private:
48 // Performs quota calculation and calls local_file_writer_->Write(). 49 // Performs quota calculation and calls local_file_writer_->Write().
49 int WriteInternal(net::IOBuffer* buf, int buf_len, 50 int WriteInternal(net::IOBuffer* buf, int buf_len,
50 const net::CompletionCallback& callback); 51 const net::CompletionCallback& callback);
51 52
52 // Callbacks that are chained for the first write. This eventually calls 53 // Callbacks that are chained for the first write. This eventually calls
53 // WriteInternal. 54 // WriteInternal.
54 void DidCreateSnapshotFile( 55 void DidCreateSnapshotFile(
55 const net::CompletionCallback& callback, 56 const net::CompletionCallback& callback,
56 base::File::Error file_error, 57 base::File::Error file_error,
57 const base::File::Info& file_info, 58 const base::File::Info& file_info,
58 const base::FilePath& platform_path, 59 const base::FilePath& platform_path,
59 const scoped_refptr<storage::ShareableFileReference>& file_ref); 60 const scoped_refptr<storage::ShareableFileReference>& file_ref);
60 void DidGetUsageAndQuota(const net::CompletionCallback& callback, 61 void DidGetUsageAndQuota(const net::CompletionCallback& callback,
61 storage::QuotaStatusCode status, 62 storage::QuotaStatusCode status,
62 int64 usage, 63 int64_t usage,
63 int64 quota); 64 int64_t quota);
64 void DidInitializeForWrite(net::IOBuffer* buf, int buf_len, 65 void DidInitializeForWrite(net::IOBuffer* buf, int buf_len,
65 const net::CompletionCallback& callback, 66 const net::CompletionCallback& callback,
66 int init_status); 67 int init_status);
67 68
68 void DidWrite(const net::CompletionCallback& callback, int write_response); 69 void DidWrite(const net::CompletionCallback& callback, int write_response);
69 70
70 // Stops the in-flight operation, calls |cancel_callback_| and returns true 71 // Stops the in-flight operation, calls |cancel_callback_| and returns true
71 // if there's a pending cancel request. 72 // if there's a pending cancel request.
72 bool CancelIfRequested(); 73 bool CancelIfRequested();
73 74
74 scoped_refptr<FileSystemContext> file_system_context_; 75 scoped_refptr<FileSystemContext> file_system_context_;
75 FileSystemURL url_; 76 FileSystemURL url_;
76 int64 initial_offset_; 77 int64_t initial_offset_;
77 scoped_ptr<FileStreamWriter> local_file_writer_; 78 scoped_ptr<FileStreamWriter> local_file_writer_;
78 net::CompletionCallback cancel_callback_; 79 net::CompletionCallback cancel_callback_;
79 80
80 UpdateObserverList observers_; 81 UpdateObserverList observers_;
81 82
82 base::FilePath file_path_; 83 base::FilePath file_path_;
83 int64 file_size_; 84 int64_t file_size_;
84 int64 total_bytes_written_; 85 int64_t total_bytes_written_;
85 int64 allowed_bytes_to_write_; 86 int64_t allowed_bytes_to_write_;
86 bool has_pending_operation_; 87 bool has_pending_operation_;
87 88
88 int64 default_quota_; 89 int64_t default_quota_;
89 90
90 base::WeakPtrFactory<SandboxFileStreamWriter> weak_factory_; 91 base::WeakPtrFactory<SandboxFileStreamWriter> weak_factory_;
91 92
92 DISALLOW_COPY_AND_ASSIGN(SandboxFileStreamWriter); 93 DISALLOW_COPY_AND_ASSIGN(SandboxFileStreamWriter);
93 }; 94 };
94 95
95 } // namespace storage 96 } // namespace storage
96 97
97 #endif // STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_ 98 #endif // STORAGE_BROWSER_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_
OLDNEW
« no previous file with comments | « storage/browser/fileapi/file_system_operation_impl.cc ('k') | storage/browser/fileapi/sandbox_file_stream_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698