Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(839)

Side by Side Diff: third_party/WebKit/Source/modules/quota/DeprecatedStorageInfo.cpp

Issue 2656343002: Replace [CallWith=ExecutionContext] with [CallWith=ScriptState] (Closed)
Patch Set: Few more Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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 "bindings/core/v8/ScriptState.h"
33 #include "core/dom/ExceptionCode.h" 34 #include "core/dom/ExceptionCode.h"
34 #include "core/dom/ExecutionContext.h"
35 #include "core/dom/TaskRunnerHelper.h" 35 #include "core/dom/TaskRunnerHelper.h"
36 #include "modules/quota/DeprecatedStorageQuota.h" 36 #include "modules/quota/DeprecatedStorageQuota.h"
37 #include "modules/quota/StorageErrorCallback.h" 37 #include "modules/quota/StorageErrorCallback.h"
38 #include "modules/quota/StorageQuotaCallback.h" 38 #include "modules/quota/StorageQuotaCallback.h"
39 #include "modules/quota/StorageUsageCallback.h" 39 #include "modules/quota/StorageUsageCallback.h"
40 #include "public/platform/WebTraceLocation.h" 40 #include "public/platform/WebTraceLocation.h"
41 41
42 namespace blink { 42 namespace blink {
43 43
44 DeprecatedStorageInfo::DeprecatedStorageInfo() {} 44 DeprecatedStorageInfo::DeprecatedStorageInfo() {}
45 45
46 void DeprecatedStorageInfo::queryUsageAndQuota( 46 void DeprecatedStorageInfo::queryUsageAndQuota(
47 ExecutionContext* executionContext, 47 ScriptState* scriptState,
48 int storageType, 48 int storageType,
49 StorageUsageCallback* successCallback, 49 StorageUsageCallback* successCallback,
50 StorageErrorCallback* errorCallback) { 50 StorageErrorCallback* errorCallback) {
51 // Dispatching the request to DeprecatedStorageQuota, as this interface is 51 // Dispatching the request to DeprecatedStorageQuota, as this interface is
52 // deprecated in favor of DeprecatedStorageQuota. 52 // deprecated in favor of DeprecatedStorageQuota.
53 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType); 53 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType);
54 if (!storageQuota) { 54 if (!storageQuota) {
55 // Unknown storage type is requested. 55 // Unknown storage type is requested.
56 executionContext->postTask(TaskType::MiscPlatformAPI, BLINK_FROM_HERE, 56 scriptState->getExecutionContext()->postTask(
57 StorageErrorCallback::createSameThreadTask( 57 TaskType::MiscPlatformAPI, BLINK_FROM_HERE,
58 errorCallback, NotSupportedError)); 58 StorageErrorCallback::createSameThreadTask(errorCallback,
59 NotSupportedError));
59 return; 60 return;
60 } 61 }
61 storageQuota->queryUsageAndQuota(executionContext, successCallback, 62 storageQuota->queryUsageAndQuota(scriptState, successCallback, errorCallback);
62 errorCallback);
63 } 63 }
64 64
65 void DeprecatedStorageInfo::requestQuota(ExecutionContext* executionContext, 65 void DeprecatedStorageInfo::requestQuota(ScriptState* scriptState,
66 int storageType, 66 int storageType,
67 unsigned long long newQuotaInBytes, 67 unsigned long long newQuotaInBytes,
68 StorageQuotaCallback* successCallback, 68 StorageQuotaCallback* successCallback,
69 StorageErrorCallback* errorCallback) { 69 StorageErrorCallback* errorCallback) {
70 // Dispatching the request to DeprecatedStorageQuota, as this interface is 70 // Dispatching the request to DeprecatedStorageQuota, as this interface is
71 // deprecated in favor of DeprecatedStorageQuota. 71 // deprecated in favor of DeprecatedStorageQuota.
72 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType); 72 DeprecatedStorageQuota* storageQuota = getStorageQuota(storageType);
73 if (!storageQuota) { 73 if (!storageQuota) {
74 // Unknown storage type is requested. 74 // Unknown storage type is requested.
75 executionContext->postTask(TaskType::MiscPlatformAPI, BLINK_FROM_HERE, 75 scriptState->getExecutionContext()->postTask(
76 StorageErrorCallback::createSameThreadTask( 76 TaskType::MiscPlatformAPI, BLINK_FROM_HERE,
77 errorCallback, NotSupportedError)); 77 StorageErrorCallback::createSameThreadTask(errorCallback,
78 NotSupportedError));
78 return; 79 return;
79 } 80 }
80 storageQuota->requestQuota(executionContext, newQuotaInBytes, successCallback, 81 storageQuota->requestQuota(scriptState, newQuotaInBytes, successCallback,
81 errorCallback); 82 errorCallback);
82 } 83 }
83 84
84 DeprecatedStorageQuota* DeprecatedStorageInfo::getStorageQuota( 85 DeprecatedStorageQuota* DeprecatedStorageInfo::getStorageQuota(
85 int storageType) { 86 int storageType) {
86 switch (storageType) { 87 switch (storageType) {
87 case kTemporary: 88 case kTemporary:
88 if (!m_temporaryStorage) 89 if (!m_temporaryStorage)
89 m_temporaryStorage = 90 m_temporaryStorage =
90 DeprecatedStorageQuota::create(DeprecatedStorageQuota::Temporary); 91 DeprecatedStorageQuota::create(DeprecatedStorageQuota::Temporary);
91 return m_temporaryStorage.get(); 92 return m_temporaryStorage.get();
92 case kPersistent: 93 case kPersistent:
93 if (!m_persistentStorage) 94 if (!m_persistentStorage)
94 m_persistentStorage = 95 m_persistentStorage =
95 DeprecatedStorageQuota::create(DeprecatedStorageQuota::Persistent); 96 DeprecatedStorageQuota::create(DeprecatedStorageQuota::Persistent);
96 return m_persistentStorage.get(); 97 return m_persistentStorage.get();
97 } 98 }
98 return 0; 99 return 0;
99 } 100 }
100 101
101 DEFINE_TRACE(DeprecatedStorageInfo) { 102 DEFINE_TRACE(DeprecatedStorageInfo) {
102 visitor->trace(m_temporaryStorage); 103 visitor->trace(m_temporaryStorage);
103 visitor->trace(m_persistentStorage); 104 visitor->trace(m_persistentStorage);
104 } 105 }
105 106
106 } // namespace blink 107 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698