Backed out changeset 4315a6ac52a4 (bug 1353629)

This commit is contained in:
Sebastian Hengst 2017-04-20 18:37:04 +02:00
parent cfb1dc1596
commit 0f8dbe4f16
5 changed files with 2 additions and 113 deletions

View File

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "IPCBlobInputStreamParent.h"
#include "IPCBlobInputStreamStorage.h"
#include "nsContentUtils.h"
namespace mozilla {
@ -31,7 +30,7 @@ IPCBlobInputStreamParent::Create(nsIInputStream* aInputStream, nsresult* aRv)
size = 0;
}
IPCBlobInputStreamStorage::Get()->AddStream(aInputStream, id);
// TODO: register to a service.
return new IPCBlobInputStreamParent(id, size);
}
@ -45,7 +44,7 @@ IPCBlobInputStreamParent::IPCBlobInputStreamParent(const nsID& aID,
void
IPCBlobInputStreamParent::ActorDestroy(IProtocol::ActorDestroyReason aReason)
{
IPCBlobInputStreamStorage::Get()->ForgetStream(mID);
// TODO: unregister
}
} // namespace dom

View File

@ -1,57 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "IPCBlobInputStreamStorage.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/StaticPtr.h"
namespace mozilla {
namespace dom {
namespace {
StaticMutex gMutex;
StaticRefPtr<IPCBlobInputStreamStorage> gStorage;
}
IPCBlobInputStreamStorage::~IPCBlobInputStreamStorage()
{}
/* static */ IPCBlobInputStreamStorage*
IPCBlobInputStreamStorage::Get()
{
return gStorage;
}
/* static */ void
IPCBlobInputStreamStorage::Initialize()
{
MOZ_ASSERT(!gStorage);
gStorage = new IPCBlobInputStreamStorage();
ClearOnShutdown(&gStorage);
}
void
IPCBlobInputStreamStorage::AddStream(nsIInputStream* aInputStream,
const nsID& aID)
{
MOZ_ASSERT(aInputStream);
mozilla::StaticMutexAutoLock lock(gMutex);
mStorage.Put(aID, aInputStream);
}
void
IPCBlobInputStreamStorage::ForgetStream(const nsID& aID)
{
mozilla::StaticMutexAutoLock lock(gMutex);
mStorage.Remove(aID);
}
} // namespace dom
} // namespace mozilla

View File

@ -1,47 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_ipc_IPCBlobInputStreamStorage_h
#define mozilla_dom_ipc_IPCBlobInputStreamStorage_h
#include "mozilla/RefPtr.h"
#include "nsInterfaceHashtable.h"
#include "nsISupportsImpl.h"
class nsIInputStream;
struct nsID;
namespace mozilla {
namespace dom {
class IPCBlobInputStreamStorage final
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(IPCBlobInputStreamStorage);
// This initializes the singleton and it must be called on the main-thread.
static void
Initialize();
static IPCBlobInputStreamStorage*
Get();
void
AddStream(nsIInputStream* aInputStream, const nsID& aID);
void
ForgetStream(const nsID& aID);
private:
~IPCBlobInputStreamStorage();
nsInterfaceHashtable<nsIDHashKey, nsIInputStream> mStorage;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_ipc_IPCBlobInputStreamStorage_h

View File

@ -10,7 +10,6 @@ EXPORTS.mozilla.dom.ipc += [
'IPCBlobInputStream.h',
'IPCBlobInputStreamChild.h',
'IPCBlobInputStreamParent.h',
'IPCBlobInputStreamStorage.h',
'MemoryStreamChild.h',
'MemoryStreamParent.h',
'nsIRemoteBlob.h',
@ -25,7 +24,6 @@ UNIFIED_SOURCES += [
'IPCBlobInputStream.cpp',
'IPCBlobInputStreamChild.cpp',
'IPCBlobInputStreamParent.cpp',
'IPCBlobInputStreamStorage.cpp',
'IPCBlobUtils.cpp',
'MemoryStreamParent.cpp',
]

View File

@ -132,7 +132,6 @@ using namespace mozilla::system;
#include "mozilla/ServoBindings.h"
#include "mozilla/StaticPresData.h"
#include "mozilla/dom/WebIDLGlobalNameHash.h"
#include "mozilla/dom/ipc/IPCBlobInputStreamStorage.h"
using namespace mozilla;
using namespace mozilla::net;
@ -321,9 +320,6 @@ nsLayoutStatics::Initialize()
MediaPrefs::GetSingleton();
#endif
// This must be initialized on the main-thread.
mozilla::dom::IPCBlobInputStreamStorage::Initialize();
return NS_OK;
}