2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2016-05-18 08:33:22 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef _include_mozilla_gfx_ipc_CompositorSession_h_
|
|
|
|
#define _include_mozilla_gfx_ipc_CompositorSession_h_
|
|
|
|
|
|
|
|
#include "base/basictypes.h"
|
2016-11-06 21:56:53 +03:00
|
|
|
#include "mozilla/layers/LayersTypes.h"
|
|
|
|
#include "mozilla/layers/CompositorTypes.h"
|
2016-05-18 08:33:22 +03:00
|
|
|
#include "nsISupportsImpl.h"
|
2017-04-06 01:42:50 +03:00
|
|
|
#if defined(MOZ_WIDGET_ANDROID)
|
|
|
|
# include "mozilla/layers/UiCompositorControllerChild.h"
|
|
|
|
#endif // defined(MOZ_WIDGET_ANDROID)
|
2016-05-18 08:33:22 +03:00
|
|
|
|
2019-06-19 19:14:56 +03:00
|
|
|
class nsBaseWidget;
|
2016-07-01 11:15:16 +03:00
|
|
|
|
2016-05-18 08:33:22 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
2016-07-01 11:15:16 +03:00
|
|
|
class CompositorWidget;
|
2016-07-01 11:15:16 +03:00
|
|
|
class CompositorWidgetDelegate;
|
2016-05-18 08:33:22 +03:00
|
|
|
} // namespace widget
|
2016-05-23 10:27:01 +03:00
|
|
|
namespace gfx {
|
2016-07-18 07:24:28 +03:00
|
|
|
class GPUProcessHost;
|
2016-05-23 10:27:01 +03:00
|
|
|
class GPUProcessManager;
|
|
|
|
} // namespace gfx
|
2016-05-18 08:33:22 +03:00
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
class GeckoContentController;
|
2016-07-20 14:37:00 +03:00
|
|
|
class IAPZCTreeManager;
|
2016-05-18 08:33:22 +03:00
|
|
|
class CompositorBridgeParent;
|
|
|
|
class CompositorBridgeChild;
|
|
|
|
class ClientLayerManager;
|
|
|
|
|
|
|
|
// A CompositorSession provides access to a compositor without exposing whether
|
|
|
|
// or not it's in-process or out-of-process.
|
|
|
|
class CompositorSession {
|
2016-05-23 10:27:01 +03:00
|
|
|
friend class gfx::GPUProcessManager;
|
|
|
|
|
2016-07-01 11:15:16 +03:00
|
|
|
protected:
|
2016-07-18 07:24:28 +03:00
|
|
|
typedef gfx::GPUProcessHost GPUProcessHost;
|
2016-07-01 11:15:16 +03:00
|
|
|
typedef widget::CompositorWidget CompositorWidget;
|
2016-07-01 11:15:16 +03:00
|
|
|
typedef widget::CompositorWidgetDelegate CompositorWidgetDelegate;
|
2016-07-01 11:15:16 +03:00
|
|
|
|
2016-05-18 08:33:22 +03:00
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorSession)
|
|
|
|
|
|
|
|
virtual void Shutdown() = 0;
|
|
|
|
|
|
|
|
// This returns a CompositorBridgeParent if the compositor resides in the same
|
|
|
|
// process.
|
|
|
|
virtual CompositorBridgeParent* GetInProcessBridge() const = 0;
|
|
|
|
|
|
|
|
// Set the GeckoContentController for the root of the layer tree.
|
|
|
|
virtual void SetContentController(GeckoContentController* aController) = 0;
|
|
|
|
|
|
|
|
// Return the Async Pan/Zoom Tree Manager for this compositor.
|
2016-08-29 16:18:00 +03:00
|
|
|
virtual RefPtr<IAPZCTreeManager> GetAPZCTreeManager() const = 0;
|
2016-05-18 08:33:22 +03:00
|
|
|
|
|
|
|
// Return the child end of the compositor IPC bridge.
|
|
|
|
CompositorBridgeChild* GetCompositorBridgeChild();
|
|
|
|
|
2016-07-01 11:15:16 +03:00
|
|
|
// Return the proxy for accessing the compositor's widget.
|
2016-07-01 11:15:16 +03:00
|
|
|
CompositorWidgetDelegate* GetCompositorWidgetDelegate() {
|
|
|
|
return mCompositorWidgetDelegate;
|
2016-07-01 11:15:16 +03:00
|
|
|
}
|
|
|
|
|
2016-07-18 07:24:27 +03:00
|
|
|
// Return the id of the root layer tree.
|
2018-03-25 02:06:01 +03:00
|
|
|
LayersId RootLayerTreeId() const { return mRootLayerTreeId; }
|
2016-07-18 07:24:27 +03:00
|
|
|
|
2017-04-06 01:42:50 +03:00
|
|
|
#if defined(MOZ_WIDGET_ANDROID)
|
|
|
|
// Set the UiCompositorControllerChild after Session creation so the Session
|
|
|
|
// constructor doesn't get mucked up for other platforms.
|
|
|
|
void SetUiCompositorControllerChild(
|
|
|
|
RefPtr<UiCompositorControllerChild> aUiController) {
|
|
|
|
mUiCompositorControllerChild = aUiController;
|
|
|
|
}
|
|
|
|
|
|
|
|
RefPtr<UiCompositorControllerChild> GetUiCompositorControllerChild() {
|
|
|
|
return mUiCompositorControllerChild;
|
|
|
|
}
|
2019-06-19 19:14:56 +03:00
|
|
|
|
|
|
|
void NotifyDisablingWebRender();
|
2017-04-06 01:42:50 +03:00
|
|
|
#endif // defined(MOZ_WIDGET_ANDROID)
|
2016-05-18 08:33:22 +03:00
|
|
|
protected:
|
2019-06-19 19:14:56 +03:00
|
|
|
CompositorSession(nsBaseWidget* aWidget, CompositorWidgetDelegate* aDelegate,
|
2016-07-18 07:24:27 +03:00
|
|
|
CompositorBridgeChild* aChild,
|
2018-03-25 02:06:01 +03:00
|
|
|
const LayersId& aRootLayerTreeId);
|
2016-05-18 08:33:22 +03:00
|
|
|
virtual ~CompositorSession();
|
|
|
|
|
|
|
|
protected:
|
2019-06-19 19:14:56 +03:00
|
|
|
nsBaseWidget* mWidget;
|
2016-07-01 11:15:16 +03:00
|
|
|
CompositorWidgetDelegate* mCompositorWidgetDelegate;
|
2016-07-18 07:24:27 +03:00
|
|
|
RefPtr<CompositorBridgeChild> mCompositorBridgeChild;
|
2018-03-25 02:06:01 +03:00
|
|
|
LayersId mRootLayerTreeId;
|
2017-04-06 01:42:50 +03:00
|
|
|
#if defined(MOZ_WIDGET_ANDROID)
|
|
|
|
RefPtr<UiCompositorControllerChild> mUiCompositorControllerChild;
|
|
|
|
#endif // defined(MOZ_WIDGET_ANDROID)
|
2016-05-18 08:33:22 +03:00
|
|
|
private:
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CompositorSession);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // _include_mozilla_gfx_ipc_CompositorSession_h_
|