Closed Bug 1227608 Opened 9 years ago Closed 9 years ago

Define layer client interface between gfx and Android widget

Categories

(Core Graveyard :: Widget: Android, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: jchen, Assigned: jchen)

References

Details

Attachments

(4 files)

Right now, gfx code uses AndroidBridge directly to access the widget/Java layer code, but we need a solution that works with individual widgets.
Summary: Define interface between code in gfx and code in widget → Define layer client interface between gfx and Android widget
To make code simpler on the C++ side, this patch adds a CreateEGLSurface call in GeckoLayerClient, so that the C++ side only has to deal with managing GeckoLayerClient.
Attachment #8692023 - Flags: review?(snorp)
mozilla::widget::ILayerClient will be the interface that C++ gfx code uses to interact with Java gfx code, through an intermediary in LayerClientBridge. Using a standalone interface lets us support multiple windows, whereas the existing approach using AndroidBridge calls does not support multiple windows.
Attachment #8692024 - Flags: review?(snorp)
Switch existing graphics code from using AndroidBridge calls to using ILayerClient calls, using an instance obtained from nsIWidget. Because this is an Android-specific interface, I didn't want to add a getter to nsIWidget itself. Also, this interface is used on the compositor thread, so the implementation has to be thread-safe, which means we cannot just have nsWindow implement the interface. Due to these reasons, this patch uses nsIWidget::GetNativeData as the means to get the interface from widget.
Attachment #8692031 - Flags: review?(snorp)
Remove the AndroiBridge calls made obsolete by the new ILayerClient interface.
Attachment #8692032 - Flags: review?(snorp)
Comment on attachment 8692031 [details] [diff] [review] Use ILayerClient instead of AndroidBridge (v1) Review of attachment 8692031 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/layers/composite/AsyncCompositionManager.cpp @@ +1388,5 @@ > +{ > + Compositor* const compositor = mLayerManager->GetCompositor(); > + MOZ_ASSERT(compositor); > + > + nsIWidget* const widget = compositor->GetWidget(); Note that this gets run on the compositor thread so you should probably use a RefPtr for holding the widget at least.
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #5) > Comment on attachment 8692031 [details] [diff] [review] > Use ILayerClient instead of AndroidBridge (v1) > > Review of attachment 8692031 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: gfx/layers/composite/AsyncCompositionManager.cpp > @@ +1388,5 @@ > > +{ > > + Compositor* const compositor = mLayerManager->GetCompositor(); > > + MOZ_ASSERT(compositor); > > + > > + nsIWidget* const widget = compositor->GetWidget(); > > Note that this gets run on the compositor thread so you should probably use > a RefPtr for holding the widget at least. I tried that, but turns out nsWindow's ref-counting is non-threadsafe. We could switch it to be threadsafe, but I wasn't sure how much of a perf impact that would be. In Compositor, the widget is stored as a raw pointer presumably for the same reason.
Attachment #8692023 - Flags: review?(snorp) → review+
Attachment #8692024 - Flags: review?(snorp) → review-
Attachment #8692031 - Flags: review?(snorp) → review-
Attachment #8692032 - Flags: review?(snorp) → review-
Jim and I discussed, and we shouldn't need the ILayerClient once we kill all the Java stuff.
Gonna merge this bug with others.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: