When waiting for the compositor to shut down, it's possible for
nsWindow::DrawWindowunderlay and DrawWindowOverlay to be called. In that
case, the GL controller is already destroyed, and we should just bail.
In order to prevent the deadlock, we need to release sAppShellLock when
we start waiting in SyncRunEvent. However, we cannot simply unlock it
before the wait because that introduces an out-of-order unlocking wrt
mSyncRunMonitor, which can cause further deadlocks. So this patch
converts mSyncRunMoitor to a condvar and make it use sAppShellLock. That
then involves making aAppShellLock a Mutex instead of a StaticMutex. The
final result is having one lock (sAppShellLock), which supports any
other condvars that we have like mSyncRunFinished.
This patch:
- Makes the following substitutions (plus necessary namespace qualifiers:
gfxImageFormat::ARGB32 --> SurfaceFormat::A8R8G8B8_UINT32
gfxImageFormat::RGB24 --> SurfaceFormat::X8R8G8B8_UINT32
gfxImageFormat::A8 --> SurfaceFormat::A8
gfxImageFormat::RGB16_565 --> SurfaceFormat::R5G6B5_UINT16
gfxImageFormat::Unknown --> SurfaceFormat::UNKNOWN
- Changes gfxImageFormat to be a typedef to gfx::SurfaceFormat. This will be
removed soon.
- Removes gfxCairoFormatToImageFormat() and gfxImageFormatToCairoFormat() and
replace calls to them with CairoFormatToGfxFormat() and
GfxFormatToCairoFormat().
- Removes ParamTraits<gfxImageFormat>.
- Add namespace qualifiers to SurfaceFormat instances where necessary.
--HG--
extra : rebase_source : f56e92b1593957a9e4e00171100bc7605816e696
This also changes aPrintToFileName parameter for BeginDocument to an nsAString& from char16_t*.
Having a char16_t* caused a pain with VS2105 where wchar_t != char16_t (as on VS2103), after it had been sent over IPDL.
This could have been worked around with casting, but this seemed like the tidier solution.
When nsWindow closes, notify GLController to shut down. To ensure any
pending calls on the UI thread are processed first, post a Runnable to
the UI thread that disposes the GLController on the UI thread.
To guarantee that GeckoInputConnection and GeckoEditable are not used by
GeckoView after GeckoEditable has been destroyed, we need to make sure a
certain sequence is followed. We should first unset the
InputConnectionListener in GeckoView on the UI thread; then unset the
GeckoEditableListener on the IC thread; and finally finish destroying
the GeckoEditable instance through disposeNative. This patch merges this
logic with the initialization logic in GeckoEditable.onViewChange, so
that onViewChange can be used for both initialization and destruction.
LayerView used to call GeckoLayerClient.onGeckoReady directly if Gecko
is sufficiently loaded. However, onGeckoReady indirectly calls
GLController.createCompositor, and it's possible for the
createCompositor event to be prioritized so that it happens before we
initialize GLController, causing a crash. This patch moves the
onGeckoReady call to the Gecko thread, after GLController is
initialized, to avoid this race condition.
Only three GLController events -- CreateCompositor, PauseCompositor, and
OnResumedCompositor should be prioritized through GLControllerEvent. The
other GLController events should follow the normal event queue ordering
to prevent race conditions.
When we have a Java exception in native code, the Java stack in the
exception will not be very useful because the top frame is the native
entry point. In this case, the native stack is more useful. However,
currently we don't get a good native stack in this situation because we
go through Java when handling the exception, and the native stack we get
will have a lot of unknown frames inside libdvm or libart. This patch
makes us stay in native code when handling an uncaught exception from
native code, so that we get a good native stack.
This patch moves the SyncRunEvent logic from GLControllerSupport to
nsAppShell, as it could be useful elsewhere. This patch fixes a race
condition related to shutdown, where a deadlock could occur if Gecko
shuts down when another thread is waiting for a synchronous event to
finish running. This patch also fixes a crash on shutdown when we tried
to create a mutex after the deadlock detector has shut down.
When getting nsAppShell from another thread, there could be a race with
nsAppShell being destroyed on the main thread. This patch makes the raw
nsAppShell pointer only accessible from the main thread, and use a
static mutex to coordinate accessing nsAppShell from other threads.
This patch changes onAttachedToWindow in GeckoView, so that if we have
states that have been restored, we use those states for initialization
instead of creating new states (e.g. opening a new nsWindow). Because
the GLController instance is associated with the nsWindow instance, we
need to keep the GLController instance as part of our saved states. This
patch also adds a reattach method to GeckoView.Window, because
GeckoEditable needs to be notified when its target View changes.
This patch makes GLContextProviderEGL create EGL surfaces through
nsWindow/nsIWidget on Android. nsWindow then calls GLController in Java
to actually create the surface.
GLController instances are associated with a particular nsWindow, rather
than a particular View. Therefore, we need to let GeckoView manage
GLController instances, as part of GeckoView's handling of saving and
restoring states.
One nsWindow will have one corresponding GLController, and using native
GLController methods instead of GeckoEvents lets us control the
compositor for each nsWindow separately.
GeckoViewSupport better reflects the purpose of the class and will match
the GLControllerSupport class that another patch is adding. This patch
also changes the way GeckoViewSupport is constructed in order to be more
encapsulating.
Right now LayerView depends on geckoConnected being called by GeckoApp
or GeckoView during its initialization. However, we can get rid of it
and let LayerView handle the task itself. As part of this change, screen
depth overriding is moved to native code in nsAppShell.
This patch adds auto-generated bindings for LayerRenderer.Frame, and
uses the new bindings in nsWindow, in place of the old manual bindings
in AndroidJavaWrappers.
This also changes aPrintToFileName parameter for BeginDocument to an nsAString& from char16_t*.
Having a char16_t* caused a pain with VS2105 where wchar_t != char16_t (as on VS2103), after it had been sent over IPDL.
This could have been worked around with casting, but this seemed like the tidier solution.
We send query text events when flushing IME changes, and sometimes these
events make Gecko commit more pending changes. In that case, we should
try flushing again, so we pick up the new changes.
This patch also makes the process of flushing text changes
transactional, so that if we have to bail due to more pending changes,
nothing will be committed.
We send query text events when flushing IME changes, and sometimes these
events make Gecko commit more pending changes. In that case, we should
try flushing again, so we pick up the new changes.
This patch also makes the process of flushing text changes
transactional, so that if we have to bail due to more pending changes,
nothing will be committed.
When the queue only contains compositor events, a compositor event
should go to the back of the queue to maintain order.
--HG--
extra : commitid : I7bHvJCe68o
RestrictedProfiles: The name of the class can be confusing because it handles
guest profiles and restricted profiles. We might even query it from a normal
profile.
--HG--
rename : mobile/android/base/RestrictedProfiles.java => mobile/android/base/Restrictions.java
extra : commitid : BtjvH8aWSlk
extra : rebase_source : 262c9537d7e93658ceea6f94c8481a393ddd3072