зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1445662 - Ensure the keyboard map access is threadsafe. r=rhunt
- The change in APZCTreeManagerParent is functionally a no-op because it only ever runs in the GPU process on the controller thread. But it allows moving the controller thread to some other thread. - The change in nsBaseWidget is a no-op for desktop platforms, because in the UI process the main thread is the controller thread. But on Android it moves the call from the main thread to the Java UI thread.
This commit is contained in:
Родитель
58ea959557
Коммит
d59c0946db
|
@ -1878,6 +1878,8 @@ APZCTreeManager::ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY)
|
|||
void
|
||||
APZCTreeManager::SetKeyboardMap(const KeyboardMap& aKeyboardMap)
|
||||
{
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
mKeyboardMap = aKeyboardMap;
|
||||
}
|
||||
|
||||
|
|
|
@ -699,6 +699,7 @@ private:
|
|||
std::unordered_map<ScrollableLayerGuid, ZoomConstraints, ScrollableLayerGuidHash> mZoomConstraints;
|
||||
/* A list of keyboard shortcuts to use for translating keyboard inputs into
|
||||
* keyboard actions. This is gathered on the main thread from XBL bindings.
|
||||
* This must only be accessed on the controller thread.
|
||||
*/
|
||||
KeyboardMap mKeyboardMap;
|
||||
/* This tracks the focus targets of chrome and content and whether we have
|
||||
|
|
|
@ -166,7 +166,11 @@ APZCTreeManagerParent::RecvReceiveKeyboardInputEvent(
|
|||
mozilla::ipc::IPCResult
|
||||
APZCTreeManagerParent::RecvSetKeyboardMap(const KeyboardMap& aKeyboardMap)
|
||||
{
|
||||
mTreeManager->SetKeyboardMap(aKeyboardMap);
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod<KeyboardMap>(
|
||||
"layers::IAPZCTreeManager::SetKeyboardMap",
|
||||
mTreeManager,
|
||||
&IAPZCTreeManager::SetKeyboardMap,
|
||||
aKeyboardMap));
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
|
|
@ -933,6 +933,7 @@ nsBaseWidget::CreateRootContentController()
|
|||
|
||||
void nsBaseWidget::ConfigureAPZCTreeManager()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(mAPZC);
|
||||
|
||||
ConfigureAPZControllerThread();
|
||||
|
@ -940,7 +941,13 @@ void nsBaseWidget::ConfigureAPZCTreeManager()
|
|||
mAPZC->SetDPI(GetDPI());
|
||||
|
||||
if (gfxPrefs::APZKeyboardEnabled()) {
|
||||
mAPZC->SetKeyboardMap(nsXBLWindowKeyHandler::CollectKeyboardShortcuts());
|
||||
KeyboardMap map = nsXBLWindowKeyHandler::CollectKeyboardShortcuts();
|
||||
// On Android the main thread is not the controller thread
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod<KeyboardMap>(
|
||||
"layers::IAPZCTreeManager::SetKeyboardMap",
|
||||
mAPZC,
|
||||
&IAPZCTreeManager::SetKeyboardMap,
|
||||
map));
|
||||
}
|
||||
|
||||
RefPtr<IAPZCTreeManager> treeManager = mAPZC; // for capture by the lambdas
|
||||
|
|
Загрузка…
Ссылка в новой задаче