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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 DeprecatedStorageInfo::DeprecatedStorageInfo() | 45 DeprecatedStorageInfo::DeprecatedStorageInfo() |
46 { | 46 { |
47 } | 47 } |
48 | 48 |
49 void DeprecatedStorageInfo::queryUsageAndQuota(ExecutionContext* executionContex
t, int storageType, StorageUsageCallback* successCallback, StorageErrorCallback*
errorCallback) | 49 void DeprecatedStorageInfo::queryUsageAndQuota(ExecutionContext* executionContex
t, int storageType, StorageUsageCallback* successCallback, StorageErrorCallback*
errorCallback) |
50 { | 50 { |
51 // Dispatching the request to DeprecatedStorageQuota, as this interface is d
eprecated in favor of DeprecatedStorageQuota. | 51 // Dispatching the request to DeprecatedStorageQuota, as this interface is d
eprecated in favor of DeprecatedStorageQuota. |
52 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType); | 52 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType); |
53 if (!storageQuota) { | 53 if (!storageQuota) { |
54 // Unknown storage type is requested. | 54 // Unknown storage type is requested. |
55 executionContext->postTask(FROM_HERE, StorageErrorCallback::CallbackTask
::create(errorCallback, NotSupportedError)); | 55 executionContext->postTask(BLINK_FROM_HERE, StorageErrorCallback::Callba
ckTask::create(errorCallback, NotSupportedError)); |
56 return; | 56 return; |
57 } | 57 } |
58 storageQuota->queryUsageAndQuota(executionContext, successCallback, errorCal
lback); | 58 storageQuota->queryUsageAndQuota(executionContext, successCallback, errorCal
lback); |
59 } | 59 } |
60 | 60 |
61 void DeprecatedStorageInfo::requestQuota(ExecutionContext* executionContext, int
storageType, unsigned long long newQuotaInBytes, StorageQuotaCallback* successC
allback, StorageErrorCallback* errorCallback) | 61 void DeprecatedStorageInfo::requestQuota(ExecutionContext* executionContext, int
storageType, unsigned long long newQuotaInBytes, StorageQuotaCallback* successC
allback, StorageErrorCallback* errorCallback) |
62 { | 62 { |
63 // Dispatching the request to DeprecatedStorageQuota, as this interface is d
eprecated in favor of DeprecatedStorageQuota. | 63 // Dispatching the request to DeprecatedStorageQuota, as this interface is d
eprecated in favor of DeprecatedStorageQuota. |
64 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType); | 64 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType); |
65 if (!storageQuota) { | 65 if (!storageQuota) { |
66 // Unknown storage type is requested. | 66 // Unknown storage type is requested. |
67 executionContext->postTask(FROM_HERE, StorageErrorCallback::CallbackTask
::create(errorCallback, NotSupportedError)); | 67 executionContext->postTask(BLINK_FROM_HERE, StorageErrorCallback::Callba
ckTask::create(errorCallback, NotSupportedError)); |
68 return; | 68 return; |
69 } | 69 } |
70 storageQuota->requestQuota(executionContext, newQuotaInBytes, successCallbac
k, errorCallback); | 70 storageQuota->requestQuota(executionContext, newQuotaInBytes, successCallbac
k, errorCallback); |
71 } | 71 } |
72 | 72 |
73 DeprecatedStorageQuota* DeprecatedStorageInfo::getStorageQuota(int storageType) | 73 DeprecatedStorageQuota* DeprecatedStorageInfo::getStorageQuota(int storageType) |
74 { | 74 { |
75 switch (storageType) { | 75 switch (storageType) { |
76 case TEMPORARY: | 76 case TEMPORARY: |
77 if (!m_temporaryStorage) | 77 if (!m_temporaryStorage) |
78 m_temporaryStorage = DeprecatedStorageQuota::create(DeprecatedStorag
eQuota::Temporary); | 78 m_temporaryStorage = DeprecatedStorageQuota::create(DeprecatedStorag
eQuota::Temporary); |
79 return m_temporaryStorage.get(); | 79 return m_temporaryStorage.get(); |
80 case PERSISTENT: | 80 case PERSISTENT: |
81 if (!m_persistentStorage) | 81 if (!m_persistentStorage) |
82 m_persistentStorage = DeprecatedStorageQuota::create(DeprecatedStora
geQuota::Persistent); | 82 m_persistentStorage = DeprecatedStorageQuota::create(DeprecatedStora
geQuota::Persistent); |
83 return m_persistentStorage.get(); | 83 return m_persistentStorage.get(); |
84 } | 84 } |
85 return 0; | 85 return 0; |
86 } | 86 } |
87 | 87 |
88 DEFINE_TRACE(DeprecatedStorageInfo) | 88 DEFINE_TRACE(DeprecatedStorageInfo) |
89 { | 89 { |
90 visitor->trace(m_temporaryStorage); | 90 visitor->trace(m_temporaryStorage); |
91 visitor->trace(m_persistentStorage); | 91 visitor->trace(m_persistentStorage); |
92 } | 92 } |
93 | 93 |
94 } // namespace blink | 94 } // namespace blink |
OLD | NEW |