Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 839048b

Browse files
committed
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions. Authors: gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical gfx/layers/d3d* - D3D9/D3D10 - bas gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas gfx/layers/composite/* - CompositeLayers - nrc,nical gfx/layers/client/* - Client - nrc,nical,bas gfx/layers/*Image* - nical gfx/layers/ipc ipc - IPC - nical gfx/layers/opengl - CompositorOGL - nrc,nical gfx/2d - bas,nrc gfx/gl - GLContext - bjacob dom/* layout/* - DOM - mattwoodrow
1 parent 5a36971 commit 839048b

213 files changed

Lines changed: 18546 additions & 9693 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8078,7 +8078,7 @@ dnl ========================================================
80788078
dnl Graphics checks.
80798079
dnl ========================================================
80808080

8081-
if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
8081+
if test "${OS_TARGET}" = "WINNT" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
80828082
MOZ_ENABLE_SKIA=1
80838083
else
80848084
MOZ_ENABLE_SKIA=

dom/base/nsDOMWindowUtils.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2207,6 +2207,25 @@ nsDOMWindowUtils::GetLayerManagerType(nsAString& aType)
22072207
return NS_OK;
22082208
}
22092209

2210+
NS_IMETHODIMP
2211+
nsDOMWindowUtils::GetLayerManagerRemote(bool* retval)
2212+
{
2213+
if (!nsContentUtils::IsCallerChrome()) {
2214+
return NS_ERROR_DOM_SECURITY_ERR;
2215+
}
2216+
2217+
nsCOMPtr<nsIWidget> widget = GetWidget();
2218+
if (!widget)
2219+
return NS_ERROR_FAILURE;
2220+
2221+
LayerManager *mgr = widget->GetLayerManager();
2222+
if (!mgr)
2223+
return NS_ERROR_FAILURE;
2224+
2225+
*retval = !!mgr->AsShadowForwarder();
2226+
return NS_OK;
2227+
}
2228+
22102229
NS_IMETHODIMP
22112230
nsDOMWindowUtils::StartFrameTimeRecording(uint32_t *startIndex)
22122231
{

dom/interfaces/base/nsIDOMWindowUtils.idl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ interface nsIDOMClientRect;
4141
interface nsIURI;
4242
interface nsIDOMEventTarget;
4343

44-
[scriptable, uuid(ab9e9c45-1910-458c-a043-79cbbfc89f4d)]
44+
[scriptable, uuid(04429978-3417-411b-882b-81cd5cec5ecd)]
4545
interface nsIDOMWindowUtils : nsISupports {
4646

4747
/**
@@ -1063,6 +1063,13 @@ interface nsIDOMWindowUtils : nsISupports {
10631063
* error if there is no widget associated with this window.
10641064
*/
10651065
readonly attribute AString layerManagerType;
1066+
1067+
/**
1068+
* True if the layer manager for the widget associated with this window is
1069+
* forwarding layers to a remote compositor, false otherwise. Throws an
1070+
* error if there is no widget associated with this window.
1071+
*/
1072+
readonly attribute boolean layerManagerRemote;
10661073

10671074
/**
10681075
* Record (and return) frame-intervals and paint-times for frames which were presented

dom/ipc/PBrowser.ipdl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ include "mozilla/dom/TabMessageUtils.h";
2323
include "mozilla/dom/ScreenOrientation.h";
2424
include "mozilla/dom/PermissionMessageUtils.h";
2525
include "mozilla/layout/RenderFrameUtils.h";
26+
include "mozilla/layers/CompositorTypes.h";
2627

2728
using IPC::Principal;
2829
using gfxMatrix;
2930
using gfxRect;
3031
using gfxSize;
31-
using mozilla::layers::LayersBackend;
3232
using mozilla::layers::FrameMetrics;
3333
using mozilla::layout::ScrollingBehavior;
3434
using mozilla::void_t;
@@ -50,7 +50,7 @@ using nsTextEvent;
5050
using nsTouchEvent;
5151
using RemoteDOMEvent;
5252
using mozilla::dom::ScreenOrientation;
53-
53+
using mozilla::layers::TextureFactoryIdentifier;
5454
namespace mozilla {
5555
namespace dom {
5656

@@ -209,7 +209,7 @@ parent:
209209
*/
210210
sync PRenderFrame()
211211
returns (ScrollingBehavior scrolling,
212-
LayersBackend backend, int32_t maxTextureSize, uint64_t layersId);
212+
TextureFactoryIdentifier textureFactoryIdentifier, uint64_t layersId);
213213

214214
/**
215215
* Starts an offline application cache update.

dom/ipc/TabChild.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,8 +2029,7 @@ TabChild::RecvSetAppType(const nsString& aAppType)
20292029

20302030
PRenderFrameChild*
20312031
TabChild::AllocPRenderFrame(ScrollingBehavior* aScrolling,
2032-
LayersBackend* aBackend,
2033-
int32_t* aMaxTextureSize,
2032+
TextureFactoryIdentifier* aTextureFactoryIdentifier,
20342033
uint64_t* aLayersId)
20352034
{
20362035
return new RenderFrameChild();
@@ -2089,12 +2088,11 @@ TabChild::InitRenderingState()
20892088
{
20902089
static_cast<PuppetWidget*>(mWidget.get())->InitIMEState();
20912090

2092-
LayersBackend be;
20932091
uint64_t id;
2094-
int32_t maxTextureSize;
2092+
TextureFactoryIdentifier textureFactoryIdentifier;
20952093
RenderFrameChild* remoteFrame =
20962094
static_cast<RenderFrameChild*>(SendPRenderFrameConstructor(
2097-
&mScrolling, &be, &maxTextureSize, &id));
2095+
&mScrolling, &textureFactoryIdentifier, &id));
20982096
if (!remoteFrame) {
20992097
NS_WARNING("failed to construct RenderFrame");
21002098
return false;
@@ -2104,15 +2102,14 @@ TabChild::InitRenderingState()
21042102
if (id != 0) {
21052103
// Pushing layers transactions directly to a separate
21062104
// compositor context.
2107-
PCompositorChild* compositorChild = CompositorChild::Get();
2105+
PCompositorChild* compositorChild = CompositorChild::Get();
21082106
if (!compositorChild) {
21092107
NS_WARNING("failed to get CompositorChild instance");
21102108
return false;
21112109
}
21122110
shadowManager =
2113-
compositorChild->SendPLayersConstructor(be, id,
2114-
&be,
2115-
&maxTextureSize);
2111+
compositorChild->SendPLayersConstructor(textureFactoryIdentifier.mParentBackend,
2112+
id, &textureFactoryIdentifier);
21162113
} else {
21172114
// Pushing transactions to the parent content.
21182115
shadowManager = remoteFrame->SendPLayersConstructor();
@@ -2126,11 +2123,11 @@ TabChild::InitRenderingState()
21262123
}
21272124

21282125
ShadowLayerForwarder* lf =
2129-
mWidget->GetLayerManager(shadowManager, be)->AsShadowForwarder();
2126+
mWidget->GetLayerManager(shadowManager, textureFactoryIdentifier.mParentBackend)
2127+
->AsShadowForwarder();
21302128
NS_ABORT_IF_FALSE(lf && lf->HasShadowManager(),
21312129
"PuppetWidget should have shadow manager");
2132-
lf->SetParentBackendType(be);
2133-
lf->SetMaxTextureSize(maxTextureSize);
2130+
lf->IdentifyTextureHost(textureFactoryIdentifier);
21342131

21352132
mRemoteFrame = remoteFrame;
21362133

dom/ipc/TabChild.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ namespace layout {
6161
class RenderFrameChild;
6262
}
6363

64+
namespace layers {
65+
struct TextureFactoryIdentifier;
66+
}
67+
6468
namespace dom {
6569

6670
class TabChild;
@@ -332,8 +336,7 @@ class TabChild : public PBrowserChild,
332336

333337
protected:
334338
virtual PRenderFrameChild* AllocPRenderFrame(ScrollingBehavior* aScrolling,
335-
LayersBackend* aBackend,
336-
int32_t* aMaxTextureSize,
339+
TextureFactoryIdentifier* aTextureFactoryIdentifier,
337340
uint64_t* aLayersId) MOZ_OVERRIDE;
338341
virtual bool DeallocPRenderFrame(PRenderFrameChild* aFrame) MOZ_OVERRIDE;
339342
virtual bool RecvDestroy() MOZ_OVERRIDE;

dom/ipc/TabParent.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,8 +1253,7 @@ TabParent::HandleDelayedDialogs()
12531253

12541254
PRenderFrameParent*
12551255
TabParent::AllocPRenderFrame(ScrollingBehavior* aScrolling,
1256-
LayersBackend* aBackend,
1257-
int32_t* aMaxTextureSize,
1256+
TextureFactoryIdentifier* aTextureFactoryIdentifier,
12581257
uint64_t* aLayersId)
12591258
{
12601259
MOZ_ASSERT(ManagedPRenderFrameParent().IsEmpty());
@@ -1268,7 +1267,7 @@ TabParent::AllocPRenderFrame(ScrollingBehavior* aScrolling,
12681267
*aScrolling = UseAsyncPanZoom() ? ASYNC_PAN_ZOOM : DEFAULT_SCROLLING;
12691268
return new RenderFrameParent(frameLoader,
12701269
*aScrolling,
1271-
aBackend, aMaxTextureSize, aLayersId);
1270+
aTextureFactoryIdentifier, aLayersId);
12721271
}
12731272

12741273
bool
@@ -1410,8 +1409,7 @@ TabParent::RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
14101409
bool
14111410
TabParent::RecvPRenderFrameConstructor(PRenderFrameParent* actor,
14121411
ScrollingBehavior* scrolling,
1413-
LayersBackend* backend,
1414-
int32_t* maxTextureSize,
1412+
TextureFactoryIdentifier* factoryIdentifier,
14151413
uint64_t* layersId)
14161414
{
14171415
RenderFrameParent* rfp = GetRenderFrame();

dom/ipc/TabParent.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ namespace mozilla {
3434

3535
namespace layers {
3636
struct FrameMetrics;
37+
struct TextureFactoryIdentifier;
3738
}
3839

3940
namespace layout {
@@ -96,8 +97,7 @@ class TabParent : public PBrowserParent
9697
virtual bool RecvEvent(const RemoteDOMEvent& aEvent);
9798
virtual bool RecvPRenderFrameConstructor(PRenderFrameParent* actor,
9899
ScrollingBehavior* scrolling,
99-
LayersBackend* backend,
100-
int32_t* maxTextureSize,
100+
TextureFactoryIdentifier* identifier,
101101
uint64_t* layersId);
102102
virtual bool RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
103103
const nsString& aURL,
@@ -191,7 +191,7 @@ class TabParent : public PBrowserParent
191191
virtual POfflineCacheUpdateParent* AllocPOfflineCacheUpdate(
192192
const URIParams& aManifestURI,
193193
const URIParams& aDocumentURI,
194-
const bool& stickDocument);
194+
const bool& stickDocument) MOZ_OVERRIDE;
195195
virtual bool DeallocPOfflineCacheUpdate(POfflineCacheUpdateParent* actor);
196196

197197
JSBool GetGlobalJSObject(JSContext* cx, JSObject** globalp);
@@ -255,8 +255,7 @@ class TabParent : public PBrowserParent
255255
bool AllowContentIME();
256256

257257
virtual PRenderFrameParent* AllocPRenderFrame(ScrollingBehavior* aScrolling,
258-
LayersBackend* aBackend,
259-
int32_t* aMaxTextureSize,
258+
TextureFactoryIdentifier* aTextureFactoryIdentifier,
260259
uint64_t* aLayersId) MOZ_OVERRIDE;
261260
virtual bool DeallocPRenderFrame(PRenderFrameParent* aFrame) MOZ_OVERRIDE;
262261

dom/plugins/ipc/PluginInstanceParent.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ PluginInstanceParent::DestroyBackground()
919919
unused << SendPPluginBackgroundDestroyerConstructor(pbd);
920920
}
921921

922-
SurfaceDescriptor
922+
mozilla::plugins::SurfaceDescriptor
923923
PluginInstanceParent::BackgroundDescriptor()
924924
{
925925
NS_ABORT_IF_FALSE(mBackground, "Need a background here");
@@ -941,7 +941,7 @@ PluginInstanceParent::BackgroundDescriptor()
941941

942942
// If this is ever used, which it shouldn't be, it will trigger a
943943
// hard assertion in IPDL-generated code.
944-
return SurfaceDescriptor();
944+
return mozilla::plugins::SurfaceDescriptor();
945945
}
946946

947947
ImageContainer*

gfx/2d/Makefile.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,11 @@ CPPSRCS += \
9191
endif
9292

9393
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
94-
ifdef MOZ_ENABLE_SKIA
9594
CPPSRCS += \
9695
ScaledFontMac.cpp \
9796
$(NULL)
9897

9998
endif
100-
endif
10199

102100
ifeq ($(MOZ_WIDGET_TOOLKIT),$(findstring $(MOZ_WIDGET_TOOLKIT),android gtk2 gonk qt))
103101
CPPSRCS += \

0 commit comments

Comments
 (0)