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

Side by Side Diff: content/browser/compositor/mus_browser_compositor_output_surface.cc

Issue 2527283003: cc: Introduce BeginFrame sequence numbers and acknowledgements.
Patch Set: Address Brian's comments. Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "content/browser/compositor/mus_browser_compositor_output_surface.h" 5 #include "content/browser/compositor/mus_browser_compositor_output_surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/output/output_surface_frame.h" 10 #include "cc/output/output_surface_frame.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 aura::WindowPortMus* window_port = aura::WindowPortMus::Get(window_); 53 aura::WindowPortMus* window_port = aura::WindowPortMus::Get(window_);
54 DCHECK(window_port); 54 DCHECK(window_port);
55 compositor_frame_sink_ = window_port->RequestCompositorFrameSink( 55 compositor_frame_sink_ = window_port->RequestCompositorFrameSink(
56 ui::mojom::CompositorFrameSinkType::DEFAULT, context, 56 ui::mojom::CompositorFrameSinkType::DEFAULT, context,
57 gpu_memory_buffer_manager); 57 gpu_memory_buffer_manager);
58 compositor_frame_sink_->BindToClient(this); 58 compositor_frame_sink_->BindToClient(this);
59 } 59 }
60 60
61 MusBrowserCompositorOutputSurface::~MusBrowserCompositorOutputSurface() {} 61 MusBrowserCompositorOutputSurface::~MusBrowserCompositorOutputSurface() {}
62 62
63 cc::BeginFrameSource* MusBrowserCompositorOutputSurface::GetBeginFrameSource() {
64 return begin_frame_source_;
65 }
66
63 void MusBrowserCompositorOutputSurface::SwapBuffers( 67 void MusBrowserCompositorOutputSurface::SwapBuffers(
64 cc::OutputSurfaceFrame frame) { 68 cc::OutputSurfaceFrame frame) {
65 const gfx::Rect bounds = ui_window_ ? gfx::Rect(ui_window_->bounds().size()) 69 const gfx::Rect bounds = ui_window_ ? gfx::Rect(ui_window_->bounds().size())
66 : gfx::Rect(window_->bounds().size()); 70 : gfx::Rect(window_->bounds().size());
67 cc::CompositorFrame ui_frame; 71 cc::CompositorFrame ui_frame;
72 ui_frame.metadata.begin_frame_source_id = frame.begin_frame_source_id;
73 ui_frame.metadata.begin_frame_number = frame.begin_frame_number;
74 ui_frame.metadata.latest_confirmed_frame = frame.latest_confirmed_frame;
68 ui_frame.metadata.latency_info = std::move(frame.latency_info); 75 ui_frame.metadata.latency_info = std::move(frame.latency_info);
69 // Reset latency_info to known empty state after moving contents. 76 // Reset latency_info to known empty state after moving contents.
70 frame.latency_info.clear(); 77 frame.latency_info.clear();
71 const int render_pass_id = 1; 78 const int render_pass_id = 1;
72 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); 79 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create();
73 const bool has_transparent_background = true; 80 const bool has_transparent_background = true;
74 pass->SetAll(render_pass_id, bounds, bounds, gfx::Transform(), 81 pass->SetAll(render_pass_id, bounds, bounds, gfx::Transform(),
75 has_transparent_background); 82 has_transparent_background);
76 // The SharedQuadState is owned by the SharedQuadStateList 83 // The SharedQuadState is owned by the SharedQuadStateList
77 // shared_quad_state_list. 84 // shared_quad_state_list.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // TODO(mfomitchev): Remove ui_compositor_frame_sink_ once we complete the 139 // TODO(mfomitchev): Remove ui_compositor_frame_sink_ once we complete the
133 // switch to Aura-Mus. 140 // switch to Aura-Mus.
134 if (ui_compositor_frame_sink_) 141 if (ui_compositor_frame_sink_)
135 ui_compositor_frame_sink_->SubmitCompositorFrame(std::move(ui_frame)); 142 ui_compositor_frame_sink_->SubmitCompositorFrame(std::move(ui_frame));
136 else 143 else
137 compositor_frame_sink_->SubmitCompositorFrame(std::move(ui_frame)); 144 compositor_frame_sink_->SubmitCompositorFrame(std::move(ui_frame));
138 return; 145 return;
139 } 146 }
140 147
141 void MusBrowserCompositorOutputSurface::SetBeginFrameSource( 148 void MusBrowserCompositorOutputSurface::SetBeginFrameSource(
142 cc::BeginFrameSource* source) {} 149 cc::BeginFrameSource* source) {
150 begin_frame_source_ = source;
151 }
143 152
144 void MusBrowserCompositorOutputSurface::ReclaimResources( 153 void MusBrowserCompositorOutputSurface::ReclaimResources(
145 const cc::ReturnedResourceArray& resources) { 154 const cc::ReturnedResourceArray& resources) {
146 for (const auto& resource : resources) { 155 for (const auto& resource : resources) {
147 DCHECK_EQ(1, resource.count); 156 DCHECK_EQ(1, resource.count);
148 const gpu::Mailbox& mailbox = GetMailboxFromResourceId(resource.id); 157 const gpu::Mailbox& mailbox = GetMailboxFromResourceId(resource.id);
149 GetCommandBufferProxy()->ReturnFrontBuffer(mailbox, resource.sync_token, 158 GetCommandBufferProxy()->ReturnFrontBuffer(mailbox, resource.sync_token,
150 resource.lost); 159 resource.lost);
151 FreeResourceId(resource.id); 160 FreeResourceId(resource.id);
152 } 161 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 205
197 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId( 206 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId(
198 uint32_t id) { 207 uint32_t id) {
199 DCHECK_LT(id, mailboxes_.size()); 208 DCHECK_LT(id, mailboxes_.size());
200 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) == 209 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) ==
201 free_resource_ids_.end()); 210 free_resource_ids_.end());
202 return mailboxes_[id]; 211 return mailboxes_[id];
203 } 212 }
204 213
205 } // namespace content 214 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698