OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BROWSER_COMPOSITOR_VIEW_MAC_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BROWSER_COMPOSITOR_VIEW_MAC_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_BROWSER_COMPOSITOR_VIEW_MAC_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_BROWSER_COMPOSITOR_VIEW_MAC_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "cc/scheduler/begin_frame_source.h" | 11 #include "cc/scheduler/begin_frame_source.h" |
12 #include "content/browser/renderer_host/delegated_frame_host.h" | 12 #include "content/browser/renderer_host/delegated_frame_host.h" |
13 #include "ui/compositor/compositor.h" | 13 #include "ui/compositor/compositor.h" |
14 #include "ui/compositor/compositor_observer.h" | 14 #include "ui/compositor/compositor_observer.h" |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 class AcceleratedWidgetMac; | 17 class AcceleratedWidgetMac; |
18 class AcceleratedWidgetMacNSView; | 18 class AcceleratedWidgetMacNSView; |
19 } | 19 } |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 class RecyclableCompositorMac; | 23 class RecyclableCompositorMac; |
24 | 24 |
25 class BrowserCompositorMacClient { | 25 class BrowserCompositorMacClient { |
26 public: | 26 public: |
27 virtual NSView* BrowserCompositorMacGetNSView() const = 0; | 27 virtual NSView* BrowserCompositorMacGetNSView() const = 0; |
28 virtual SkColor BrowserCompositorMacGetGutterColor(SkColor color) const = 0; | 28 virtual SkColor BrowserCompositorMacGetGutterColor(SkColor color) const = 0; |
29 virtual void BrowserCompositorMacSendBeginFrame( | 29 virtual void BrowserCompositorMacOnBeginFrame() = 0; |
30 const cc::BeginFrameArgs& args) = 0; | |
31 }; | 30 }; |
32 | 31 |
33 // This class owns a DelegatedFrameHost, and will dynamically attach and | 32 // This class owns a DelegatedFrameHost, and will dynamically attach and |
34 // detach it from a ui::Compositor as needed. The ui::Compositor will be | 33 // detach it from a ui::Compositor as needed. The ui::Compositor will be |
35 // detached from the DelegatedFrameHost when the following conditions are | 34 // detached from the DelegatedFrameHost when the following conditions are |
36 // all met: | 35 // all met: |
37 // - There are no outstanding copy requests | 36 // - There are no outstanding copy requests |
38 // - The RenderWidgetHostImpl providing frames to the DelegatedFrameHost | 37 // - The RenderWidgetHostImpl providing frames to the DelegatedFrameHost |
39 // is visible. | 38 // is visible. |
40 // - The RenderWidgetHostViewMac that is used to display these frames is | 39 // - The RenderWidgetHostViewMac that is used to display these frames is |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 static void DisableRecyclingForShutdown(); | 95 static void DisableRecyclingForShutdown(); |
97 | 96 |
98 // DelegatedFrameHostClient implementation. | 97 // DelegatedFrameHostClient implementation. |
99 ui::Layer* DelegatedFrameHostGetLayer() const override; | 98 ui::Layer* DelegatedFrameHostGetLayer() const override; |
100 bool DelegatedFrameHostIsVisible() const override; | 99 bool DelegatedFrameHostIsVisible() const override; |
101 SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override; | 100 SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override; |
102 gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override; | 101 gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override; |
103 bool DelegatedFrameCanCreateResizeLock() const override; | 102 bool DelegatedFrameCanCreateResizeLock() const override; |
104 std::unique_ptr<CompositorResizeLock> DelegatedFrameHostCreateResizeLock() | 103 std::unique_ptr<CompositorResizeLock> DelegatedFrameHostCreateResizeLock() |
105 override; | 104 override; |
106 void OnBeginFrame(const cc::BeginFrameArgs& args) override; | 105 void OnBeginFrame() override; |
107 bool IsAutoResizeEnabled() const override; | 106 bool IsAutoResizeEnabled() const override; |
108 | 107 |
109 private: | 108 private: |
110 // The state of |delegated_frame_host_| and |recyclable_compositor_| to | 109 // The state of |delegated_frame_host_| and |recyclable_compositor_| to |
111 // manage being visible, hidden, or occluded. | 110 // manage being visible, hidden, or occluded. |
112 enum State { | 111 enum State { |
113 // Effects: | 112 // Effects: |
114 // - |recyclable_compositor_| exists and is attached to | 113 // - |recyclable_compositor_| exists and is attached to |
115 // |delegated_frame_host_|. | 114 // |delegated_frame_host_|. |
116 // Happens when: | 115 // Happens when: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 bool has_transparent_background_ = false; | 165 bool has_transparent_background_ = false; |
167 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink_ = | 166 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink_ = |
168 nullptr; | 167 nullptr; |
169 | 168 |
170 base::WeakPtrFactory<BrowserCompositorMac> weak_factory_; | 169 base::WeakPtrFactory<BrowserCompositorMac> weak_factory_; |
171 }; | 170 }; |
172 | 171 |
173 } // namespace content | 172 } // namespace content |
174 | 173 |
175 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_COMPOSITOR_VIEW_MAC_H_ | 174 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_COMPOSITOR_VIEW_MAC_H_ |
OLD | NEW |