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

Side by Side Diff: cc/output/delegating_renderer.cc

Issue 16304003: Unified OutputSurface::SwapBuffers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to 205473 Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/output/delegating_renderer.h ('k') | cc/output/gl_frame_data.h » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "cc/output/delegating_renderer.h" 5 #include "cc/output/delegating_renderer.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 output_surface_(output_surface), 46 output_surface_(output_surface),
47 resource_provider_(resource_provider), 47 resource_provider_(resource_provider),
48 visible_(true) { 48 visible_(true) {
49 DCHECK(resource_provider_); 49 DCHECK(resource_provider_);
50 } 50 }
51 51
52 bool DelegatingRenderer::Initialize() { 52 bool DelegatingRenderer::Initialize() {
53 capabilities_.using_partial_swap = false; 53 capabilities_.using_partial_swap = false;
54 // TODO(danakj): Throttling - we may want to only allow 1 outstanding frame, 54 // TODO(danakj): Throttling - we may want to only allow 1 outstanding frame,
55 // but the parent compositor may pipeline for us. 55 // but the parent compositor may pipeline for us.
56 // TODO(danakj): Can we use this in single-thread mode?
57 capabilities_.using_swap_complete_callback = true;
58 capabilities_.max_texture_size = resource_provider_->max_texture_size(); 56 capabilities_.max_texture_size = resource_provider_->max_texture_size();
59 capabilities_.best_texture_format = resource_provider_->best_texture_format(); 57 capabilities_.best_texture_format = resource_provider_->best_texture_format();
60 capabilities_.allow_partial_texture_updates = false; 58 capabilities_.allow_partial_texture_updates = false;
61 capabilities_.using_offscreen_context3d = false; 59 capabilities_.using_offscreen_context3d = false;
62 60
63 WebGraphicsContext3D* context3d = resource_provider_->GraphicsContext3D(); 61 WebGraphicsContext3D* context3d = resource_provider_->GraphicsContext3D();
64 62
65 if (!context3d) { 63 if (!context3d) {
66 // Software compositing. 64 // Software compositing.
67 return true; 65 return true;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 DrawQuad::ResourceIteratorCallback append_to_array = 147 DrawQuad::ResourceIteratorCallback append_to_array =
150 base::Bind(&AppendToArray, &resources); 148 base::Bind(&AppendToArray, &resources);
151 for (size_t i = 0; i < out_data.render_pass_list.size(); ++i) { 149 for (size_t i = 0; i < out_data.render_pass_list.size(); ++i) {
152 RenderPass* render_pass = out_data.render_pass_list.at(i); 150 RenderPass* render_pass = out_data.render_pass_list.at(i);
153 for (size_t j = 0; j < render_pass->quad_list.size(); ++j) 151 for (size_t j = 0; j < render_pass->quad_list.size(); ++j)
154 render_pass->quad_list[j]->IterateResources(append_to_array); 152 render_pass->quad_list[j]->IterateResources(append_to_array);
155 } 153 }
156 resource_provider_->PrepareSendToParent(resources, &out_data.resource_list); 154 resource_provider_->PrepareSendToParent(resources, &out_data.resource_list);
157 } 155 }
158 156
159 void DelegatingRenderer::SwapBuffers(const ui::LatencyInfo& latency_info) { 157 void DelegatingRenderer::SwapBuffers() {
160 TRACE_EVENT0("cc", "DelegatingRenderer::SwapBuffers"); 158 TRACE_EVENT0("cc", "DelegatingRenderer::SwapBuffers");
161 159
162 output_surface_->SendFrameToParentCompositor(&frame_for_swap_buffers_); 160 output_surface_->SwapBuffers(&frame_for_swap_buffers_);
163 frame_for_swap_buffers_.delegated_frame_data.reset(); 161 frame_for_swap_buffers_.delegated_frame_data.reset();
164 } 162 }
165 163
166 void DelegatingRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) { 164 void DelegatingRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) {
167 NOTREACHED(); 165 NOTREACHED();
168 } 166 }
169 167
170 void DelegatingRenderer::ReceiveCompositorFrameAck( 168 void DelegatingRenderer::ReceiveSwapBuffersAck(
171 const CompositorFrameAck& ack) { 169 const CompositorFrameAck& ack) {
172 resource_provider_->ReceiveFromParent(ack.resources); 170 resource_provider_->ReceiveFromParent(ack.resources);
173 } 171 }
174 172
175 173
176 bool DelegatingRenderer::IsContextLost() { 174 bool DelegatingRenderer::IsContextLost() {
177 WebGraphicsContext3D* context3d = resource_provider_->GraphicsContext3D(); 175 WebGraphicsContext3D* context3d = resource_provider_->GraphicsContext3D();
178 if (!context3d) 176 if (!context3d)
179 return false; 177 return false;
180 return context3d->getGraphicsResetStatusARB() != GL_NO_ERROR; 178 return context3d->getGraphicsResetStatusARB() != GL_NO_ERROR;
181 } 179 }
182 180
183 void DelegatingRenderer::SetVisible(bool visible) { 181 void DelegatingRenderer::SetVisible(bool visible) {
184 visible_ = visible; 182 visible_ = visible;
185 } 183 }
186 184
187 } // namespace cc 185 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/delegating_renderer.h ('k') | cc/output/gl_frame_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698