| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ppapi/proxy/file_system_resource.h" | 5 #include "ppapi/proxy/file_system_resource.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
| 10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 this, | 88 this, |
| 89 callback)); | 89 callback)); |
| 90 return PP_OK_COMPLETIONPENDING; | 90 return PP_OK_COMPLETIONPENDING; |
| 91 } | 91 } |
| 92 | 92 |
| 93 PP_FileSystemType FileSystemResource::GetType() { | 93 PP_FileSystemType FileSystemResource::GetType() { |
| 94 return type_; | 94 return type_; |
| 95 } | 95 } |
| 96 | 96 |
| 97 void FileSystemResource::OpenQuotaFile(PP_Resource file_io) { | 97 void FileSystemResource::OpenQuotaFile(PP_Resource file_io) { |
| 98 DCHECK(!ContainsKey(files_, file_io)); | 98 DCHECK(!base::ContainsKey(files_, file_io)); |
| 99 files_.insert(file_io); | 99 files_.insert(file_io); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void FileSystemResource::CloseQuotaFile(PP_Resource file_io) { | 102 void FileSystemResource::CloseQuotaFile(PP_Resource file_io) { |
| 103 DCHECK(ContainsKey(files_, file_io)); | 103 DCHECK(base::ContainsKey(files_, file_io)); |
| 104 files_.erase(file_io); | 104 files_.erase(file_io); |
| 105 } | 105 } |
| 106 | 106 |
| 107 int64_t FileSystemResource::RequestQuota( | 107 int64_t FileSystemResource::RequestQuota( |
| 108 int64_t amount, | 108 int64_t amount, |
| 109 const RequestQuotaCallback& callback) { | 109 const RequestQuotaCallback& callback) { |
| 110 DCHECK(amount >= 0); | 110 DCHECK(amount >= 0); |
| 111 if (!reserving_quota_ && reserved_quota_ >= amount) { | 111 if (!reserving_quota_ && reserved_quota_ >= amount) { |
| 112 reserved_quota_ -= amount; | 112 reserved_quota_ -= amount; |
| 113 return amount; | 113 return amount; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 // Refresh the quota reservation for the first pending request that we | 232 // Refresh the quota reservation for the first pending request that we |
| 233 // can't satisfy. | 233 // can't satisfy. |
| 234 ReserveQuota(request.amount); | 234 ReserveQuota(request.amount); |
| 235 break; | 235 break; |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace proxy | 240 } // namespace proxy |
| 241 } // namespace ppapi | 241 } // namespace ppapi |
| OLD | NEW |