зеркало из https://github.com/mozilla/gecko-dev.git
Bug 708901 - Migrate to nsTHashSet in gfx/ipc. r=jrmuizel
Depends on D109316 Differential Revision: https://phabricator.services.mozilla.com/D109317
This commit is contained in:
Родитель
62d4fb1410
Коммит
79fddefe02
|
@ -92,11 +92,10 @@ void DrawEventRecorderMemory::RecordEvent(const RecordedEvent& aEvent) {
|
|||
}
|
||||
|
||||
void DrawEventRecorderMemory::AddDependentSurface(uint64_t aDependencyId) {
|
||||
mDependentSurfaces.PutEntry(aDependencyId);
|
||||
mDependentSurfaces.Insert(aDependencyId);
|
||||
}
|
||||
|
||||
nsTHashtable<nsUint64HashKey>&&
|
||||
DrawEventRecorderMemory::TakeDependentSurfaces() {
|
||||
nsTHashSet<uint64_t>&& DrawEventRecorderMemory::TakeDependentSurfaces() {
|
||||
return std::move(mDependentSurfaces);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
#include <unordered_map>
|
||||
#include <functional>
|
||||
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsTHashSet.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
@ -223,7 +222,7 @@ class DrawEventRecorderMemory : public DrawEventRecorderPrivate {
|
|||
|
||||
void AddDependentSurface(uint64_t aDependencyId) override;
|
||||
|
||||
nsTHashtable<nsUint64HashKey>&& TakeDependentSurfaces();
|
||||
nsTHashSet<uint64_t>&& TakeDependentSurfaces();
|
||||
|
||||
/**
|
||||
* @return the current size of the recording (in chars).
|
||||
|
@ -253,7 +252,7 @@ class DrawEventRecorderMemory : public DrawEventRecorderPrivate {
|
|||
|
||||
private:
|
||||
SerializeResourcesFn mSerializeCallback;
|
||||
nsTHashtable<nsUint64HashKey> mDependentSurfaces;
|
||||
nsTHashSet<uint64_t> mDependentSurfaces;
|
||||
|
||||
void Flush() override;
|
||||
};
|
||||
|
|
|
@ -160,7 +160,7 @@ bool PaintFragment::IsEmpty() const {
|
|||
}
|
||||
|
||||
PaintFragment::PaintFragment(IntSize aSize, ByteBuf&& aRecording,
|
||||
nsTHashtable<nsUint64HashKey>&& aDependencies)
|
||||
nsTHashSet<uint64_t>&& aDependencies)
|
||||
: mSize(aSize),
|
||||
mRecording(std::move(aRecording)),
|
||||
mDependencies(std::move(aDependencies)) {}
|
||||
|
@ -286,7 +286,7 @@ bool CrossProcessPaint::Start(dom::WindowGlobalParent* aRoot,
|
|||
|
||||
/* static */
|
||||
RefPtr<CrossProcessPaint::ResolvePromise> CrossProcessPaint::Start(
|
||||
nsTHashtable<nsUint64HashKey>&& aDependencies) {
|
||||
nsTHashSet<uint64_t>&& aDependencies) {
|
||||
MOZ_ASSERT(!aDependencies.IsEmpty());
|
||||
RefPtr<CrossProcessPaint> resolver =
|
||||
new CrossProcessPaint(1.0, dom::TabId(0));
|
||||
|
@ -354,9 +354,9 @@ void CrossProcessPaint::LostFragment(dom::WindowGlobalParent* aWGP) {
|
|||
}
|
||||
|
||||
void CrossProcessPaint::QueueDependencies(
|
||||
const nsTHashtable<nsUint64HashKey>& aDependencies) {
|
||||
for (auto iter = aDependencies.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
auto dependency = dom::TabId(iter.Get()->GetKey());
|
||||
const nsTHashSet<uint64_t>& aDependencies) {
|
||||
for (const auto& key : aDependencies) {
|
||||
auto dependency = dom::TabId(key);
|
||||
|
||||
// Get the current WindowGlobalParent of the remote browser that was marked
|
||||
// as a dependency
|
||||
|
@ -446,8 +446,8 @@ nsresult CrossProcessPaint::ResolveInternal(dom::TabId aTabId,
|
|||
}
|
||||
|
||||
// Rasterize all the dependencies first so that we can resolve this fragment
|
||||
for (auto iter = fragment->mDependencies.Iter(); !iter.Done(); iter.Next()) {
|
||||
auto dependency = dom::TabId(iter.Get()->GetKey());
|
||||
for (const auto& key : fragment->mDependencies) {
|
||||
auto dependency = dom::TabId(key);
|
||||
|
||||
nsresult rv = ResolveInternal(dependency, aResolved);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "nsTHashMap.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsTHashSet.h"
|
||||
|
||||
class nsIDocShell;
|
||||
|
||||
|
@ -86,11 +86,11 @@ class PaintFragment final {
|
|||
|
||||
typedef mozilla::ipc::ByteBuf ByteBuf;
|
||||
|
||||
PaintFragment(IntSize, ByteBuf&&, nsTHashtable<nsUint64HashKey>&&);
|
||||
PaintFragment(IntSize, ByteBuf&&, nsTHashSet<uint64_t>&&);
|
||||
|
||||
IntSize mSize;
|
||||
ByteBuf mRecording;
|
||||
nsTHashtable<nsUint64HashKey> mDependencies;
|
||||
nsTHashSet<uint64_t> mDependencies;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -126,8 +126,7 @@ class CrossProcessPaint final {
|
|||
float aScale, nscolor aBackgroundColor,
|
||||
CrossProcessPaintFlags aFlags, dom::Promise* aPromise);
|
||||
|
||||
static RefPtr<ResolvePromise> Start(
|
||||
nsTHashtable<nsUint64HashKey>&& aDependencies);
|
||||
static RefPtr<ResolvePromise> Start(nsTHashSet<uint64_t>&& aDependencies);
|
||||
|
||||
void ReceiveFragment(dom::WindowGlobalParent* aWGP,
|
||||
PaintFragment&& aFragment);
|
||||
|
@ -139,7 +138,7 @@ class CrossProcessPaint final {
|
|||
CrossProcessPaint(float aScale, dom::TabId aRoot);
|
||||
~CrossProcessPaint();
|
||||
|
||||
void QueueDependencies(const nsTHashtable<nsUint64HashKey>& aDependencies);
|
||||
void QueueDependencies(const nsTHashSet<uint64_t>& aDependencies);
|
||||
|
||||
void QueuePaint(
|
||||
dom::WindowGlobalParent* aWGP, const Maybe<IntRect>& aRect,
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "mozilla/dom/ipc/StructuredCloneData.h"
|
||||
#include "nsCSSPropertyID.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsID.h"
|
||||
#include "nsILoadInfo.h"
|
||||
|
@ -42,7 +41,7 @@
|
|||
#include "nsLiteralString.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsTHashSet.h"
|
||||
|
||||
// XXX Includes that are only required by implementations which could be moved
|
||||
// to the cpp file.
|
||||
|
@ -227,15 +226,18 @@ struct ParamTraits<nsAutoString> : ParamTraits<nsString> {
|
|||
|
||||
#endif // MOZILLA_INTERNAL_API
|
||||
|
||||
// XXX While this has no special dependencies, it's currently only used in
|
||||
// GfxMessageUtils and could be moved there, or generalized to potentially work
|
||||
// with any nsTHashSet.
|
||||
template <>
|
||||
struct ParamTraits<nsTHashtable<nsUint64HashKey>> {
|
||||
typedef nsTHashtable<nsUint64HashKey> paramType;
|
||||
struct ParamTraits<nsTHashSet<uint64_t>> {
|
||||
typedef nsTHashSet<uint64_t> paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
uint32_t count = aParam.Count();
|
||||
WriteParam(aMsg, count);
|
||||
for (auto iter = aParam.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
WriteParam(aMsg, iter.Get()->GetKey());
|
||||
for (const auto& key : aParam) {
|
||||
WriteParam(aMsg, key);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,7 +253,7 @@ struct ParamTraits<nsTHashtable<nsUint64HashKey>> {
|
|||
if (!ReadParam(aMsg, aIter, &key)) {
|
||||
return false;
|
||||
}
|
||||
table.PutEntry(key);
|
||||
table.Insert(key);
|
||||
}
|
||||
*aResult = std::move(table);
|
||||
return true;
|
||||
|
|
|
@ -122,9 +122,9 @@ mozilla::ipc::IPCResult RemotePrintJobParent::RecvProcessPage(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
nsTHashtable<nsUint64HashKey> deps;
|
||||
nsTHashSet<uint64_t> deps;
|
||||
for (auto i : aDeps) {
|
||||
deps.PutEntry(i);
|
||||
deps.Insert(i);
|
||||
}
|
||||
|
||||
gfx::CrossProcessPaint::Start(std::move(deps))
|
||||
|
|
Загрузка…
Ссылка в новой задаче