Bug 732708 - Part b: Devirtualize BroadcastChangeNotification and remove a dead implementation; r=honzab

This commit is contained in:
Ms2ger 2012-04-14 15:06:30 +02:00
parent ef397048a4
commit 752c5210b1
3 changed files with 11 additions and 36 deletions

View File

@ -47,10 +47,9 @@ class nsIDOMStorageObsolete;
class nsIURI;
class nsIPrincipal;
// {BAFFCEB1-FD40-4ea9-8378-3509DD79204A}
#define NS_PIDOMSTORAGE_IID \
{ 0xbaffceb1, 0xfd40, 0x4ea9, \
{ 0x83, 0x78, 0x35, 0x9, 0xdd, 0x79, 0x20, 0x4a } }
#define NS_PIDOMSTORAGE_IID \
{ 0x86dfe3c4, 0x4286, 0x4648, \
{ 0xb2, 0x09, 0x55, 0x27, 0x50, 0x59, 0x26, 0xac } }
class nsPIDOMStorage : public nsISupports
{
@ -76,10 +75,6 @@ public:
virtual bool CanAccess(nsIPrincipal *aPrincipal) = 0;
virtual nsDOMStorageType StorageType() = 0;
virtual void BroadcastChangeNotification(const nsSubstring &aKey,
const nsSubstring &aOldValue,
const nsSubstring &aNewValue) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMStorage, NS_PIDOMSTORAGE_IID)

View File

@ -1742,25 +1742,6 @@ nsDOMStorage::StorageType()
return mStorageType;
}
void
nsDOMStorage::BroadcastChangeNotification(const nsSubstring &aKey,
const nsSubstring &aOldValue,
const nsSubstring &aNewValue)
{
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (!observerService) {
return;
}
// Fire off a notification that a storage object changed. If the
// storage object is a session storage object, we don't pass a
// domain, but if it's a global storage object we do.
observerService->NotifyObservers((nsIDOMStorageObsolete *)this,
"dom-storage-changed",
NS_ConvertUTF8toUTF16(mStorageImpl->mDomain).get());
}
//
// nsDOMStorage2
//
@ -1925,8 +1906,8 @@ StorageNotifierRunnable::Run()
void
nsDOMStorage2::BroadcastChangeNotification(const nsSubstring &aKey,
const nsSubstring &aOldValue,
const nsSubstring &aNewValue)
const nsSubstring &aOldValue,
const nsSubstring &aNewValue)
{
nsresult rv;
nsCOMPtr<nsIDOMStorageEvent> event = new nsDOMStorageEvent();

View File

@ -339,6 +339,8 @@ private:
nsDOMStorage* mOwner;
};
class nsDOMStorage2;
class nsDOMStorage : public nsIDOMStorageObsolete,
public nsPIDOMStorage
{
@ -366,9 +368,6 @@ public:
virtual nsIPrincipal* Principal();
virtual bool CanAccess(nsIPrincipal *aPrincipal);
virtual nsDOMStorageType StorageType();
virtual void BroadcastChangeNotification(const nsSubstring &aKey,
const nsSubstring &aOldValue,
const nsSubstring &aNewValue);
// Check whether storage may be used by the caller, and whether it
// is session only. Returns true if storage may be used.
@ -419,7 +418,7 @@ public:
friend class nsIDOMStorage2;
nsCOMPtr<nsIPrincipal> mPrincipal;
nsPIDOMStorage* mEventBroadcaster;
nsDOMStorage2* mEventBroadcaster;
};
class nsDOMStorage2 : public nsIDOMStorage,
@ -445,10 +444,10 @@ public:
virtual nsIPrincipal* Principal();
virtual bool CanAccess(nsIPrincipal *aPrincipal);
virtual nsDOMStorageType StorageType();
virtual void BroadcastChangeNotification(const nsSubstring &aKey,
const nsSubstring &aOldValue,
const nsSubstring &aNewValue);
void BroadcastChangeNotification(const nsSubstring &aKey,
const nsSubstring &aOldValue,
const nsSubstring &aNewValue);
nsresult InitAsSessionStorageFork(nsIPrincipal *aPrincipal,
const nsSubstring &aDocumentURI,
nsIDOMStorageObsolete* aStorage);