1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_layout_RemoteLayerTreeOwner_h
8 #define mozilla_layout_RemoteLayerTreeOwner_h
10 #include "base/process.h"
12 #include "mozilla/Attributes.h"
14 #include "mozilla/dom/ipc/IdType.h"
15 #include "mozilla/layers/CompositorOptions.h"
16 #include "mozilla/layers/LayersTypes.h"
17 #include "nsDisplayList.h"
20 class nsSubDocumentFrame
;
29 struct TextureFactoryIdentifier
;
35 * RemoteLayerTreeOwner connects and manages layer trees for remote frames. It
36 * is directly owned by a BrowserParent and always lives in the parent process.
38 class RemoteLayerTreeOwner final
{
39 typedef mozilla::layers::CompositorOptions CompositorOptions
;
40 typedef mozilla::layers::LayerManager LayerManager
;
41 typedef mozilla::layers::LayersId LayersId
;
42 typedef mozilla::layers::TextureFactoryIdentifier TextureFactoryIdentifier
;
45 RemoteLayerTreeOwner();
46 virtual ~RemoteLayerTreeOwner();
48 bool Initialize(dom::BrowserParent
* aBrowserParent
);
51 void EnsureLayersConnected(CompositorOptions
* aCompositorOptions
);
52 bool AttachWindowRenderer();
53 void OwnerContentChanged();
55 LayersId
GetLayersId() const { return mLayersId
; }
56 CompositorOptions
GetCompositorOptions() const { return mCompositorOptions
; }
58 void GetTextureFactoryIdentifier(
59 TextureFactoryIdentifier
* aTextureFactoryIdentifier
) const;
61 bool IsInitialized() const { return mInitialized
; }
62 bool IsLayersConnected() const { return mLayersConnected
; }
65 // The process id of the remote frame. This is used by the compositor to
66 // do security checks on incoming layer transactions.
67 base::ProcessId mTabProcessId
;
68 // The layers id of the remote frame.
70 // The compositor options for this layers id. This is only meaningful if
71 // the compositor actually knows about this layers id (i.e. when
72 // mLayersConnected is true).
73 CompositorOptions mCompositorOptions
;
75 dom::BrowserParent
* mBrowserParent
;
76 RefPtr
<WindowRenderer
> mWindowRenderer
;
79 // A flag that indicates whether or not the compositor knows about the
80 // layers id. In some cases this RemoteLayerTreeOwner is not connected to the
81 // compositor and so this flag is false.
82 bool mLayersConnected
;
86 } // namespace mozilla
88 #endif // mozilla_layout_RemoteLayerTreeOwner_h