| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "modules/quota/DeprecatedStorageInfo.h" | 31 #include "modules/quota/DeprecatedStorageInfo.h" |
| 32 | 32 |
| 33 #include "core/dom/ExceptionCode.h" | 33 #include "core/dom/ExceptionCode.h" |
| 34 #include "core/dom/ExecutionContext.h" | 34 #include "core/dom/ExecutionContext.h" |
| 35 #include "core/dom/TaskRunnerHelper.h" |
| 35 #include "modules/quota/DeprecatedStorageQuota.h" | 36 #include "modules/quota/DeprecatedStorageQuota.h" |
| 36 #include "modules/quota/StorageErrorCallback.h" | 37 #include "modules/quota/StorageErrorCallback.h" |
| 37 #include "modules/quota/StorageQuotaCallback.h" | 38 #include "modules/quota/StorageQuotaCallback.h" |
| 38 #include "modules/quota/StorageUsageCallback.h" | 39 #include "modules/quota/StorageUsageCallback.h" |
| 39 #include "public/platform/WebTraceLocation.h" | 40 #include "public/platform/WebTraceLocation.h" |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| 43 DeprecatedStorageInfo::DeprecatedStorageInfo() {} | 44 DeprecatedStorageInfo::DeprecatedStorageInfo() {} |
| 44 | 45 |
| 45 void DeprecatedStorageInfo::queryUsageAndQuota( | 46 void DeprecatedStorageInfo::queryUsageAndQuota( |
| 46 ExecutionContext* executionContext, | 47 ExecutionContext* executionContext, |
| 47 int storageType, | 48 int storageType, |
| 48 StorageUsageCallback* successCallback, | 49 StorageUsageCallback* successCallback, |
| 49 StorageErrorCallback* errorCallback) { | 50 StorageErrorCallback* errorCallback) { |
| 50 // Dispatching the request to DeprecatedStorageQuota, as this interface is | 51 // Dispatching the request to DeprecatedStorageQuota, as this interface is |
| 51 // deprecated in favor of DeprecatedStorageQuota. | 52 // deprecated in favor of DeprecatedStorageQuota. |
| 52 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType); | 53 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType); |
| 53 if (!storageQuota) { | 54 if (!storageQuota) { |
| 54 // Unknown storage type is requested. | 55 // Unknown storage type is requested. |
| 55 executionContext->postTask(BLINK_FROM_HERE, | 56 executionContext->postTask(TaskType::MiscPlatformAPI, BLINK_FROM_HERE, |
| 56 StorageErrorCallback::createSameThreadTask( | 57 StorageErrorCallback::createSameThreadTask( |
| 57 errorCallback, NotSupportedError)); | 58 errorCallback, NotSupportedError)); |
| 58 return; | 59 return; |
| 59 } | 60 } |
| 60 storageQuota->queryUsageAndQuota(executionContext, successCallback, | 61 storageQuota->queryUsageAndQuota(executionContext, successCallback, |
| 61 errorCallback); | 62 errorCallback); |
| 62 } | 63 } |
| 63 | 64 |
| 64 void DeprecatedStorageInfo::requestQuota(ExecutionContext* executionContext, | 65 void DeprecatedStorageInfo::requestQuota(ExecutionContext* executionContext, |
| 65 int storageType, | 66 int storageType, |
| 66 unsigned long long newQuotaInBytes, | 67 unsigned long long newQuotaInBytes, |
| 67 StorageQuotaCallback* successCallback, | 68 StorageQuotaCallback* successCallback, |
| 68 StorageErrorCallback* errorCallback) { | 69 StorageErrorCallback* errorCallback) { |
| 69 // Dispatching the request to DeprecatedStorageQuota, as this interface is | 70 // Dispatching the request to DeprecatedStorageQuota, as this interface is |
| 70 // deprecated in favor of DeprecatedStorageQuota. | 71 // deprecated in favor of DeprecatedStorageQuota. |
| 71 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType); | 72 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType); |
| 72 if (!storageQuota) { | 73 if (!storageQuota) { |
| 73 // Unknown storage type is requested. | 74 // Unknown storage type is requested. |
| 74 executionContext->postTask(BLINK_FROM_HERE, | 75 executionContext->postTask(TaskType::MiscPlatformAPI, BLINK_FROM_HERE, |
| 75 StorageErrorCallback::createSameThreadTask( | 76 StorageErrorCallback::createSameThreadTask( |
| 76 errorCallback, NotSupportedError)); | 77 errorCallback, NotSupportedError)); |
| 77 return; | 78 return; |
| 78 } | 79 } |
| 79 storageQuota->requestQuota(executionContext, newQuotaInBytes, successCallback, | 80 storageQuota->requestQuota(executionContext, newQuotaInBytes, successCallback, |
| 80 errorCallback); | 81 errorCallback); |
| 81 } | 82 } |
| 82 | 83 |
| 83 DeprecatedStorageQuota* DeprecatedStorageInfo::getStorageQuota( | 84 DeprecatedStorageQuota* DeprecatedStorageInfo::getStorageQuota( |
| 84 int storageType) { | 85 int storageType) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 96 } | 97 } |
| 97 return 0; | 98 return 0; |
| 98 } | 99 } |
| 99 | 100 |
| 100 DEFINE_TRACE(DeprecatedStorageInfo) { | 101 DEFINE_TRACE(DeprecatedStorageInfo) { |
| 101 visitor->trace(m_temporaryStorage); | 102 visitor->trace(m_temporaryStorage); |
| 102 visitor->trace(m_persistentStorage); | 103 visitor->trace(m_persistentStorage); |
| 103 } | 104 } |
| 104 | 105 |
| 105 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |