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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp

Issue 2755463002: [cc] Fix CompositorFrameSinkSupport BeginFrameAck interface. (Closed)
Patch Set: sync Created 3 years, 9 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 | « third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h" 5 #include "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h"
6 6
7 #include "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/quads/texture_draw_quad.h" 8 #include "cc/quads/texture_draw_quad.h"
9 #include "gpu/command_buffer/client/gles2_interface.h" 9 #include "gpu/command_buffer/client/gles2_interface.h"
10 #include "platform/CrossThreadFunctional.h" 10 #include "platform/CrossThreadFunctional.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 called on SwiftShader. */) { 203 called on SwiftShader. */) {
204 if (!image || !verifyImageSize(image->size())) 204 if (!image || !verifyImageSize(image->size()))
205 return; 205 return;
206 if (!m_frameSinkId.is_valid()) { 206 if (!m_frameSinkId.is_valid()) {
207 postImageToPlaceholder(std::move(image)); 207 postImageToPlaceholder(std::move(image));
208 return; 208 return;
209 } 209 }
210 cc::CompositorFrame frame; 210 cc::CompositorFrame frame;
211 // TODO(crbug.com/652931): update the device_scale_factor 211 // TODO(crbug.com/652931): update the device_scale_factor
212 frame.metadata.device_scale_factor = 1.0f; 212 frame.metadata.device_scale_factor = 1.0f;
213 if (m_currentBeginFrameAck.sequence_number ==
214 cc::BeginFrameArgs::kInvalidFrameNumber) {
215 // TODO(eseckler): This shouldn't be necessary when OffscreenCanvas no
216 // longer submits CompositorFrames without prior BeginFrame.
217 m_currentBeginFrameAck = cc::BeginFrameAck::CreateManualAckWithDamage();
218 } else {
219 m_currentBeginFrameAck.has_damage = true;
220 }
221 frame.metadata.begin_frame_ack = m_currentBeginFrameAck;
213 222
214 const gfx::Rect bounds(m_width, m_height); 223 const gfx::Rect bounds(m_width, m_height);
215 const int renderPassId = 1; 224 const int renderPassId = 1;
216 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); 225 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create();
217 pass->SetNew(renderPassId, bounds, bounds, gfx::Transform()); 226 pass->SetNew(renderPassId, bounds, bounds, gfx::Transform());
218 pass->has_transparent_background = false; 227 pass->has_transparent_background = false;
219 228
220 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); 229 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
221 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds, false, 1.f, 230 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds, false, 1.f,
222 SkBlendMode::kSrcOver, 0); 231 SkBlendMode::kSrcOver, 0);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 bool needsBeginFrame) { 395 bool needsBeginFrame) {
387 if (m_sink && needsBeginFrame != m_needsBeginFrame) { 396 if (m_sink && needsBeginFrame != m_needsBeginFrame) {
388 m_needsBeginFrame = needsBeginFrame; 397 m_needsBeginFrame = needsBeginFrame;
389 m_sink->SetNeedsBeginFrame(needsBeginFrame); 398 m_sink->SetNeedsBeginFrame(needsBeginFrame);
390 } 399 }
391 } 400 }
392 401
393 void OffscreenCanvasFrameDispatcherImpl::OnBeginFrame( 402 void OffscreenCanvasFrameDispatcherImpl::OnBeginFrame(
394 const cc::BeginFrameArgs& beginFrameArgs) { 403 const cc::BeginFrameArgs& beginFrameArgs) {
395 DCHECK(client()); 404 DCHECK(client());
405 // TODO(eseckler): Set correct |latest_confirmed_sequence_number|.
406 m_currentBeginFrameAck = cc::BeginFrameAck(
407 beginFrameArgs.source_id, beginFrameArgs.sequence_number,
408 beginFrameArgs.sequence_number, 0, false);
396 client()->beginFrame(); 409 client()->beginFrame();
410 // TODO(eseckler): Tell |m_sink| if we did not draw during the BeginFrame.
411 m_currentBeginFrameAck.sequence_number =
412 cc::BeginFrameArgs::kInvalidFrameNumber;
397 } 413 }
398 414
399 void OffscreenCanvasFrameDispatcherImpl::ReclaimResources( 415 void OffscreenCanvasFrameDispatcherImpl::ReclaimResources(
400 const cc::ReturnedResourceArray& resources) { 416 const cc::ReturnedResourceArray& resources) {
401 for (const auto& resource : resources) { 417 for (const auto& resource : resources) {
402 RefPtr<StaticBitmapImage> image = m_cachedImages.at(resource.id); 418 RefPtr<StaticBitmapImage> image = m_cachedImages.at(resource.id);
403 419
404 if (image) { 420 if (image) {
405 if (image->hasMailbox()) { 421 if (image->hasMailbox()) {
406 image->updateSyncToken(resource.sync_token); 422 image->updateSyncToken(resource.sync_token);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 467
452 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { 468 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) {
453 if (m_width != width || m_height != height) { 469 if (m_width != width || m_height != height) {
454 m_width = width; 470 m_width = width;
455 m_height = height; 471 m_height = height;
456 m_changeSizeForNextCommit = true; 472 m_changeSizeForNextCommit = true;
457 } 473 }
458 } 474 }
459 475
460 } // namespace blink 476 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698