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

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

Issue 2776973002: DelegatedFrameHost should not create an ExternalBeginFrameSource (Closed)
Patch Set: c 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
« no previous file with comments | « no previous file | content/browser/renderer_host/browser_compositor_view_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 25 matching lines...) Expand all
36 36
37 // This class owns a DelegatedFrameHost, and will dynamically attach and 37 // This class owns a DelegatedFrameHost, and will dynamically attach and
38 // detach it from a ui::Compositor as needed. The ui::Compositor will be 38 // detach it from a ui::Compositor as needed. The ui::Compositor will be
39 // detached from the DelegatedFrameHost when the following conditions are 39 // detached from the DelegatedFrameHost when the following conditions are
40 // all met: 40 // all met:
41 // - There are no outstanding copy requests 41 // - There are no outstanding copy requests
42 // - The RenderWidgetHostImpl providing frames to the DelegatedFrameHost 42 // - The RenderWidgetHostImpl providing frames to the DelegatedFrameHost
43 // is visible. 43 // is visible.
44 // - The RenderWidgetHostViewMac that is used to display these frames is 44 // - The RenderWidgetHostViewMac that is used to display these frames is
45 // attached to the NSView hierarchy of an NSWindow. 45 // attached to the NSView hierarchy of an NSWindow.
46 class BrowserCompositorMac : public cc::BeginFrameObserver, 46 class BrowserCompositorMac : public DelegatedFrameHostClient {
47 public DelegatedFrameHostClient {
48 public: 47 public:
49 BrowserCompositorMac( 48 BrowserCompositorMac(
50 ui::AcceleratedWidgetMacNSView* accelerated_widget_mac_ns_view, 49 ui::AcceleratedWidgetMacNSView* accelerated_widget_mac_ns_view,
51 BrowserCompositorMacClient* client, 50 BrowserCompositorMacClient* client,
52 bool render_widget_host_is_hidden, 51 bool render_widget_host_is_hidden,
53 bool ns_view_attached_to_window, 52 bool ns_view_attached_to_window,
54 const cc::FrameSinkId& frame_sink_id); 53 const cc::FrameSinkId& frame_sink_id);
55 ~BrowserCompositorMac() override; 54 ~BrowserCompositorMac() override;
56 55
57 // These will not return nullptr until Destroy is called. 56 // These will not return nullptr until Destroy is called.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override; 104 SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override;
106 gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override; 105 gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override;
107 bool DelegatedFrameCanCreateResizeLock() const override; 106 bool DelegatedFrameCanCreateResizeLock() const override;
108 std::unique_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock( 107 std::unique_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock(
109 bool defer_compositor_lock) override; 108 bool defer_compositor_lock) override;
110 void DelegatedFrameHostResizeLockWasReleased() override; 109 void DelegatedFrameHostResizeLockWasReleased() override;
111 void DelegatedFrameHostSendReclaimCompositorResources( 110 void DelegatedFrameHostSendReclaimCompositorResources(
112 int compositor_frame_sink_id, 111 int compositor_frame_sink_id,
113 bool is_swap_ack, 112 bool is_swap_ack,
114 const cc::ReturnedResourceArray& resources) override; 113 const cc::ReturnedResourceArray& resources) override;
115 void SetBeginFrameSource(cc::BeginFrameSource* source) override; 114 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
116 bool IsAutoResizeEnabled() const override; 115 bool IsAutoResizeEnabled() const override;
117 116
118 // cc::BeginFrameObserver implementation.
119 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
120 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override;
121 void OnBeginFrameSourcePausedChanged(bool paused) override;
122
123 private: 117 private:
124 // The state of |delegated_frame_host_| and |recyclable_compositor_| to 118 // The state of |delegated_frame_host_| and |recyclable_compositor_| to
125 // manage being visible, hidden, or occluded. 119 // manage being visible, hidden, or occluded.
126 enum State { 120 enum State {
127 // Effects: 121 // Effects:
128 // - |recyclable_compositor_| exists and is attached to 122 // - |recyclable_compositor_| exists and is attached to
129 // |delegated_frame_host_|. 123 // |delegated_frame_host_|.
130 // Happens when: 124 // Happens when:
131 // - |render_widet_host_| is in the visible state, or there are 125 // - |render_widet_host_| is in the visible state, or there are
132 // outstanding copy requests. 126 // outstanding copy requests.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 166
173 BrowserCompositorMacClient* client_ = nullptr; 167 BrowserCompositorMacClient* client_ = nullptr;
174 ui::AcceleratedWidgetMacNSView* accelerated_widget_mac_ns_view_ = nullptr; 168 ui::AcceleratedWidgetMacNSView* accelerated_widget_mac_ns_view_ = nullptr;
175 std::unique_ptr<RecyclableCompositorMac> recyclable_compositor_; 169 std::unique_ptr<RecyclableCompositorMac> recyclable_compositor_;
176 170
177 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; 171 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_;
178 std::unique_ptr<ui::Layer> root_layer_; 172 std::unique_ptr<ui::Layer> root_layer_;
179 173
180 bool has_transparent_background_ = false; 174 bool has_transparent_background_ = false;
181 175
182 // The begin frame source being observed. Null if none.
183 cc::BeginFrameSource* begin_frame_source_ = nullptr;
184 cc::BeginFrameArgs last_begin_frame_args_;
185 bool needs_begin_frames_ = false;
186
187 base::WeakPtrFactory<BrowserCompositorMac> weak_factory_; 176 base::WeakPtrFactory<BrowserCompositorMac> weak_factory_;
188 }; 177 };
189 178
190 } // namespace content 179 } // namespace content
191 180
192 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_COMPOSITOR_VIEW_MAC_H_ 181 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_COMPOSITOR_VIEW_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/browser_compositor_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698