Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: content/browser/renderer_host/browser_compositor_view_mac.h

Issue 2835403004: Revert "Use MojoCompositorFrameSink in RendererCompositorFrameSink"
Patch Set: Rebased Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 BrowserCompositorMacSendReclaimCompositorResources(
30 bool is_swap_ack,
31 const cc::ReturnedResourceArray& resources) = 0;
29 virtual void BrowserCompositorMacSendBeginFrame( 32 virtual void BrowserCompositorMacSendBeginFrame(
30 const cc::BeginFrameArgs& args) = 0; 33 const cc::BeginFrameArgs& args) = 0;
31 }; 34 };
32 35
33 // This class owns a DelegatedFrameHost, and will dynamically attach and 36 // This class owns a DelegatedFrameHost, and will dynamically attach and
34 // detach it from a ui::Compositor as needed. The ui::Compositor will be 37 // detach it from a ui::Compositor as needed. The ui::Compositor will be
35 // detached from the DelegatedFrameHost when the following conditions are 38 // detached from the DelegatedFrameHost when the following conditions are
36 // all met: 39 // all met:
37 // - There are no outstanding copy requests 40 // - There are no outstanding copy requests
38 // - The RenderWidgetHostImpl providing frames to the DelegatedFrameHost 41 // - The RenderWidgetHostImpl providing frames to the DelegatedFrameHost
(...skipping 10 matching lines...) Expand all
49 const cc::FrameSinkId& frame_sink_id); 52 const cc::FrameSinkId& frame_sink_id);
50 ~BrowserCompositorMac() override; 53 ~BrowserCompositorMac() override;
51 54
52 // These will not return nullptr until Destroy is called. 55 // These will not return nullptr until Destroy is called.
53 DelegatedFrameHost* GetDelegatedFrameHost(); 56 DelegatedFrameHost* GetDelegatedFrameHost();
54 57
55 // This may return nullptr, if this has detached itself from its 58 // This may return nullptr, if this has detached itself from its
56 // ui::Compositor. 59 // ui::Compositor.
57 ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac(); 60 ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac();
58 61
59 void DidCreateNewRendererCompositorFrameSink( 62 void DidCreateNewRendererCompositorFrameSink();
60 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink);
61 void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, 63 void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id,
62 cc::CompositorFrame frame); 64 cc::CompositorFrame frame);
63 void OnBeginFrameDidNotSwap(const cc::BeginFrameAck& ack); 65 void OnBeginFrameDidNotSwap(const cc::BeginFrameAck& ack);
64 void SetHasTransparentBackground(bool transparent); 66 void SetHasTransparentBackground(bool transparent);
65 void SetDisplayColorProfile(const gfx::ICCProfile& icc_profile); 67 void SetDisplayColorProfile(const gfx::ICCProfile& icc_profile);
66 void UpdateVSyncParameters(const base::TimeTicks& timebase, 68 void UpdateVSyncParameters(const base::TimeTicks& timebase,
67 const base::TimeDelta& interval); 69 const base::TimeDelta& interval);
68 void SetNeedsBeginFrames(bool needs_begin_frames); 70 void SetNeedsBeginFrames(bool needs_begin_frames);
69 71
70 // This is used to ensure that the ui::Compositor be attached to the 72 // This is used to ensure that the ui::Compositor be attached to the
(...skipping 25 matching lines...) Expand all
96 static void DisableRecyclingForShutdown(); 98 static void DisableRecyclingForShutdown();
97 99
98 // DelegatedFrameHostClient implementation. 100 // DelegatedFrameHostClient implementation.
99 ui::Layer* DelegatedFrameHostGetLayer() const override; 101 ui::Layer* DelegatedFrameHostGetLayer() const override;
100 bool DelegatedFrameHostIsVisible() const override; 102 bool DelegatedFrameHostIsVisible() const override;
101 SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override; 103 SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override;
102 gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override; 104 gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override;
103 bool DelegatedFrameCanCreateResizeLock() const override; 105 bool DelegatedFrameCanCreateResizeLock() const override;
104 std::unique_ptr<CompositorResizeLock> DelegatedFrameHostCreateResizeLock() 106 std::unique_ptr<CompositorResizeLock> DelegatedFrameHostCreateResizeLock()
105 override; 107 override;
108 void DelegatedFrameHostSendReclaimCompositorResources(
109 bool is_swap_ack,
110 const cc::ReturnedResourceArray& resources) override;
106 void OnBeginFrame(const cc::BeginFrameArgs& args) override; 111 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
107 bool IsAutoResizeEnabled() const override; 112 bool IsAutoResizeEnabled() const override;
108 113
109 private: 114 private:
110 // The state of |delegated_frame_host_| and |recyclable_compositor_| to 115 // The state of |delegated_frame_host_| and |recyclable_compositor_| to
111 // manage being visible, hidden, or occluded. 116 // manage being visible, hidden, or occluded.
112 enum State { 117 enum State {
113 // Effects: 118 // Effects:
114 // - |recyclable_compositor_| exists and is attached to 119 // - |recyclable_compositor_| exists and is attached to
115 // |delegated_frame_host_|. 120 // |delegated_frame_host_|.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 bool ns_view_attached_to_window_ = false; 162 bool ns_view_attached_to_window_ = false;
158 163
159 BrowserCompositorMacClient* client_ = nullptr; 164 BrowserCompositorMacClient* client_ = nullptr;
160 ui::AcceleratedWidgetMacNSView* accelerated_widget_mac_ns_view_ = nullptr; 165 ui::AcceleratedWidgetMacNSView* accelerated_widget_mac_ns_view_ = nullptr;
161 std::unique_ptr<RecyclableCompositorMac> recyclable_compositor_; 166 std::unique_ptr<RecyclableCompositorMac> recyclable_compositor_;
162 167
163 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; 168 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_;
164 std::unique_ptr<ui::Layer> root_layer_; 169 std::unique_ptr<ui::Layer> root_layer_;
165 170
166 bool has_transparent_background_ = false; 171 bool has_transparent_background_ = false;
167 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink_ =
168 nullptr;
169 172
170 base::WeakPtrFactory<BrowserCompositorMac> weak_factory_; 173 base::WeakPtrFactory<BrowserCompositorMac> weak_factory_;
171 }; 174 };
172 175
173 } // namespace content 176 } // namespace content
174 177
175 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_COMPOSITOR_VIEW_MAC_H_ 178 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_COMPOSITOR_VIEW_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698