mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Bug 1310833: Modify PContentParent::SendActivateA11y to accept the content process's MSAA ID as a parameter; r=tbsaunde
MozReview-Commit-ID: DCnYvWQRA5W --HG-- extra : rebase_source : 7f1ebc6d4aabdaec3ea51421c26621f90c8e61e6
This commit is contained in:
parent
e6b863ac53
commit
e97105dc3a
@ -85,16 +85,14 @@ private:
|
||||
|
||||
constexpr MsaaIdGenerator::MsaaIdGenerator()
|
||||
: mIDSet(kNumUniqueIDBits)
|
||||
, mContentProcessID(0)
|
||||
{}
|
||||
|
||||
uint32_t
|
||||
MsaaIdGenerator::GetID()
|
||||
{
|
||||
static const uint32_t kContentProcessId = ResolveContentProcessID();
|
||||
uint32_t id = mIDSet.GetID();
|
||||
MOZ_ASSERT(id <= ((1UL << kNumUniqueIDBits) - 1UL));
|
||||
return detail::BuildMsaaID(id, kContentProcessId);
|
||||
return detail::BuildMsaaID(id, ResolveContentProcessID());
|
||||
}
|
||||
|
||||
void
|
||||
@ -104,7 +102,7 @@ MsaaIdGenerator::ReleaseID(AccessibleWrap* aAccWrap)
|
||||
uint32_t id = aAccWrap->GetExistingID();
|
||||
MOZ_ASSERT(id != AccessibleWrap::kNoID);
|
||||
detail::MsaaIDCracker cracked(id);
|
||||
if (cracked.GetContentProcessId() != mContentProcessID) {
|
||||
if (cracked.GetContentProcessId() != ResolveContentProcessID()) {
|
||||
// This may happen if chrome holds a proxy whose ID was originally generated
|
||||
// by a content process. Since ReleaseID only has meaning in the process
|
||||
// that originally generated that ID, we ignore ReleaseID calls for any ID
|
||||
@ -126,9 +124,8 @@ bool
|
||||
MsaaIdGenerator::IsIDForThisContentProcess(uint32_t aID)
|
||||
{
|
||||
MOZ_ASSERT(XRE_IsContentProcess());
|
||||
static const uint32_t kContentProcessId = ResolveContentProcessID();
|
||||
detail::MsaaIDCracker cracked(aID);
|
||||
return cracked.GetContentProcessId() == kContentProcessId;
|
||||
return cracked.GetContentProcessId() == ResolveContentProcessID();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -158,10 +155,10 @@ MsaaIdGenerator::ResolveContentProcessID()
|
||||
}
|
||||
|
||||
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
|
||||
Unused << contentChild->SendGetA11yContentId(&mContentProcessID);
|
||||
uint32_t result = contentChild->GetMsaaID();
|
||||
|
||||
MOZ_ASSERT(mContentProcessID);
|
||||
return mContentProcessID;
|
||||
MOZ_ASSERT(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,7 +48,6 @@ private:
|
||||
|
||||
private:
|
||||
IDSet mIDSet;
|
||||
uint32_t mContentProcessID;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
|
@ -502,6 +502,9 @@ ContentChild* ContentChild::sSingleton;
|
||||
|
||||
ContentChild::ContentChild()
|
||||
: mID(uint64_t(-1))
|
||||
#if defined(XP_WIN) && defined(ACCESSIBILITY)
|
||||
, mMsaaID(0)
|
||||
#endif
|
||||
, mCanOverrideProcessName(true)
|
||||
, mIsAlive(true)
|
||||
, mShuttingDown(false)
|
||||
@ -2415,13 +2418,18 @@ ContentChild::RecvFlushMemory(const nsString& reason)
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvActivateA11y()
|
||||
ContentChild::RecvActivateA11y(const uint32_t& aMsaaID)
|
||||
{
|
||||
#ifdef ACCESSIBILITY
|
||||
#ifdef XP_WIN
|
||||
MOZ_ASSERT(aMsaaID != 0);
|
||||
mMsaaID = aMsaaID;
|
||||
#endif // XP_WIN
|
||||
|
||||
// Start accessibility in content process if it's running in chrome
|
||||
// process.
|
||||
GetOrCreateAccService(nsAccessibilityService::eMainProcess);
|
||||
#endif
|
||||
#endif // ACCESSIBILITY
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -434,7 +434,7 @@ public:
|
||||
|
||||
virtual bool RecvFlushMemory(const nsString& reason) override;
|
||||
|
||||
virtual bool RecvActivateA11y() override;
|
||||
virtual bool RecvActivateA11y(const uint32_t& aMsaaID) override;
|
||||
virtual bool RecvShutdownA11y() override;
|
||||
|
||||
virtual bool RecvGarbageCollect() override;
|
||||
@ -555,6 +555,10 @@ public:
|
||||
|
||||
ContentParentId GetID() const { return mID; }
|
||||
|
||||
#if defined(XP_WIN) && defined(ACCESSIBILITY)
|
||||
uint32_t GetMsaaID() const { return mMsaaID; }
|
||||
#endif
|
||||
|
||||
bool IsForApp() const { return mIsForApp; }
|
||||
bool IsForBrowser() const { return mIsForBrowser; }
|
||||
|
||||
@ -675,6 +679,14 @@ private:
|
||||
*/
|
||||
ContentParentId mID;
|
||||
|
||||
#if defined(XP_WIN) && defined(ACCESSIBILITY)
|
||||
/**
|
||||
* This is an a11y-specific unique id for the content process that is
|
||||
* generated by the chrome process.
|
||||
*/
|
||||
uint32_t mMsaaID;
|
||||
#endif
|
||||
|
||||
AppInfo mAppInfo;
|
||||
|
||||
bool mIsForApp;
|
||||
|
@ -1356,10 +1356,11 @@ ContentParent::Init()
|
||||
if (nsIPresShell::IsAccessibilityActive()) {
|
||||
#if defined(XP_WIN)
|
||||
if (IsVistaOrLater()) {
|
||||
Unused << SendActivateA11y();
|
||||
Unused <<
|
||||
SendActivateA11y(a11y::AccessibleWrap::GetContentProcessIdFor(ChildID()));
|
||||
}
|
||||
#else
|
||||
Unused << SendActivateA11y();
|
||||
Unused << SendActivateA11y(0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@ -2781,10 +2782,11 @@ ContentParent::Observe(nsISupports* aSubject,
|
||||
// accessibility gets initiated in chrome process.
|
||||
#if defined(XP_WIN)
|
||||
if (IsVistaOrLater()) {
|
||||
Unused << SendActivateA11y();
|
||||
Unused <<
|
||||
SendActivateA11y(a11y::AccessibleWrap::GetContentProcessIdFor(ChildID()));
|
||||
}
|
||||
#else
|
||||
Unused << SendActivateA11y();
|
||||
Unused << SendActivateA11y(0);
|
||||
#endif
|
||||
} else {
|
||||
// If possible, shut down accessibility in content process when
|
||||
@ -5144,18 +5146,6 @@ ContentParent::RecvUnstoreAndBroadcastBlobURLUnregistration(const nsCString& aUR
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvGetA11yContentId(uint32_t* aContentId)
|
||||
{
|
||||
#if defined(XP_WIN32) && defined(ACCESSIBILITY)
|
||||
*aContentId = a11y::AccessibleWrap::GetContentProcessIdFor(ChildID());
|
||||
MOZ_ASSERT(*aContentId);
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -552,9 +552,6 @@ public:
|
||||
virtual bool
|
||||
RecvUnstoreAndBroadcastBlobURLUnregistration(const nsCString& aURI) override;
|
||||
|
||||
virtual bool
|
||||
RecvGetA11yContentId(uint32_t* aContentId) override;
|
||||
|
||||
virtual int32_t Pid() const override;
|
||||
|
||||
// Use the PHangMonitor channel to ask the child to repaint a tab.
|
||||
|
@ -505,8 +505,11 @@ child:
|
||||
|
||||
/**
|
||||
* Start accessibility engine in content process.
|
||||
* @param aMsaaID is an a11y-specific unique id for the content process
|
||||
* that is generated by the chrome process. Only used on
|
||||
* Windows; pass 0 on other platforms.
|
||||
*/
|
||||
async ActivateA11y();
|
||||
async ActivateA11y(uint32_t aMsaaID);
|
||||
|
||||
/**
|
||||
* Shutdown accessibility engine in content process (if not in use).
|
||||
@ -1175,8 +1178,6 @@ parent:
|
||||
async AccumulateChildHistogram(Accumulation[] accumulations);
|
||||
async AccumulateChildKeyedHistogram(KeyedAccumulation[] accumulations);
|
||||
|
||||
sync GetA11yContentId() returns (uint32_t aContentId);
|
||||
|
||||
both:
|
||||
async AsyncMessage(nsString aMessage, CpowEntry[] aCpows,
|
||||
Principal aPrincipal, ClonedMessageData aData);
|
||||
|
Loading…
Reference in New Issue
Block a user