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

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

Issue 2449853004: Getting rid of DelegatedFrameData (Closed)
Patch Set: IsEmpty + rebase Created 4 years, 1 month 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 27 matching lines...) Expand all
38 38
39 MusBrowserCompositorOutputSurface::~MusBrowserCompositorOutputSurface() {} 39 MusBrowserCompositorOutputSurface::~MusBrowserCompositorOutputSurface() {}
40 40
41 void MusBrowserCompositorOutputSurface::SwapBuffers( 41 void MusBrowserCompositorOutputSurface::SwapBuffers(
42 cc::OutputSurfaceFrame frame) { 42 cc::OutputSurfaceFrame frame) {
43 const gfx::Rect bounds(ui_window_->bounds().size()); 43 const gfx::Rect bounds(ui_window_->bounds().size());
44 cc::CompositorFrame ui_frame; 44 cc::CompositorFrame ui_frame;
45 ui_frame.metadata.latency_info = std::move(frame.latency_info); 45 ui_frame.metadata.latency_info = std::move(frame.latency_info);
46 // Reset latency_info to known empty state after moving contents. 46 // Reset latency_info to known empty state after moving contents.
47 frame.latency_info.clear(); 47 frame.latency_info.clear();
48 ui_frame.delegated_frame_data = base::MakeUnique<cc::DelegatedFrameData>();
49 const cc::RenderPassId render_pass_id(1, 1); 48 const cc::RenderPassId render_pass_id(1, 1);
50 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); 49 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create();
51 const bool has_transparent_background = true; 50 const bool has_transparent_background = true;
52 pass->SetAll(render_pass_id, bounds, bounds, gfx::Transform(), 51 pass->SetAll(render_pass_id, bounds, bounds, gfx::Transform(),
53 has_transparent_background); 52 has_transparent_background);
54 // The SharedQuadState is owned by the SharedQuadStateList 53 // The SharedQuadState is owned by the SharedQuadStateList
55 // shared_quad_state_list. 54 // shared_quad_state_list.
56 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); 55 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
57 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds, 56 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds,
58 false /* is_clipped */, 1.f /* opacity */, SkXfermode::kSrc_Mode, 57 false /* is_clipped */, 1.f /* opacity */, SkXfermode::kSrc_Mode,
(...skipping 20 matching lines...) Expand all
79 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); 78 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM();
80 gl->ShallowFlushCHROMIUM(); 79 gl->ShallowFlushCHROMIUM();
81 gpu::SyncToken sync_token; 80 gpu::SyncToken sync_token;
82 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); 81 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
83 82
84 resource.mailbox_holder = 83 resource.mailbox_holder =
85 gpu::MailboxHolder(mailbox, sync_token, GL_TEXTURE_2D); 84 gpu::MailboxHolder(mailbox, sync_token, GL_TEXTURE_2D);
86 resource.read_lock_fences_enabled = false; 85 resource.read_lock_fences_enabled = false;
87 resource.is_software = false; 86 resource.is_software = false;
88 resource.is_overlay_candidate = false; 87 resource.is_overlay_candidate = false;
89 ui_frame.delegated_frame_data->resource_list.push_back(std::move(resource)); 88 ui_frame.resource_list.push_back(std::move(resource));
90 89
91 const bool needs_blending = true; 90 const bool needs_blending = true;
92 const bool premultiplied_alpha = true; 91 const bool premultiplied_alpha = true;
93 const gfx::PointF uv_top_left(0.f, 0.f); 92 const gfx::PointF uv_top_left(0.f, 0.f);
94 const gfx::PointF uv_bottom_right(1.f, 1.f); 93 const gfx::PointF uv_bottom_right(1.f, 1.f);
95 const uint32_t background_color = 0x00000000; 94 const uint32_t background_color = 0x00000000;
96 const float vertex_opacity[4] = {1.f, 1.f, 1.f, 1.f}; 95 const float vertex_opacity[4] = {1.f, 1.f, 1.f, 1.f};
97 const bool y_flipped = true; 96 const bool y_flipped = true;
98 const bool nearest_neighbor = false; 97 const bool nearest_neighbor = false;
99 const bool secure_output_only = false; 98 const bool secure_output_only = false;
100 99
101 cc::TextureDrawQuad* quad = 100 cc::TextureDrawQuad* quad =
102 pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); 101 pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>();
103 quad->SetAll(sqs, rect, rect, rect, needs_blending, resource.id, gfx::Size(), 102 quad->SetAll(sqs, rect, rect, rect, needs_blending, resource.id, gfx::Size(),
104 premultiplied_alpha, uv_top_left, uv_bottom_right, 103 premultiplied_alpha, uv_top_left, uv_bottom_right,
105 background_color, vertex_opacity, y_flipped, nearest_neighbor, 104 background_color, vertex_opacity, y_flipped, nearest_neighbor,
106 secure_output_only); 105 secure_output_only);
107 106
108 ui_frame.delegated_frame_data->render_pass_list.push_back(std::move(pass)); 107 ui_frame.render_pass_list.push_back(std::move(pass));
109 ui_compositor_frame_sink_->SubmitCompositorFrame(std::move(ui_frame)); 108 ui_compositor_frame_sink_->SubmitCompositorFrame(std::move(ui_frame));
110 return; 109 return;
111 } 110 }
112 111
113 void MusBrowserCompositorOutputSurface::SetBeginFrameSource( 112 void MusBrowserCompositorOutputSurface::SetBeginFrameSource(
114 cc::BeginFrameSource* source) {} 113 cc::BeginFrameSource* source) {}
115 114
116 void MusBrowserCompositorOutputSurface::ReclaimResources( 115 void MusBrowserCompositorOutputSurface::ReclaimResources(
117 const cc::ReturnedResourceArray& resources) { 116 const cc::ReturnedResourceArray& resources) {
118 for (const auto& resource : resources) { 117 for (const auto& resource : resources) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 167
169 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId( 168 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId(
170 uint32_t id) { 169 uint32_t id) {
171 DCHECK_LT(id, mailboxes_.size()); 170 DCHECK_LT(id, mailboxes_.size());
172 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) == 171 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) ==
173 free_resource_ids_.end()); 172 free_resource_ids_.end());
174 return mailboxes_[id]; 173 return mailboxes_[id];
175 } 174 }
176 175
177 } // namespace content 176 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698