Bug 1867190 - Initialise the PHC allocate delay later r=glandium
[gecko.git] / layout / ipc / RemoteLayerTreeOwner.h
blob6a19dc293e1dcef07568520ccb80463fac7ff361
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"
19 class nsFrameLoader;
20 class nsSubDocumentFrame;
22 namespace mozilla {
24 namespace dom {
25 class BrowserParent;
26 } // namespace dom
28 namespace layers {
29 struct TextureFactoryIdentifier;
30 } // namespace layers
32 namespace layout {
34 /**
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;
44 public:
45 RemoteLayerTreeOwner();
46 virtual ~RemoteLayerTreeOwner();
48 bool Initialize(dom::BrowserParent* aBrowserParent);
49 void Destroy();
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; }
64 private:
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.
69 LayersId mLayersId;
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;
78 bool mInitialized;
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;
85 } // namespace layout
86 } // namespace mozilla
88 #endif // mozilla_layout_RemoteLayerTreeOwner_h