OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 cc::BeginFrameSource* MusBrowserCompositorOutputSurface::GetBeginFrameSource() { | 46 cc::BeginFrameSource* MusBrowserCompositorOutputSurface::GetBeginFrameSource() { |
47 return begin_frame_source_; | 47 return begin_frame_source_; |
48 } | 48 } |
49 | 49 |
50 void MusBrowserCompositorOutputSurface::SwapBuffers( | 50 void MusBrowserCompositorOutputSurface::SwapBuffers( |
51 cc::OutputSurfaceFrame frame) { | 51 cc::OutputSurfaceFrame frame) { |
52 cc::CompositorFrame ui_frame; | 52 cc::CompositorFrame ui_frame; |
53 ui_frame.metadata.device_scale_factor = | 53 ui_frame.metadata.device_scale_factor = |
54 ui::GetScaleFactorForNativeView(window_); | 54 ui::GetScaleFactorForNativeView(window_); |
55 ui_frame.metadata.latency_info = std::move(frame.latency_info); | 55 ui_frame.metadata.latency_info = std::move(frame.latency_info); |
| 56 // TODO(eseckler): Pass on BeginFrameAck from browser compositor via |frame|. |
| 57 ui_frame.metadata.begin_frame_ack = |
| 58 cc::BeginFrameAck(cc::BeginFrameArgs::kManualSourceId, |
| 59 cc::BeginFrameArgs::kStartingFrameNumber, |
| 60 cc::BeginFrameArgs::kStartingFrameNumber, 0, true); |
56 // Reset latency_info to known empty state after moving contents. | 61 // Reset latency_info to known empty state after moving contents. |
57 frame.latency_info.clear(); | 62 frame.latency_info.clear(); |
58 const int render_pass_id = 1; | 63 const int render_pass_id = 1; |
59 const gfx::Rect bounds_in_dip = gfx::Rect(window_->bounds().size()); | 64 const gfx::Rect bounds_in_dip = gfx::Rect(window_->bounds().size()); |
60 const gfx::Rect bounds_in_pixels = gfx::ConvertRectToPixel( | 65 const gfx::Rect bounds_in_pixels = gfx::ConvertRectToPixel( |
61 ui_frame.metadata.device_scale_factor, bounds_in_dip); | 66 ui_frame.metadata.device_scale_factor, bounds_in_dip); |
62 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); | 67 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); |
63 pass->SetNew(render_pass_id, bounds_in_pixels, bounds_in_pixels, | 68 pass->SetNew(render_pass_id, bounds_in_pixels, bounds_in_pixels, |
64 gfx::Transform()); | 69 gfx::Transform()); |
65 // The SharedQuadState is owned by the SharedQuadStateList | 70 // The SharedQuadState is owned by the SharedQuadStateList |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 186 |
182 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId( | 187 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId( |
183 uint32_t id) { | 188 uint32_t id) { |
184 DCHECK_LT(id, mailboxes_.size()); | 189 DCHECK_LT(id, mailboxes_.size()); |
185 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) == | 190 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) == |
186 free_resource_ids_.end()); | 191 free_resource_ids_.end()); |
187 return mailboxes_[id]; | 192 return mailboxes_[id]; |
188 } | 193 } |
189 | 194 |
190 } // namespace content | 195 } // namespace content |
OLD | NEW |