Bug 1728403 - Introduce CacheUpdateType as argument for Cache IPDL message. r=morgan

Differential Revision: https://phabricator.services.mozilla.com/D124117
This commit is contained in:
Eitan Isaacson 2021-09-01 20:32:17 +00:00
parent 5a9e854ada
commit 6c538e2f0e
9 changed files with 33 additions and 15 deletions

View File

@ -18,6 +18,18 @@ class CacheDomain {
static constexpr uint64_t All = ~((uint64_t)0x0);
};
enum class CacheUpdateType {
/*
* An initial cache push of a loaded document or inserted subtree.
*/
Initial,
/*
* An incremental cache push of one or more fields that have changed.
*/
Update,
};
} // namespace a11y
} // namespace mozilla

View File

@ -3011,7 +3011,7 @@ void LocalAccessible::SendCacheUpdate(uint64_t aCacheDomain) {
nsTArray<CacheData> data;
data.AppendElement(
CacheData(IsDoc() ? 0 : reinterpret_cast<uint64_t>(UniqueID()), fields));
ipcDoc->SendCache(1, data, true);
ipcDoc->SendCache(CacheUpdateType::Update, data, true);
}
already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(

View File

@ -85,7 +85,7 @@ void DocAccessibleChildBase::InsertIntoIpcTree(LocalAccessible* aParent,
acc->BundleFieldsForCache(CacheDomain::All);
cache.AppendElement(CacheData(id, fields));
}
Unused << SendCache(0, cache, true);
Unused << SendCache(CacheUpdateType::Initial, cache, true);
}
}

View File

@ -474,8 +474,8 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvScrollingEvent(
}
mozilla::ipc::IPCResult DocAccessibleParent::RecvCache(
const uint8_t& aUpdateType, nsTArray<CacheData>&& aData,
const bool& aFinal) {
const mozilla::a11y::CacheUpdateType& aUpdateType,
nsTArray<CacheData>&& aData, const bool& aFinal) {
for (auto& entry : aData) {
RemoteAccessible* remote = GetAccessible(entry.ID());
if (!remote) {

View File

@ -136,9 +136,9 @@ class DocAccessibleParent : public RemoteAccessible,
const uint32_t& aScrollY, const uint32_t& aMaxScrollX,
const uint32_t& aMaxScrollY) override;
virtual mozilla::ipc::IPCResult RecvCache(const uint8_t& aUpdateType,
nsTArray<CacheData>&& aData,
const bool& aFinal) override;
virtual mozilla::ipc::IPCResult RecvCache(
const mozilla::a11y::CacheUpdateType& aUpdateType,
nsTArray<CacheData>&& aData, const bool& aFinal) override;
#if !defined(XP_WIN)
virtual mozilla::ipc::IPCResult RecvAnnouncementEvent(

View File

@ -10,6 +10,7 @@
#ifdef ACCESSIBILITY
# include "mozilla/a11y/AccAttributes.h"
# include "mozilla/a11y/AccTypes.h"
# include "mozilla/a11y/CacheConstants.h"
# include "mozilla/a11y/Role.h"
# include "mozilla/GfxMessageUtils.h"
# include "ipc/EnumSerializer.h"
@ -36,6 +37,12 @@ struct ParamTraits<mozilla::a11y::AccGenericType>
mozilla::a11y::AccGenericType,
mozilla::a11y::AccGenericType::eAllGenericTypes> {};
template <>
struct ParamTraits<mozilla::a11y::CacheUpdateType>
: public ContiguousEnumSerializerInclusive<
mozilla::a11y::CacheUpdateType, mozilla::a11y::CacheUpdateType::Initial,
mozilla::a11y::CacheUpdateType::Update> {};
template <>
struct ParamTraits<mozilla::a11y::FontSize> {
typedef mozilla::a11y::FontSize paramType;

View File

@ -8,6 +8,7 @@
#define mozilla_a11y_RemoteAccessibleBase_h
#include "mozilla/a11y/Accessible.h"
#include "mozilla/a11y/CacheConstants.h"
#include "mozilla/a11y/Role.h"
#include "AccAttributes.h"
#include "nsIAccessibleText.h"
@ -192,8 +193,8 @@ class RemoteAccessibleBase : public Accessible {
DocAccessibleParent* AsDoc() const { return IsDoc() ? mDoc : nullptr; }
void ApplyCache(uint8_t aUpdateType, AccAttributes* aFields) {
if (aUpdateType == 0 || !mCachedFields) {
void ApplyCache(CacheUpdateType aUpdateType, AccAttributes* aFields) {
if (aUpdateType == CacheUpdateType::Initial || !mCachedFields) {
mCachedFields = aFields;
} else {
mCachedFields->Update(aFields);

View File

@ -17,6 +17,7 @@ using mozilla::a11y::role from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::AccType from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::AccGenericType from "mozilla/a11y/IPCTypes.h";
[RefCounted] using mozilla::a11y::AccAttributes from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::CacheUpdateType from "mozilla/a11y/IPCTypes.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
@ -126,12 +127,10 @@ parent:
/*
* Cache The World
* XXX: aUpdateType should be an enum, for now it is
* 0 for initial push, and 1 for partial update.
* aFinal is false when paginating cache into several pushes,
* and then true on the final push.
*/
async Cache(uint8_t aUpdateType, CacheData[] aData, bool aFinal);
async Cache(CacheUpdateType aUpdateType, CacheData[] aData, bool aFinal);
child:
/*

View File

@ -16,6 +16,7 @@ using mozilla::a11y::IAccessibleHolder from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::IDispatchHolder from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::AccType from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::AccGenericType from "mozilla/a11y/IPCTypes.h";
using mozilla::a11y::CacheUpdateType from "mozilla/a11y/IPCTypes.h";
using mozilla::WindowsHandle from "mozilla/ipc/IPCTypes.h";
using mozilla::LayoutDeviceIntRect from "Units.h";
@ -84,12 +85,10 @@ parent:
/*
* Cache The World
* XXX: aUpdateType should be an enum, for now it is
* 0 for initial push, and 1 for partial update.
* aFinal is false when paginating cache into several pushes,
* and then true on the final push.
*/
async Cache(uint8_t aUpdateType, CacheData[] aData, bool aFinal);
async Cache(CacheUpdateType aUpdateType, CacheData[] aData, bool aFinal);
child:
/**