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

Side by Side Diff: webkit/browser/fileapi/quota/quota_reservation.h

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_ 5 #ifndef WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_
6 #define WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_ 6 #define WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/files/file.h"
9 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
10 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "webkit/browser/fileapi/quota/quota_reservation_manager.h" 13 #include "webkit/browser/fileapi/quota/quota_reservation_manager.h"
13 #include "webkit/browser/webkit_storage_browser_export.h" 14 #include "webkit/browser/webkit_storage_browser_export.h"
14 #include "webkit/common/fileapi/file_system_types.h" 15 #include "webkit/common/fileapi/file_system_types.h"
15 16
16 class GURL; 17 class GURL;
17 18
18 namespace fileapi { 19 namespace fileapi {
19 20
20 class QuotaReservationBuffer; 21 class QuotaReservationBuffer;
21 class OpenFileHandle; 22 class OpenFileHandle;
22 23
23 // Represents a unit of quota reservation. 24 // Represents a unit of quota reservation.
24 class WEBKIT_STORAGE_BROWSER_EXPORT QuotaReservation 25 class WEBKIT_STORAGE_BROWSER_EXPORT QuotaReservation
25 : public base::RefCounted<QuotaReservation> { 26 : public base::RefCounted<QuotaReservation> {
26 public: 27 public:
27 typedef base::Callback<void(base::PlatformFileError error)> StatusCallback; 28 typedef base::Callback<void(base::File::Error error)> StatusCallback;
28 29
29 // Reclaims unused quota and reserves another |size| of quota. So that the 30 // Reclaims unused quota and reserves another |size| of quota. So that the
30 // resulting new |remaining_quota| will be same as |size|. 31 // resulting new |remaining_quota| will be same as |size|.
31 // Invokes |callback| upon completion. 32 // Invokes |callback| upon completion.
32 void RefreshReservation(int64 size, const StatusCallback& callback); 33 void RefreshReservation(int64 size, const StatusCallback& callback);
33 34
34 // Associates |platform_path| to the QuotaReservation instance. 35 // Associates |platform_path| to the QuotaReservation instance.
35 // Returns an OpenFileHandle instance that represents a quota managed file. 36 // Returns an OpenFileHandle instance that represents a quota managed file.
36 scoped_ptr<OpenFileHandle> GetOpenFileHandle( 37 scoped_ptr<OpenFileHandle> GetOpenFileHandle(
37 const base::FilePath& platform_path); 38 const base::FilePath& platform_path);
(...skipping 23 matching lines...) Expand all
61 // Use QuotaReservationManager as the entry point. 62 // Use QuotaReservationManager as the entry point.
62 explicit QuotaReservation(QuotaReservationBuffer* reservation_buffer); 63 explicit QuotaReservation(QuotaReservationBuffer* reservation_buffer);
63 64
64 friend class base::RefCounted<QuotaReservation>; 65 friend class base::RefCounted<QuotaReservation>;
65 virtual ~QuotaReservation(); 66 virtual ~QuotaReservation();
66 67
67 static bool AdaptDidUpdateReservedQuota( 68 static bool AdaptDidUpdateReservedQuota(
68 const base::WeakPtr<QuotaReservation>& reservation, 69 const base::WeakPtr<QuotaReservation>& reservation,
69 int64 new_reserved_size, 70 int64 new_reserved_size,
70 const StatusCallback& callback, 71 const StatusCallback& callback,
71 base::PlatformFileError error); 72 base::File::Error error);
72 bool DidUpdateReservedQuota(int64 new_reserved_size, 73 bool DidUpdateReservedQuota(int64 new_reserved_size,
73 const StatusCallback& callback, 74 const StatusCallback& callback,
74 base::PlatformFileError error); 75 base::File::Error error);
75 76
76 bool client_crashed_; 77 bool client_crashed_;
77 bool running_refresh_request_; 78 bool running_refresh_request_;
78 int64 remaining_quota_; 79 int64 remaining_quota_;
79 80
80 scoped_refptr<QuotaReservationBuffer> reservation_buffer_; 81 scoped_refptr<QuotaReservationBuffer> reservation_buffer_;
81 82
82 base::SequenceChecker sequence_checker_; 83 base::SequenceChecker sequence_checker_;
83 base::WeakPtrFactory<QuotaReservation> weak_ptr_factory_; 84 base::WeakPtrFactory<QuotaReservation> weak_ptr_factory_;
84 85
85 DISALLOW_COPY_AND_ASSIGN(QuotaReservation); 86 DISALLOW_COPY_AND_ASSIGN(QuotaReservation);
86 }; 87 };
87 88
88 } // namespace fileapi 89 } // namespace fileapi
89 90
90 #endif // WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_ 91 #endif // WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/quota/quota_backend_impl_unittest.cc ('k') | webkit/browser/fileapi/quota/quota_reservation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698