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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 int storageType, | 49 int storageType, |
50 StorageUsageCallback* successCallback, | 50 StorageUsageCallback* successCallback, |
51 StorageErrorCallback* errorCallback) { | 51 StorageErrorCallback* errorCallback) { |
52 // Dispatching the request to DeprecatedStorageQuota, as this interface is | 52 // Dispatching the request to DeprecatedStorageQuota, as this interface is |
53 // deprecated in favor of DeprecatedStorageQuota. | 53 // deprecated in favor of DeprecatedStorageQuota. |
54 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType); | 54 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType); |
55 if (!storageQuota) { | 55 if (!storageQuota) { |
56 // Unknown storage type is requested. | 56 // Unknown storage type is requested. |
57 TaskRunnerHelper::get(TaskType::MiscPlatformAPI, | 57 TaskRunnerHelper::get(TaskType::MiscPlatformAPI, |
58 scriptState->getExecutionContext()) | 58 scriptState->getExecutionContext()) |
59 ->postTask(BLINK_FROM_HERE, StorageErrorCallback::createSameThreadTask( | 59 ->postTask(BLINK_FROM_HERE, |
60 errorCallback, NotSupportedError)); | 60 StorageErrorCallback::createSameThreadTask( |
| 61 errorCallback, NotSupportedError)); |
61 return; | 62 return; |
62 } | 63 } |
63 storageQuota->queryUsageAndQuota(scriptState, successCallback, errorCallback); | 64 storageQuota->queryUsageAndQuota(scriptState, successCallback, errorCallback); |
64 } | 65 } |
65 | 66 |
66 void DeprecatedStorageInfo::requestQuota(ScriptState* scriptState, | 67 void DeprecatedStorageInfo::requestQuota(ScriptState* scriptState, |
67 int storageType, | 68 int storageType, |
68 unsigned long long newQuotaInBytes, | 69 unsigned long long newQuotaInBytes, |
69 StorageQuotaCallback* successCallback, | 70 StorageQuotaCallback* successCallback, |
70 StorageErrorCallback* errorCallback) { | 71 StorageErrorCallback* errorCallback) { |
71 // Dispatching the request to DeprecatedStorageQuota, as this interface is | 72 // Dispatching the request to DeprecatedStorageQuota, as this interface is |
72 // deprecated in favor of DeprecatedStorageQuota. | 73 // deprecated in favor of DeprecatedStorageQuota. |
73 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType); | 74 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType); |
74 if (!storageQuota) { | 75 if (!storageQuota) { |
75 // Unknown storage type is requested. | 76 // Unknown storage type is requested. |
76 TaskRunnerHelper::get(TaskType::MiscPlatformAPI, | 77 TaskRunnerHelper::get(TaskType::MiscPlatformAPI, |
77 scriptState->getExecutionContext()) | 78 scriptState->getExecutionContext()) |
78 ->postTask(BLINK_FROM_HERE, StorageErrorCallback::createSameThreadTask( | 79 ->postTask(BLINK_FROM_HERE, |
79 errorCallback, NotSupportedError)); | 80 StorageErrorCallback::createSameThreadTask( |
| 81 errorCallback, NotSupportedError)); |
80 return; | 82 return; |
81 } | 83 } |
82 storageQuota->requestQuota(scriptState, newQuotaInBytes, successCallback, | 84 storageQuota->requestQuota(scriptState, newQuotaInBytes, successCallback, |
83 errorCallback); | 85 errorCallback); |
84 } | 86 } |
85 | 87 |
86 DeprecatedStorageQuota* DeprecatedStorageInfo::getStorageQuota( | 88 DeprecatedStorageQuota* DeprecatedStorageInfo::getStorageQuota( |
87 int storageType) { | 89 int storageType) { |
88 switch (storageType) { | 90 switch (storageType) { |
89 case kTemporary: | 91 case kTemporary: |
90 if (!m_temporaryStorage) | 92 if (!m_temporaryStorage) |
91 m_temporaryStorage = | 93 m_temporaryStorage = |
92 DeprecatedStorageQuota::create(DeprecatedStorageQuota::Temporary); | 94 DeprecatedStorageQuota::create(DeprecatedStorageQuota::Temporary); |
93 return m_temporaryStorage.get(); | 95 return m_temporaryStorage.get(); |
94 case kPersistent: | 96 case kPersistent: |
95 if (!m_persistentStorage) | 97 if (!m_persistentStorage) |
96 m_persistentStorage = | 98 m_persistentStorage = |
97 DeprecatedStorageQuota::create(DeprecatedStorageQuota::Persistent); | 99 DeprecatedStorageQuota::create(DeprecatedStorageQuota::Persistent); |
98 return m_persistentStorage.get(); | 100 return m_persistentStorage.get(); |
99 } | 101 } |
100 return 0; | 102 return 0; |
101 } | 103 } |
102 | 104 |
103 DEFINE_TRACE(DeprecatedStorageInfo) { | 105 DEFINE_TRACE(DeprecatedStorageInfo) { |
104 visitor->trace(m_temporaryStorage); | 106 visitor->trace(m_temporaryStorage); |
105 visitor->trace(m_persistentStorage); | 107 visitor->trace(m_persistentStorage); |
106 } | 108 } |
107 | 109 |
108 } // namespace blink | 110 } // namespace blink |
OLD | NEW |