gecko-dev/widget/android
Bill McCloskey 9edd615af7 Bug 1382922 - Refactor event queue to allow multiple implementations (r=erahm)
This patch refactors the nsThread event queue to clean it up and to make it easier to restructure. The fundamental concepts are as follows:

Each nsThread will have a pointer to a refcounted SynchronizedEventQueue. A SynchronizedEQ takes care of doing the locking and condition variable work when posting and popping events. For the actual storage of events, it delegates to an AbstractEventQueue data structure. It keeps a UniquePtr to the AbstractEventQueue that it uses for storage.

Both SynchronizedEQ and AbstractEventQueue are abstract classes. There is only one concrete implementation of SynchronizedEQ in this patch, which is called ThreadEventQueue. ThreadEventQueue uses locks and condition variables to post and pop events the same way nsThread does. It also encapsulates the functionality that DOM workers need to implement their special event loops (PushEventQueue and PopEventQueue). In later Quantum DOM work, I plan to have another SynchronizedEQ implementation for the main thread, called SchedulerEventQueue. It will have special code for the cooperatively scheduling threads in Quantum DOM.

There are two concrete implementations of AbstractEventQueue in this patch: EventQueue and PrioritizedEventQueue. EventQueue replaces the old nsEventQueue. The other AbstractEventQueue implementation is PrioritizedEventQueue, which uses multiple queues for different event priorities.

The final major piece here is ThreadEventTarget, which splits some of the code for posting events out of nsThread. Eventually, my plan is for multiple cooperatively scheduled nsThreads to be able to share a ThreadEventTarget. In this patch, though, each nsThread has its own ThreadEventTarget. The class's purpose is just to collect some related code together.

One final note: I tried to avoid virtual dispatch overhead as much as possible. Calls to SynchronizedEQ methods do use virtual dispatch, since I plan to use different implementations for different threads with Quantum DOM. But all the calls to EventQueue methods should be non-virtual. Although the methods are declared virtual, all the classes used are final and the concrete classes involved should all be known through templatization.

MozReview-Commit-ID: 9Evtr9oIJvx
2017-08-16 20:55:43 -07:00
..
bindings Bug 1322650 - Add jni::GetAPIVersion() to get Android API version r=jchen 2017-05-15 09:37:55 -05:00
fennec Bug 1381916 - Remove support for plugins on Android r=jchen,bsmedberg 2017-07-31 12:25:16 -05:00
jni Bug 1384828 - Use tid for UI thread detection; r=esawin 2017-08-03 13:06:16 -04:00
ANRReporter.cpp Bug 1360471 (part 4) - Use a bitfield to represent profiler features. r=mstange. 2017-05-01 14:23:34 +10:00
ANRReporter.h
AndroidAlerts.cpp
AndroidAlerts.h
AndroidBridge.cpp Bug 1367850 - Move Android UI thread runnable queue from AndroidBridge to AndroidUiThread r=jchen 2017-07-03 17:18:50 -07:00
AndroidBridge.h Bug 1384828 - Use tid for UI thread detection; r=esawin 2017-08-03 13:06:16 -04:00
AndroidBridgeUtilities.h
AndroidCompositorWidget.cpp Bug 1335895 - Android GeckoView Dynamic Toolbar Version 3 r=botond,dvander,jchen,kats 2017-04-20 15:15:14 -07:00
AndroidCompositorWidget.h Bug 1335895 - Android GeckoView Dynamic Toolbar Version 3 r=botond,dvander,jchen,kats 2017-04-20 15:15:14 -07:00
AndroidContentController.cpp Bug 1335895 - Android GeckoView Dynamic Toolbar Version 3 r=botond,dvander,jchen,kats 2017-04-20 15:15:14 -07:00
AndroidContentController.h Bug 1335895 - Android GeckoView Dynamic Toolbar Version 3 r=botond,dvander,jchen,kats 2017-04-20 15:15:14 -07:00
AndroidDirectTexture.h
AndroidGraphicBuffer.h
AndroidJNI.cpp
AndroidJNIWrapper.cpp Bug 1372405 - Provide names for all runnables in the tree (r=froydnj) 2017-06-26 14:19:58 -07:00
AndroidJNIWrapper.h
AndroidJavaWrappers.cpp
AndroidJavaWrappers.h
AndroidUiThread.cpp Bug 1382922 - Refactor event queue to allow multiple implementations (r=erahm) 2017-08-16 20:55:43 -07:00
AndroidUiThread.h Bug 1367850 - Move Android UI thread runnable queue from AndroidBridge to AndroidUiThread r=jchen 2017-07-03 17:18:50 -07:00
EventDispatcher.cpp Bug 1372405 - Provide names for all runnables in the tree (r=froydnj) 2017-06-26 14:19:58 -07:00
EventDispatcher.h Bug 1362195 - 1. Add EventDispatcher::Dispatch for C++ code; r=snorp 2017-05-11 16:40:17 -04:00
GeckoBatteryManager.h
GeckoEditableSupport.cpp Bug 1266683 - Part 3 - Update notifyIMEContext JNI bindings to include private mode info. r=jchen 2017-07-31 22:45:54 +02:00
GeckoEditableSupport.h Bug 1353799 - 2. Update current composition when setting/removing spans; r=esawin 2017-04-27 20:59:42 -04:00
GeckoNetworkManager.h
GeckoProcessManager.h Bug 1343075 - Use GeckoEditableSupport from PuppetWidget; r=masayuki r=rbarker r=snorp r=esawin 2017-03-07 22:34:39 -05:00
GeckoScreenOrientation.h
GeneratedJNINatives.h Bug 1368701 - [1.2] Add shutdown intent action to shutdown Fennec. r=snorp,bc 2017-07-06 19:20:43 +02:00
GeneratedJNIWrappers.cpp Bug 1386240 - [1.3] Check success status when enabling or disabling geolocation events. r=jchen 2017-08-08 18:15:54 +02:00
GeneratedJNIWrappers.h Bug 1386240 - [2.0] Fix JNI wrappers. r=me 2017-08-08 19:20:44 +02:00
GfxInfo.cpp
GfxInfo.h
PrefsHelper.h Bug 1384835 (part 2, attempt 2) - Remove the Preferences::Get*String() variants that return nsAdoptingString. r=froydnj. 2017-07-31 14:23:50 +10:00
moz.build Bug 1368597 label CompositorWidget and WindowSurface as Graphics BUG_COMPONENT r=rhunt 2017-05-30 14:29:22 +12:00
nsAndroidProtocolHandler.cpp
nsAndroidProtocolHandler.h
nsAppShell.cpp Bug 1381916 - Remove support for plugins on Android r=jchen,bsmedberg 2017-07-31 12:25:16 -05:00
nsAppShell.h Bug 1343075 - Use GeckoEditableSupport from PuppetWidget; r=masayuki r=rbarker r=snorp r=esawin 2017-03-07 22:34:39 -05:00
nsClipboard.cpp
nsClipboard.h
nsDeviceContextAndroid.cpp Bug 1387381 - Remove nsXPIDLString local variables. r=erahm. 2017-08-08 16:07:55 +10:00
nsDeviceContextAndroid.h
nsIAndroidBridge.idl Bug 1337325 - Remove unused zoom and scroll code from browser.js r=kats 2017-02-12 13:33:42 +01:00
nsIdleServiceAndroid.cpp
nsIdleServiceAndroid.h
nsLookAndFeel.cpp
nsLookAndFeel.h Bug 1386915 - Add nsLookAndFeel::NativeInit() virtual call for initializing native-side state; r=jfkthame 2017-08-06 15:41:08 -07:00
nsPrintOptionsAndroid.cpp
nsPrintOptionsAndroid.h
nsScreenManagerAndroid.cpp Bug 1372405 - Provide names for all runnables in the tree (r=froydnj) 2017-06-26 14:19:58 -07:00
nsScreenManagerAndroid.h Bug 1194751 - Part 6.1 change nsScreenManagerAndroid::ScreenForId to a concrete method. r=snorp 2017-03-09 19:30:53 +08:00
nsWidgetFactory.cpp
nsWindow.cpp Backed out changeset 6798fd30a785 (bug 1126479) 2017-08-15 18:30:03 +02:00
nsWindow.h Bug 1379252 - Remove unused argument. r=rbarker 2017-07-07 14:56:10 -04:00