| 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 "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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 void OffscreenCanvasFrameDispatcherImpl::OnBeginFrame( | 393 void OffscreenCanvasFrameDispatcherImpl::OnBeginFrame( |
| 394 const cc::BeginFrameArgs& beginFrameArgs) { | 394 const cc::BeginFrameArgs& beginFrameArgs) { |
| 395 DCHECK(client()); | 395 DCHECK(client()); |
| 396 client()->beginFrame(); | 396 client()->beginFrame(); |
| 397 } | 397 } |
| 398 | 398 |
| 399 void OffscreenCanvasFrameDispatcherImpl::ReclaimResources( | 399 void OffscreenCanvasFrameDispatcherImpl::ReclaimResources( |
| 400 const cc::ReturnedResourceArray& resources) { | 400 const cc::ReturnedResourceArray& resources) { |
| 401 for (const auto& resource : resources) { | 401 for (const auto& resource : resources) { |
| 402 RefPtr<StaticBitmapImage> image = m_cachedImages.at(resource.id); | 402 RefPtr<StaticBitmapImage> image = m_cachedImages.at(resource.id); |
| 403 if (image) | 403 |
| 404 image->updateSyncToken(resource.sync_token); | 404 if (image) { |
| 405 if (image->hasMailbox()) { |
| 406 image->updateSyncToken(resource.sync_token); |
| 407 } else if (SharedGpuContext::isValid() && resource.sync_token.HasData()) { |
| 408 // Although image has MailboxTextureHolder at the time when it is |
| 409 // inserted to m_cachedImages, the |
| 410 // OffscreenCanvasPlaceHolder::placeholderFrame() exposes this image to |
| 411 // everyone accessing the placeholder canvas as an image source, some of |
| 412 // which may want to consume the image as a SkImage, thereby converting |
| 413 // the MailTextureHolder to a SkiaTextureHolder. In this case, we |
| 414 // need to wait for the new sync token passed by CompositorFrameSink. |
| 415 SharedGpuContext::gl()->WaitSyncTokenCHROMIUM( |
| 416 resource.sync_token.GetConstData()); |
| 417 } |
| 418 } |
| 405 reclaimResource(resource.id); | 419 reclaimResource(resource.id); |
| 406 } | 420 } |
| 407 } | 421 } |
| 408 | 422 |
| 409 void OffscreenCanvasFrameDispatcherImpl::WillDrawSurface( | 423 void OffscreenCanvasFrameDispatcherImpl::WillDrawSurface( |
| 410 const cc::LocalSurfaceId& localSurfaceId, | 424 const cc::LocalSurfaceId& localSurfaceId, |
| 411 ::gfx::mojom::blink::RectPtr damageRect) { | 425 ::gfx::mojom::blink::RectPtr damageRect) { |
| 412 // TODO(fsamuel, staraz): Implement this. | 426 // TODO(fsamuel, staraz): Implement this. |
| 413 } | 427 } |
| 414 | 428 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 437 | 451 |
| 438 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { | 452 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { |
| 439 if (m_width != width || m_height != height) { | 453 if (m_width != width || m_height != height) { |
| 440 m_width = width; | 454 m_width = width; |
| 441 m_height = height; | 455 m_height = height; |
| 442 m_changeSizeForNextCommit = true; | 456 m_changeSizeForNextCommit = true; |
| 443 } | 457 } |
| 444 } | 458 } |
| 445 | 459 |
| 446 } // namespace blink | 460 } // namespace blink |
| OLD | NEW |