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

Side by Side Diff: webkit/plugins/ppapi/quota_file_io.h

Issue 8315012: base::Bind: Convert FileUtilProxy::GetFileInfoCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pipelining. Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_PLUGINS_PPAPI_QUOTA_FILE_IO_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_
6 #define WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_ 6 #define WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/file_util_proxy.h" 10 #include "base/file_util_proxy.h"
11 #include "base/memory/scoped_callback_factory.h"
12 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
13 #include "base/platform_file.h" 12 #include "base/platform_file.h"
14 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
15 #include "ppapi/c/pp_file_info.h" 14 #include "ppapi/c/pp_file_info.h"
16 #include "ppapi/c/pp_instance.h" 15 #include "ppapi/c/pp_instance.h"
17 #include "webkit/quota/quota_types.h" 16 #include "webkit/quota/quota_types.h"
18 17
19 namespace webkit { 18 namespace webkit {
20 namespace ppapi { 19 namespace ppapi {
21 20
(...skipping 13 matching lines...) Expand all
35 PP_FileSystemType type); 34 PP_FileSystemType type);
36 ~QuotaFileIO(); 35 ~QuotaFileIO();
37 36
38 // Performs write or setlength operation with quota checks. 37 // Performs write or setlength operation with quota checks.
39 // Returns true when the operation is successfully dispatched. 38 // Returns true when the operation is successfully dispatched.
40 // |bytes_to_write| must be geater than zero. 39 // |bytes_to_write| must be geater than zero.
41 // |callback| will be dispatched when the operation completes. 40 // |callback| will be dispatched when the operation completes.
42 // Otherwise it returns false and |callback| will not be dispatched. 41 // Otherwise it returns false and |callback| will not be dispatched.
43 // |callback| will not be dispatched either when this instance is 42 // |callback| will not be dispatched either when this instance is
44 // destroyed before the operation completes. 43 // destroyed before the operation completes.
45 // SetLength/WillSetLength cannot be called while there're any inflight 44 // SetLength/WillSetLength cannot be called while there're any in-flight
46 // operations. For Write/WillWrite it is guaranteed that |callback| are 45 // operations. For Write/WillWrite it is guaranteed that |callback| are
47 // always dispatched in the same order as Write being called. 46 // always dispatched in the same order as Write being called.
48 bool Write(int64_t offset, 47 bool Write(int64_t offset,
49 const char* buffer, 48 const char* buffer,
50 int32_t bytes_to_write, 49 int32_t bytes_to_write,
51 WriteCallback* callback); 50 WriteCallback* callback);
52 bool WillWrite(int64_t offset, 51 bool WillWrite(int64_t offset,
53 int32_t bytes_to_write, 52 int32_t bytes_to_write,
54 WriteCallback* callback); 53 WriteCallback* callback);
55 54
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // we use two separate queues for them so that we can safely dequeue the 88 // we use two separate queues for them so that we can safely dequeue the
90 // pending callbacks while enqueueing new operations. (This could 89 // pending callbacks while enqueueing new operations. (This could
91 // happen when callbacks are dispatched synchronously due to error etc.) 90 // happen when callbacks are dispatched synchronously due to error etc.)
92 std::deque<PendingOperationBase*> pending_operations_; 91 std::deque<PendingOperationBase*> pending_operations_;
93 std::deque<PendingOperationBase*> pending_callbacks_; 92 std::deque<PendingOperationBase*> pending_callbacks_;
94 93
95 // Valid only while there're pending quota checks. 94 // Valid only while there're pending quota checks.
96 int64_t cached_file_size_; 95 int64_t cached_file_size_;
97 int64_t cached_available_space_; 96 int64_t cached_available_space_;
98 97
99 // Quota-related queries and errors occured during inflight quota checks. 98 // Quota-related queries and errors occurred during in-flight quota checks.
100 int outstanding_quota_queries_; 99 int outstanding_quota_queries_;
101 int outstanding_errors_; 100 int outstanding_errors_;
102 101
103 // For parallel writes bookkeeping. 102 // For parallel writes bookkeeping.
104 int64_t max_written_offset_; 103 int64_t max_written_offset_;
105 int inflight_operations_; 104 int inflight_operations_;
106 105
107 base::ScopedCallbackFactory<QuotaFileIO> callback_factory_; 106 base::WeakPtrFactory<QuotaFileIO> weak_factory_;
108 base::WeakPtrFactory<QuotaFileIO> weak_ptr_factory_; 107
109 DISALLOW_COPY_AND_ASSIGN(QuotaFileIO); 108 DISALLOW_COPY_AND_ASSIGN(QuotaFileIO);
110 }; 109 };
111 110
112 } // namespace ppapi 111 } // namespace ppapi
113 } // namespace webkit 112 } // namespace webkit
114 113
115 #endif // WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_ 114 #endif // WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698