CompositorSession.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef _include_mozilla_gfx_ipc_CompositorSession_h_
  6. #define _include_mozilla_gfx_ipc_CompositorSession_h_
  7. #include "base/basictypes.h"
  8. #include "mozilla/layers/LayersTypes.h"
  9. #include "mozilla/layers/CompositorTypes.h"
  10. #include "nsISupportsImpl.h"
  11. class nsIWidget;
  12. namespace mozilla {
  13. namespace widget {
  14. class CompositorWidget;
  15. class CompositorWidgetDelegate;
  16. } // namespace widget
  17. namespace gfx {
  18. class GPUProcessHost;
  19. class GPUProcessManager;
  20. } // namespace gfx
  21. namespace layers {
  22. class GeckoContentController;
  23. class IAPZCTreeManager;
  24. class CompositorBridgeParent;
  25. class CompositorBridgeChild;
  26. class ClientLayerManager;
  27. // A CompositorSession provides access to a compositor without exposing whether
  28. // or not it's in-process or out-of-process.
  29. class CompositorSession
  30. {
  31. friend class gfx::GPUProcessManager;
  32. protected:
  33. typedef gfx::GPUProcessHost GPUProcessHost;
  34. typedef widget::CompositorWidget CompositorWidget;
  35. typedef widget::CompositorWidgetDelegate CompositorWidgetDelegate;
  36. public:
  37. NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorSession)
  38. virtual bool Reset(const nsTArray<LayersBackend>& aBackendHints,
  39. TextureFactoryIdentifier* aOutIdentifier) = 0;
  40. virtual void Shutdown() = 0;
  41. // This returns a CompositorBridgeParent if the compositor resides in the same process.
  42. virtual CompositorBridgeParent* GetInProcessBridge() const = 0;
  43. // Set the GeckoContentController for the root of the layer tree.
  44. virtual void SetContentController(GeckoContentController* aController) = 0;
  45. // Return the Async Pan/Zoom Tree Manager for this compositor.
  46. virtual RefPtr<IAPZCTreeManager> GetAPZCTreeManager() const = 0;
  47. // Return the child end of the compositor IPC bridge.
  48. CompositorBridgeChild* GetCompositorBridgeChild();
  49. // Return the proxy for accessing the compositor's widget.
  50. CompositorWidgetDelegate* GetCompositorWidgetDelegate() {
  51. return mCompositorWidgetDelegate;
  52. }
  53. // Return the id of the root layer tree.
  54. uint64_t RootLayerTreeId() const {
  55. return mRootLayerTreeId;
  56. }
  57. protected:
  58. CompositorSession(CompositorWidgetDelegate* aDelegate,
  59. CompositorBridgeChild* aChild,
  60. const uint64_t& aRootLayerTreeId);
  61. virtual ~CompositorSession();
  62. protected:
  63. CompositorWidgetDelegate* mCompositorWidgetDelegate;
  64. RefPtr<CompositorBridgeChild> mCompositorBridgeChild;
  65. uint64_t mRootLayerTreeId;
  66. private:
  67. DISALLOW_COPY_AND_ASSIGN(CompositorSession);
  68. };
  69. } // namespace layers
  70. } // namespace mozilla
  71. #endif // _include_mozilla_gfx_ipc_CompositorSession_h_