Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=99: */
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/. */
6 : #ifndef _include_mozilla_gfx_ipc_CompositorSession_h_
7 : #define _include_mozilla_gfx_ipc_CompositorSession_h_
8 :
9 : #include "base/basictypes.h"
10 : #include "mozilla/layers/LayersTypes.h"
11 : #include "mozilla/layers/CompositorTypes.h"
12 : #include "nsISupportsImpl.h"
13 : #if defined(MOZ_WIDGET_ANDROID)
14 : #include "mozilla/layers/UiCompositorControllerChild.h"
15 : #endif // defined(MOZ_WIDGET_ANDROID)
16 :
17 : class nsIWidget;
18 :
19 : namespace mozilla {
20 : namespace widget {
21 : class CompositorWidget;
22 : class CompositorWidgetDelegate;
23 : } // namespace widget
24 : namespace gfx {
25 : class GPUProcessHost;
26 : class GPUProcessManager;
27 : } // namespace gfx
28 : namespace layers {
29 :
30 : class GeckoContentController;
31 : class IAPZCTreeManager;
32 : class CompositorBridgeParent;
33 : class CompositorBridgeChild;
34 : class ClientLayerManager;
35 :
36 : // A CompositorSession provides access to a compositor without exposing whether
37 : // or not it's in-process or out-of-process.
38 : class CompositorSession
39 : {
40 : friend class gfx::GPUProcessManager;
41 :
42 : protected:
43 : typedef gfx::GPUProcessHost GPUProcessHost;
44 : typedef widget::CompositorWidget CompositorWidget;
45 : typedef widget::CompositorWidgetDelegate CompositorWidgetDelegate;
46 :
47 : public:
48 4 : NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorSession)
49 :
50 : virtual void Shutdown() = 0;
51 :
52 : // This returns a CompositorBridgeParent if the compositor resides in the same process.
53 : virtual CompositorBridgeParent* GetInProcessBridge() const = 0;
54 :
55 : // Set the GeckoContentController for the root of the layer tree.
56 : virtual void SetContentController(GeckoContentController* aController) = 0;
57 :
58 : // Return the Async Pan/Zoom Tree Manager for this compositor.
59 : virtual RefPtr<IAPZCTreeManager> GetAPZCTreeManager() const = 0;
60 :
61 : // Return the child end of the compositor IPC bridge.
62 : CompositorBridgeChild* GetCompositorBridgeChild();
63 :
64 : // Return the proxy for accessing the compositor's widget.
65 1 : CompositorWidgetDelegate* GetCompositorWidgetDelegate() {
66 1 : return mCompositorWidgetDelegate;
67 : }
68 :
69 : // Return the id of the root layer tree.
70 6 : uint64_t RootLayerTreeId() const {
71 6 : return mRootLayerTreeId;
72 : }
73 :
74 : #if defined(MOZ_WIDGET_ANDROID)
75 : // Set the UiCompositorControllerChild after Session creation so the Session constructor
76 : // doesn't get mucked up for other platforms.
77 : void SetUiCompositorControllerChild(RefPtr<UiCompositorControllerChild> aUiController) {
78 : mUiCompositorControllerChild = aUiController;
79 : }
80 :
81 : RefPtr<UiCompositorControllerChild> GetUiCompositorControllerChild() {
82 : return mUiCompositorControllerChild;
83 : }
84 : #endif // defined(MOZ_WIDGET_ANDROID)
85 : protected:
86 : CompositorSession(CompositorWidgetDelegate* aDelegate,
87 : CompositorBridgeChild* aChild,
88 : const uint64_t& aRootLayerTreeId);
89 : virtual ~CompositorSession();
90 :
91 : protected:
92 : CompositorWidgetDelegate* mCompositorWidgetDelegate;
93 : RefPtr<CompositorBridgeChild> mCompositorBridgeChild;
94 : uint64_t mRootLayerTreeId;
95 : #if defined(MOZ_WIDGET_ANDROID)
96 : RefPtr<UiCompositorControllerChild> mUiCompositorControllerChild;
97 : #endif // defined(MOZ_WIDGET_ANDROID)
98 : private:
99 : DISALLOW_COPY_AND_ASSIGN(CompositorSession);
100 : };
101 :
102 : } // namespace layers
103 : } // namespace mozilla
104 :
105 : #endif // _include_mozilla_gfx_ipc_CompositorSession_h_
|