| OLD | NEW |
| 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 #include "webkit/browser/fileapi/quota/quota_reservation.h" | 5 #include "webkit/browser/fileapi/quota/quota_reservation.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "webkit/browser/fileapi/quota/open_file_handle.h" | 8 #include "webkit/browser/fileapi/quota/open_file_handle.h" |
| 9 #include "webkit/browser/fileapi/quota/quota_reservation_buffer.h" | 9 #include "webkit/browser/fileapi/quota/quota_reservation_buffer.h" |
| 10 | 10 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 reservation_manager()->ReleaseReservedQuota( | 88 reservation_manager()->ReleaseReservedQuota( |
| 89 origin(), type(), remaining_quota_); | 89 origin(), type(), remaining_quota_); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 // static | 93 // static |
| 94 bool QuotaReservation::AdaptDidUpdateReservedQuota( | 94 bool QuotaReservation::AdaptDidUpdateReservedQuota( |
| 95 const base::WeakPtr<QuotaReservation>& reservation, | 95 const base::WeakPtr<QuotaReservation>& reservation, |
| 96 int64 new_reserved_size, | 96 int64 new_reserved_size, |
| 97 const StatusCallback& callback, | 97 const StatusCallback& callback, |
| 98 base::PlatformFileError error) { | 98 base::File::Error error) { |
| 99 if (!reservation) | 99 if (!reservation) |
| 100 return false; | 100 return false; |
| 101 | 101 |
| 102 return reservation->DidUpdateReservedQuota( | 102 return reservation->DidUpdateReservedQuota( |
| 103 new_reserved_size, callback, error); | 103 new_reserved_size, callback, error); |
| 104 } | 104 } |
| 105 | 105 |
| 106 bool QuotaReservation::DidUpdateReservedQuota( | 106 bool QuotaReservation::DidUpdateReservedQuota( |
| 107 int64 new_reserved_size, | 107 int64 new_reserved_size, |
| 108 const StatusCallback& callback, | 108 const StatusCallback& callback, |
| 109 base::PlatformFileError error) { | 109 base::File::Error error) { |
| 110 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 110 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
| 111 DCHECK(running_refresh_request_); | 111 DCHECK(running_refresh_request_); |
| 112 running_refresh_request_ = false; | 112 running_refresh_request_ = false; |
| 113 | 113 |
| 114 if (client_crashed_) { | 114 if (client_crashed_) { |
| 115 callback.Run(base::PLATFORM_FILE_ERROR_ABORT); | 115 callback.Run(base::File::FILE_ERROR_ABORT); |
| 116 return false; | 116 return false; |
| 117 } | 117 } |
| 118 | 118 |
| 119 if (error == base::PLATFORM_FILE_OK) | 119 if (error == base::File::FILE_OK) |
| 120 remaining_quota_ = new_reserved_size; | 120 remaining_quota_ = new_reserved_size; |
| 121 callback.Run(error); | 121 callback.Run(error); |
| 122 return true; | 122 return true; |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace fileapi | 125 } // namespace fileapi |
| OLD | NEW |