Bug 1565728 - Introduce PDocAccessiblePlatformExt. r=Jamie

This is an extension protocol that can be used for platform specific
API (ie. AccessibleWrap methods).

I'm not thrilled with the seperate constructor for the sub-protocol.
This means that the parent won't have the actor upon DocAccessibleParent
construction, and some timing bugs can arise because of the extra round
trip. It would be cool if both actors could be co-created, but that
would require ManagedEndpoint, and for PBrowser to manage them both. I
don't want to expose this to PBrowser.

Differential Revision: https://phabricator.services.mozilla.com/D37955

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Eitan Isaacson 2019-09-12 20:10:51 +00:00
Родитель ec7a8745f1
Коммит 82aa8a18ca
13 изменённых файлов: 127 добавлений и 1 удалений

Просмотреть файл

@ -905,6 +905,7 @@ void NotificationController::WillRefresh(mozilla::TimeStamp aTime) {
if (browserChild) {
static_cast<BrowserChild*>(browserChild.get())
->SendPDocAccessibleConstructor(ipcDoc, parentIPCDoc, id, 0, 0);
ipcDoc->SendPDocAccessiblePlatformExtConstructor();
}
#endif
}

Просмотреть файл

@ -1543,6 +1543,9 @@ void DocAccessible::DoInitialUpdate() {
#endif
browserChild->SendPDocAccessibleConstructor(ipcDoc, nullptr, 0,
childID, holder);
#if !defined(XP_WIN)
ipcDoc->SendPDocAccessiblePlatformExtConstructor();
#endif
}
if (IsRoot()) {

Просмотреть файл

@ -20,6 +20,8 @@
# include "mozilla/mscom/Ptr.h"
# include "nsWinUtils.h"
# include "RootAccessible.h"
#else
# include "mozilla/a11y/DocAccessiblePlatformExtParent.h"
#endif
namespace mozilla {
@ -916,6 +918,23 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvBatch(
# endif // defined(XP_WIN)
return IPC_OK();
}
bool DocAccessibleParent::DeallocPDocAccessiblePlatformExtParent(
PDocAccessiblePlatformExtParent* aActor) {
delete aActor;
return true;
}
PDocAccessiblePlatformExtParent*
DocAccessibleParent::AllocPDocAccessiblePlatformExtParent() {
return new DocAccessiblePlatformExtParent();
}
DocAccessiblePlatformExtParent* DocAccessibleParent::GetPlatformExtension() {
return static_cast<DocAccessiblePlatformExtParent*>(
SingleManagedOrNull(ManagedPDocAccessiblePlatformExtParent()));
}
#endif // !defined(XP_WIN)
Tuple<DocAccessibleParent*, uint64_t> DocAccessibleParent::GetRemoteEmbedder() {

Просмотреть файл

@ -20,6 +20,10 @@ namespace a11y {
class xpcAccessibleGeneric;
#if !defined(XP_WIN)
class DocAccessiblePlatformExtParent;
#endif
/*
* These objects live in the main process and comunicate with and represent
* an accessible document in a content process.
@ -241,6 +245,14 @@ class DocAccessibleParent : public ProxyAccessible,
#if !defined(XP_WIN)
virtual mozilla::ipc::IPCResult RecvBatch(
const uint64_t& aBatchType, nsTArray<BatchData>&& aData) override;
virtual bool DeallocPDocAccessiblePlatformExtParent(
PDocAccessiblePlatformExtParent* aActor) override;
virtual PDocAccessiblePlatformExtParent* AllocPDocAccessiblePlatformExtParent()
override;
DocAccessiblePlatformExtParent* GetPlatformExtension();
#endif
/**

Просмотреть файл

@ -0,0 +1,7 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
DIRS += ['other']

Просмотреть файл

@ -0,0 +1,15 @@
#ifndef mozilla_a11y_DocAccessiblePlatformExtChild_h
#define mozilla_a11y_DocAccessiblePlatformExtChild_h
#include "mozilla/a11y/PDocAccessiblePlatformExtChild.h"
namespace mozilla {
namespace a11y {
class DocAccessibleChild;
class DocAccessiblePlatformExtChild : public PDocAccessiblePlatformExtChild {};
} // namespace a11y
} // namespace mozilla
#endif

Просмотреть файл

@ -0,0 +1,12 @@
#ifndef mozilla_a11y_DocAccessiblePlatformExtParent_h
#define mozilla_a11y_DocAccessiblePlatformExtParent_h
#include "mozilla/a11y/PDocAccessiblePlatformExtParent.h"
namespace mozilla {
namespace a11y {
class DocAccessiblePlatformExtParent : public PDocAccessiblePlatformExtParent {};
} // namespace a11y
} // namespace mozilla
#endif

Просмотреть файл

@ -0,0 +1,13 @@
include protocol PDocAccessible;
namespace mozilla {
namespace a11y {
protocol PDocAccessiblePlatformExt {
manager PDocAccessible;
child:
async __delete__();
};
}}

Просмотреть файл

@ -0,0 +1,20 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
# With --disable-accessibility, we need to compile PDocAccessiblePlatformExt.ipdl, but
# not the C++.
IPDL_SOURCES += ['PDocAccessiblePlatformExt.ipdl']
if CONFIG['ACCESSIBILITY']:
EXPORTS.mozilla.a11y += [
'DocAccessiblePlatformExtChild.h',
'DocAccessiblePlatformExtParent.h',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'

Просмотреть файл

@ -12,7 +12,7 @@ if CONFIG['OS_ARCH'] == 'WINNT':
'/accessible/windows/msaa',
]
else:
DIRS += ['other']
DIRS += ['other', 'extension']
LOCAL_INCLUDES += [
'/accessible/ipc/other',
]

Просмотреть файл

@ -22,6 +22,7 @@
# include "AccessibleWrap.h"
#endif
#include "mozilla/PresShell.h"
#include "mozilla/a11y/DocAccessiblePlatformExtChild.h"
namespace mozilla {
namespace a11y {
@ -1680,5 +1681,16 @@ mozilla::ipc::IPCResult DocAccessibleChild::RecvRestoreFocus() {
return IPC_OK();
}
bool DocAccessibleChild::DeallocPDocAccessiblePlatformExtChild(
PDocAccessiblePlatformExtChild* aActor) {
delete aActor;
return true;
}
PDocAccessiblePlatformExtChild*
DocAccessibleChild::AllocPDocAccessiblePlatformExtChild() {
return new DocAccessiblePlatformExtChild();
}
} // namespace a11y
} // namespace mozilla

Просмотреть файл

@ -13,6 +13,7 @@ namespace mozilla {
namespace a11y {
class Accessible;
class DocAccessiblePlatformExtChild;
class HyperTextAccessible;
class TextLeafAccessible;
class ImageAccessible;
@ -24,6 +25,8 @@ class TableCellAccessible;
* and their lifetime is the same as the document they represent.
*/
class DocAccessibleChild : public DocAccessibleChildBase {
friend DocAccessiblePlatformExtChild;
public:
DocAccessibleChild(DocAccessible* aDoc, IProtocol* aManager)
: DocAccessibleChildBase(aDoc) {
@ -471,6 +474,12 @@ class DocAccessibleChild : public DocAccessibleChildBase {
virtual mozilla::ipc::IPCResult RecvDOMNodeID(const uint64_t& aID,
nsString* aDOMNodeID) override;
virtual bool DeallocPDocAccessiblePlatformExtChild(
PDocAccessiblePlatformExtChild* aActor) override;
virtual PDocAccessiblePlatformExtChild* AllocPDocAccessiblePlatformExtChild()
override;
private:
Accessible* IdToAccessible(const uint64_t& aID) const;
Accessible* IdToAccessibleLink(const uint64_t& aID) const;

Просмотреть файл

@ -6,6 +6,7 @@
include protocol PFileDescriptorSet;
include protocol PBrowser;
include protocol PDocAccessiblePlatformExt;
include "mozilla/GfxMessageUtils.h";
@ -71,8 +72,10 @@ struct RelationTargets
nested(upto inside_sync) sync protocol PDocAccessible
{
manager PBrowser;
manages PDocAccessiblePlatformExt;
parent:
async PDocAccessiblePlatformExt();
async Shutdown();
/*