summaryrefslogtreecommitdiffstats
path: root/dom/storage
diff options
context:
space:
mode:
Diffstat (limited to 'dom/storage')
-rw-r--r--dom/storage/DOMStorageCache.cpp65
-rw-r--r--dom/storage/DOMStorageCache.h6
-rw-r--r--dom/storage/DOMStorageDBThread.cpp2
-rw-r--r--dom/storage/DOMStorageIPC.cpp17
-rw-r--r--dom/storage/DOMStorageManager.cpp17
-rw-r--r--dom/storage/DOMStorageManager.h6
-rw-r--r--dom/storage/DOMStorageObserver.cpp13
7 files changed, 14 insertions, 112 deletions
diff --git a/dom/storage/DOMStorageCache.cpp b/dom/storage/DOMStorageCache.cpp
index 811f79fd3..ee9a22e96 100644
--- a/dom/storage/DOMStorageCache.cpp
+++ b/dom/storage/DOMStorageCache.cpp
@@ -85,7 +85,6 @@ DOMStorageCache::DOMStorageCache(const nsACString* aOriginNoSuffix)
, mInitialized(false)
, mPersistent(false)
, mSessionOnlyDataSetActive(false)
-, mPreloadTelemetryRecorded(false)
{
MOZ_COUNT_CTOR(DOMStorageCache);
}
@@ -178,7 +177,7 @@ DOMStorageCache::DataSet(const DOMStorage* aStorage)
// Session only data set is demanded but not filled with
// current data set, copy to session only set now.
- WaitForPreload(Telemetry::LOCALDOMSTORAGE_SESSIONONLY_PRELOAD_BLOCKING_MS);
+ WaitForPreload();
Data& defaultSet = mData[kDefaultSet];
Data& sessionSet = mData[kSessionSet];
@@ -206,11 +205,6 @@ DOMStorageCache::ProcessUsageDelta(const DOMStorage* aStorage, int64_t aDelta)
bool
DOMStorageCache::ProcessUsageDelta(uint32_t aGetDataSetIndex, const int64_t aDelta)
{
- // Check if we are in a low disk space situation
- if (aDelta > 0 && mManager && mManager->IsLowDiskSpace()) {
- return false;
- }
-
// Check limit per this origin
Data& data = mData[aGetDataSetIndex];
uint64_t newOriginUsage = data.mOriginQuotaUsage + aDelta;
@@ -298,49 +292,18 @@ DOMStorageCache::KeepAlive()
mKeepAliveTimer.swap(timer);
}
-namespace {
-
-// The AutoTimer provided by telemetry headers is only using static,
-// i.e. compile time known ID, but here we know the ID only at run time.
-// Hence a new class.
-class TelemetryAutoTimer
-{
-public:
- explicit TelemetryAutoTimer(Telemetry::ID aId)
- : id(aId), start(TimeStamp::Now()) {}
- ~TelemetryAutoTimer()
- { Telemetry::AccumulateDelta_impl<Telemetry::Millisecond>::compute(id, start); }
-private:
- Telemetry::ID id;
- const TimeStamp start;
-};
-
-} // namespace
-
void
-DOMStorageCache::WaitForPreload(Telemetry::ID aTelemetryID)
+DOMStorageCache::WaitForPreload()
{
if (!mPersistent) {
return;
}
bool loaded = mLoaded;
-
- // Telemetry of rates of pending preloads
- if (!mPreloadTelemetryRecorded) {
- mPreloadTelemetryRecorded = true;
- Telemetry::Accumulate(
- Telemetry::LOCALDOMSTORAGE_PRELOAD_PENDING_ON_FIRST_ACCESS,
- !loaded);
- }
-
if (loaded) {
return;
}
- // Measure which operation blocks and for how long
- TelemetryAutoTimer timer(aTelemetryID);
-
// If preload already started (i.e. we got some first data, but not all)
// SyncPreload will just wait for it to finish rather then synchronously
// read from the database. It seems to me more optimal.
@@ -357,7 +320,7 @@ nsresult
DOMStorageCache::GetLength(const DOMStorage* aStorage, uint32_t* aRetval)
{
if (Persist(aStorage)) {
- WaitForPreload(Telemetry::LOCALDOMSTORAGE_GETLENGTH_BLOCKING_MS);
+ WaitForPreload();
if (NS_FAILED(mLoadResult)) {
return mLoadResult;
}
@@ -375,7 +338,7 @@ DOMStorageCache::GetKey(const DOMStorage* aStorage, uint32_t aIndex, nsAString&
// maybe we need to have a lazily populated key array here or
// something?
if (Persist(aStorage)) {
- WaitForPreload(Telemetry::LOCALDOMSTORAGE_GETKEY_BLOCKING_MS);
+ WaitForPreload();
if (NS_FAILED(mLoadResult)) {
return mLoadResult;
}
@@ -397,7 +360,7 @@ void
DOMStorageCache::GetKeys(const DOMStorage* aStorage, nsTArray<nsString>& aKeys)
{
if (Persist(aStorage)) {
- WaitForPreload(Telemetry::LOCALDOMSTORAGE_GETALLKEYS_BLOCKING_MS);
+ WaitForPreload();
}
if (NS_FAILED(mLoadResult)) {
@@ -414,7 +377,7 @@ DOMStorageCache::GetItem(const DOMStorage* aStorage, const nsAString& aKey,
nsAString& aRetval)
{
if (Persist(aStorage)) {
- WaitForPreload(Telemetry::LOCALDOMSTORAGE_GETVALUE_BLOCKING_MS);
+ WaitForPreload();
if (NS_FAILED(mLoadResult)) {
return mLoadResult;
}
@@ -439,7 +402,7 @@ DOMStorageCache::SetItem(const DOMStorage* aStorage, const nsAString& aKey,
int64_t delta = 0;
if (Persist(aStorage)) {
- WaitForPreload(Telemetry::LOCALDOMSTORAGE_SETVALUE_BLOCKING_MS);
+ WaitForPreload();
if (NS_FAILED(mLoadResult)) {
return mLoadResult;
}
@@ -488,7 +451,7 @@ DOMStorageCache::RemoveItem(const DOMStorage* aStorage, const nsAString& aKey,
nsString& aOld)
{
if (Persist(aStorage)) {
- WaitForPreload(Telemetry::LOCALDOMSTORAGE_REMOVEKEY_BLOCKING_MS);
+ WaitForPreload();
if (NS_FAILED(mLoadResult)) {
return mLoadResult;
}
@@ -527,9 +490,8 @@ DOMStorageCache::Clear(const DOMStorage* aStorage)
// We need to preload all data (know the size) before we can proceeed
// to correctly decrease cached usage number.
// XXX as in case of unload, this is not technically needed now, but
- // after super-scope quota introduction we have to do this. Get telemetry
- // right now.
- WaitForPreload(Telemetry::LOCALDOMSTORAGE_CLEAR_BLOCKING_MS);
+ // after super-scope quota introduction we have to do this.
+ WaitForPreload();
if (NS_FAILED(mLoadResult)) {
// When we failed to load data from the database, force delete of the
// scope data and make use of the storage possible again.
@@ -599,9 +561,8 @@ DOMStorageCache::UnloadItems(uint32_t aUnloadFlags)
// Must wait for preload to pass correct usage to ProcessUsageDelta
// XXX this is not technically needed right now since there is just
// per-origin isolated quota handling, but when we introduce super-
- // -scope quotas, we have to do this. Better to start getting
- // telemetry right now.
- WaitForPreload(Telemetry::LOCALDOMSTORAGE_UNLOAD_BLOCKING_MS);
+ // -scope quotas, we have to do this.
+ WaitForPreload();
mData[kDefaultSet].mKeys.Clear();
ProcessUsageDelta(kDefaultSet, -mData[kDefaultSet].mOriginQuotaUsage);
@@ -620,7 +581,7 @@ DOMStorageCache::UnloadItems(uint32_t aUnloadFlags)
#ifdef DOM_STORAGE_TESTS
if (aUnloadFlags & kTestReload) {
- WaitForPreload(Telemetry::LOCALDOMSTORAGE_UNLOAD_BLOCKING_MS);
+ WaitForPreload();
mData[kDefaultSet].mKeys.Clear();
mLoaded = false; // This is only used in testing code
diff --git a/dom/storage/DOMStorageCache.h b/dom/storage/DOMStorageCache.h
index 01cf6b3ea..4469152a2 100644
--- a/dom/storage/DOMStorageCache.h
+++ b/dom/storage/DOMStorageCache.h
@@ -14,7 +14,6 @@
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
#include "mozilla/Monitor.h"
-#include "mozilla/Telemetry.h"
#include "mozilla/Atomics.h"
namespace mozilla {
@@ -168,7 +167,7 @@ private:
private:
// Synchronously blocks until the cache is fully loaded from the database
- void WaitForPreload(mozilla::Telemetry::ID aTelemetryID);
+ void WaitForPreload();
// Helper to get one of the 3 data sets (regular, private, session)
Data& DataSet(const DOMStorage* aStorage);
@@ -241,9 +240,6 @@ private:
// Drops back to false when session-only data are cleared from chrome.
bool mSessionOnlyDataSetActive : 1;
- // Whether we have already captured state of the cache preload on our first access.
- bool mPreloadTelemetryRecorded : 1;
-
// DOMStorageDBThread on the parent or single process,
// DOMStorageDBChild on the child process.
static DOMStorageDBBridge* sDatabase;
diff --git a/dom/storage/DOMStorageDBThread.cpp b/dom/storage/DOMStorageDBThread.cpp
index 183be5c5c..f86dbad9c 100644
--- a/dom/storage/DOMStorageDBThread.cpp
+++ b/dom/storage/DOMStorageDBThread.cpp
@@ -163,8 +163,6 @@ DOMStorageDBThread::Shutdown()
return NS_ERROR_NOT_INITIALIZED;
}
- Telemetry::AutoTimer<Telemetry::LOCALDOMSTORAGE_SHUTDOWN_DATABASE_MS> timer;
-
{
MonitorAutoLock monitor(mThreadObserver->GetMonitor());
diff --git a/dom/storage/DOMStorageIPC.cpp b/dom/storage/DOMStorageIPC.cpp
index a8cd745f1..9d87a5788 100644
--- a/dom/storage/DOMStorageIPC.cpp
+++ b/dom/storage/DOMStorageIPC.cpp
@@ -11,7 +11,6 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/Unused.h"
-#include "nsIDiskSpaceWatcher.h"
#include "nsThreadUtils.h"
namespace mozilla {
@@ -321,22 +320,6 @@ private:
mozilla::Unused << mParent->SendOriginsHavingData(scopes);
}
- // We need to check if the device is in a low disk space situation, so
- // we can forbid in that case any write in localStorage.
- nsCOMPtr<nsIDiskSpaceWatcher> diskSpaceWatcher =
- do_GetService("@mozilla.org/toolkit/disk-space-watcher;1");
- if (!diskSpaceWatcher) {
- return NS_OK;
- }
-
- bool lowDiskSpace = false;
- diskSpaceWatcher->GetIsDiskFull(&lowDiskSpace);
-
- if (lowDiskSpace) {
- mozilla::Unused << mParent->SendObserve(
- nsDependentCString("low-disk-space"), EmptyString(), EmptyCString());
- }
-
return NS_OK;
}
diff --git a/dom/storage/DOMStorageManager.cpp b/dom/storage/DOMStorageManager.cpp
index 156e846ba..8f50fcfb4 100644
--- a/dom/storage/DOMStorageManager.cpp
+++ b/dom/storage/DOMStorageManager.cpp
@@ -103,7 +103,6 @@ NS_IMPL_ISUPPORTS(DOMStorageManager,
DOMStorageManager::DOMStorageManager(DOMStorage::StorageType aType)
: mCaches(8)
, mType(aType)
- , mLowDiskSpace(false)
{
DOMStorageObserver* observer = DOMStorageObserver::Self();
NS_ASSERTION(observer, "No DOMStorageObserver, cannot observe private data delete notifications!");
@@ -566,22 +565,6 @@ DOMStorageManager::Observe(const char* aTopic,
return NS_OK;
}
- if (!strcmp(aTopic, "low-disk-space")) {
- if (mType == LocalStorage) {
- mLowDiskSpace = true;
- }
-
- return NS_OK;
- }
-
- if (!strcmp(aTopic, "no-low-disk-space")) {
- if (mType == LocalStorage) {
- mLowDiskSpace = false;
- }
-
- return NS_OK;
- }
-
#ifdef DOM_STORAGE_TESTS
if (!strcmp(aTopic, "test-reload")) {
if (mType != LocalStorage) {
diff --git a/dom/storage/DOMStorageManager.h b/dom/storage/DOMStorageManager.h
index 666e16a6f..0bfd21975 100644
--- a/dom/storage/DOMStorageManager.h
+++ b/dom/storage/DOMStorageManager.h
@@ -102,12 +102,6 @@ private:
const DOMStorage::StorageType mType;
- // If mLowDiskSpace is true it indicates a low device storage situation and
- // so no localStorage writes are allowed. sessionStorage writes are still
- // allowed.
- bool mLowDiskSpace;
- bool IsLowDiskSpace() const { return mLowDiskSpace; };
-
void ClearCaches(uint32_t aUnloadFlags,
const OriginAttributesPattern& aPattern,
const nsACString& aKeyPrefix);
diff --git a/dom/storage/DOMStorageObserver.cpp b/dom/storage/DOMStorageObserver.cpp
index a2b3f1da8..fbbab8e54 100644
--- a/dom/storage/DOMStorageObserver.cpp
+++ b/dom/storage/DOMStorageObserver.cpp
@@ -70,9 +70,6 @@ DOMStorageObserver::Init()
obs->AddObserver(sSelf, "profile-before-change", true);
obs->AddObserver(sSelf, "xpcom-shutdown", true);
- // Observe low device storage notifications.
- obs->AddObserver(sSelf, "disk-space-watcher", true);
-
#ifdef DOM_STORAGE_TESTS
// Testing
obs->AddObserver(sSelf, "domstorage-test-flush-force", true);
@@ -313,16 +310,6 @@ DOMStorageObserver::Observe(nsISupports* aSubject,
return NS_OK;
}
- if (!strcmp(aTopic, "disk-space-watcher")) {
- if (NS_LITERAL_STRING("full").Equals(aData)) {
- Notify("low-disk-space");
- } else if (NS_LITERAL_STRING("free").Equals(aData)) {
- Notify("no-low-disk-space");
- }
-
- return NS_OK;
- }
-
#ifdef DOM_STORAGE_TESTS
if (!strcmp(aTopic, "domstorage-test-flush-force")) {
DOMStorageDBBridge* db = DOMStorageCache::GetDatabase();