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

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

Issue 85263006: Make IDL Callbacks non-refcounted by default (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 7 years 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
« no previous file with comments | « Source/modules/quota/StorageInfo.h ('k') | Source/modules/quota/StorageQuota.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 StorageInfo::StorageInfo() 45 StorageInfo::StorageInfo()
46 { 46 {
47 ScriptWrappable::init(this); 47 ScriptWrappable::init(this);
48 } 48 }
49 49
50 StorageInfo::~StorageInfo() 50 StorageInfo::~StorageInfo()
51 { 51 {
52 } 52 }
53 53
54 void StorageInfo::queryUsageAndQuota(ExecutionContext* executionContext, int sto rageType, PassRefPtr<StorageUsageCallback> successCallback, PassRefPtr<StorageEr rorCallback> errorCallback) 54 void StorageInfo::queryUsageAndQuota(ExecutionContext* executionContext, int sto rageType, PassOwnPtr<StorageUsageCallback> successCallback, PassOwnPtr<StorageEr rorCallback> errorCallback)
55 { 55 {
56 // Dispatching the request to StorageQuota, as this interface is deprecated in favor of StorageQuota. 56 // Dispatching the request to StorageQuota, as this interface is deprecated in favor of StorageQuota.
57 StorageQuota* storageQuota = getStorageQuota(storageType); 57 StorageQuota* storageQuota = getStorageQuota(storageType);
58 if (!storageQuota) { 58 if (!storageQuota) {
59 // Unknown storage type is requested. 59 // Unknown storage type is requested.
60 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er rorCallback, NotSupportedError)); 60 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er rorCallback, NotSupportedError));
61 return; 61 return;
62 } 62 }
63 storageQuota->queryUsageAndQuota(executionContext, successCallback, errorCal lback); 63 storageQuota->queryUsageAndQuota(executionContext, successCallback, errorCal lback);
64 } 64 }
65 65
66 void StorageInfo::requestQuota(ExecutionContext* executionContext, int storageTy pe, unsigned long long newQuotaInBytes, PassRefPtr<StorageQuotaCallback> success Callback, PassRefPtr<StorageErrorCallback> errorCallback) 66 void StorageInfo::requestQuota(ExecutionContext* executionContext, int storageTy pe, unsigned long long newQuotaInBytes, PassOwnPtr<StorageQuotaCallback> success Callback, PassOwnPtr<StorageErrorCallback> errorCallback)
67 { 67 {
68 // Dispatching the request to StorageQuota, as this interface is deprecated in favor of StorageQuota. 68 // Dispatching the request to StorageQuota, as this interface is deprecated in favor of StorageQuota.
69 StorageQuota* storageQuota = getStorageQuota(storageType); 69 StorageQuota* storageQuota = getStorageQuota(storageType);
70 if (!storageQuota) { 70 if (!storageQuota) {
71 // Unknown storage type is requested. 71 // Unknown storage type is requested.
72 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er rorCallback, NotSupportedError)); 72 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er rorCallback, NotSupportedError));
73 return; 73 return;
74 } 74 }
75 storageQuota->requestQuota(executionContext, newQuotaInBytes, successCallbac k, errorCallback); 75 storageQuota->requestQuota(executionContext, newQuotaInBytes, successCallbac k, errorCallback);
76 } 76 }
77 77
78 StorageQuota* StorageInfo::getStorageQuota(int storageType) 78 StorageQuota* StorageInfo::getStorageQuota(int storageType)
79 { 79 {
80 switch (storageType) { 80 switch (storageType) {
81 case TEMPORARY: 81 case TEMPORARY:
82 if (!m_temporaryStorage) 82 if (!m_temporaryStorage)
83 m_temporaryStorage = StorageQuota::create(StorageQuota::Temporary); 83 m_temporaryStorage = StorageQuota::create(StorageQuota::Temporary);
84 return m_temporaryStorage.get(); 84 return m_temporaryStorage.get();
85 case PERSISTENT: 85 case PERSISTENT:
86 if (!m_persistentStorage) 86 if (!m_persistentStorage)
87 m_persistentStorage = StorageQuota::create(StorageQuota::Persistent) ; 87 m_persistentStorage = StorageQuota::create(StorageQuota::Persistent) ;
88 return m_persistentStorage.get(); 88 return m_persistentStorage.get();
89 } 89 }
90 return 0; 90 return 0;
91 } 91 }
92 92
93 } // namespace WebCore 93 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/quota/StorageInfo.h ('k') | Source/modules/quota/StorageQuota.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698