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

Side by Side Diff: Source/modules/quota/DeprecatedStorageQuota.cpp

Issue 915703002: Add task location information to ExecutionContext (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 5 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 | Annotate | Revision Log
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 25 matching lines...) Expand all
36 #include "modules/quota/DeprecatedStorageQuotaCallbacksImpl.h" 36 #include "modules/quota/DeprecatedStorageQuotaCallbacksImpl.h"
37 #include "modules/quota/StorageErrorCallback.h" 37 #include "modules/quota/StorageErrorCallback.h"
38 #include "modules/quota/StorageQuotaClient.h" 38 #include "modules/quota/StorageQuotaClient.h"
39 #include "modules/quota/StorageUsageCallback.h" 39 #include "modules/quota/StorageUsageCallback.h"
40 #include "platform/StorageQuotaCallbacks.h" 40 #include "platform/StorageQuotaCallbacks.h"
41 #include "platform/weborigin/KURL.h" 41 #include "platform/weborigin/KURL.h"
42 #include "platform/weborigin/SecurityOrigin.h" 42 #include "platform/weborigin/SecurityOrigin.h"
43 #include "public/platform/Platform.h" 43 #include "public/platform/Platform.h"
44 #include "public/platform/WebStorageQuotaCallbacks.h" 44 #include "public/platform/WebStorageQuotaCallbacks.h"
45 #include "public/platform/WebStorageQuotaType.h" 45 #include "public/platform/WebStorageQuotaType.h"
46 #include "public/platform/WebTraceLocation.h"
46 47
47 namespace blink { 48 namespace blink {
48 49
49 DeprecatedStorageQuota::DeprecatedStorageQuota(Type type) 50 DeprecatedStorageQuota::DeprecatedStorageQuota(Type type)
50 : m_type(type) 51 : m_type(type)
51 { 52 {
52 } 53 }
53 54
54 void DeprecatedStorageQuota::queryUsageAndQuota(ExecutionContext* executionConte xt, StorageUsageCallback* successCallback, StorageErrorCallback* errorCallback) 55 void DeprecatedStorageQuota::queryUsageAndQuota(ExecutionContext* executionConte xt, StorageUsageCallback* successCallback, StorageErrorCallback* errorCallback)
55 { 56 {
56 ASSERT(executionContext); 57 ASSERT(executionContext);
57 58
58 WebStorageQuotaType storageType = static_cast<WebStorageQuotaType>(m_type); 59 WebStorageQuotaType storageType = static_cast<WebStorageQuotaType>(m_type);
59 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage QuotaTypePersistent) { 60 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage QuotaTypePersistent) {
60 // Unknown storage type is requested. 61 // Unknown storage type is requested.
61 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er rorCallback, NotSupportedError)); 62 executionContext->postTask(FROM_HERE, StorageErrorCallback::CallbackTask ::create(errorCallback, NotSupportedError));
62 return; 63 return;
63 } 64 }
64 65
65 SecurityOrigin* securityOrigin = executionContext->securityOrigin(); 66 SecurityOrigin* securityOrigin = executionContext->securityOrigin();
66 if (securityOrigin->isUnique()) { 67 if (securityOrigin->isUnique()) {
67 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er rorCallback, NotSupportedError)); 68 executionContext->postTask(FROM_HERE, StorageErrorCallback::CallbackTask ::create(errorCallback, NotSupportedError));
68 return; 69 return;
69 } 70 }
70 71
71 KURL storagePartition = KURL(KURL(), securityOrigin->toString()); 72 KURL storagePartition = KURL(KURL(), securityOrigin->toString());
72 StorageQuotaCallbacks* callbacks = DeprecatedStorageQuotaCallbacksImpl::crea te(successCallback, errorCallback); 73 StorageQuotaCallbacks* callbacks = DeprecatedStorageQuotaCallbacksImpl::crea te(successCallback, errorCallback);
73 Platform::current()->queryStorageUsageAndQuota(storagePartition, storageType , callbacks); 74 Platform::current()->queryStorageUsageAndQuota(storagePartition, storageType , callbacks);
74 } 75 }
75 76
76 void DeprecatedStorageQuota::requestQuota(ExecutionContext* executionContext, un signed long long newQuotaInBytes, StorageQuotaCallback* successCallback, Storage ErrorCallback* errorCallback) 77 void DeprecatedStorageQuota::requestQuota(ExecutionContext* executionContext, un signed long long newQuotaInBytes, StorageQuotaCallback* successCallback, Storage ErrorCallback* errorCallback)
77 { 78 {
78 ASSERT(executionContext); 79 ASSERT(executionContext);
79 80
80 WebStorageQuotaType storageType = static_cast<WebStorageQuotaType>(m_type); 81 WebStorageQuotaType storageType = static_cast<WebStorageQuotaType>(m_type);
81 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage QuotaTypePersistent) { 82 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage QuotaTypePersistent) {
82 // Unknown storage type is requested. 83 // Unknown storage type is requested.
83 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er rorCallback, NotSupportedError)); 84 executionContext->postTask(FROM_HERE, StorageErrorCallback::CallbackTask ::create(errorCallback, NotSupportedError));
84 return; 85 return;
85 } 86 }
86 87
87 StorageQuotaClient* client = StorageQuotaClient::from(executionContext); 88 StorageQuotaClient* client = StorageQuotaClient::from(executionContext);
88 if (!client) { 89 if (!client) {
89 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er rorCallback, NotSupportedError)); 90 executionContext->postTask(FROM_HERE, StorageErrorCallback::CallbackTask ::create(errorCallback, NotSupportedError));
90 return; 91 return;
91 } 92 }
92 93
93 client->requestQuota(executionContext, storageType, newQuotaInBytes, success Callback, errorCallback); 94 client->requestQuota(executionContext, storageType, newQuotaInBytes, success Callback, errorCallback);
94 } 95 }
95 96
96 } // namespace blink 97 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/quota/DeprecatedStorageInfo.cpp ('k') | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698