Chromium Code Reviews| 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 void OffscreenCanvasFrameDispatcherImpl::OnBeginFrame( | 397 void OffscreenCanvasFrameDispatcherImpl::OnBeginFrame( |
| 398 const cc::BeginFrameArgs& beginFrameArgs) { | 398 const cc::BeginFrameArgs& beginFrameArgs) { |
| 399 DCHECK(client()); | 399 DCHECK(client()); |
| 400 client()->beginFrame(); | 400 client()->beginFrame(); |
| 401 } | 401 } |
| 402 | 402 |
| 403 void OffscreenCanvasFrameDispatcherImpl::ReclaimResources( | 403 void OffscreenCanvasFrameDispatcherImpl::ReclaimResources( |
| 404 const cc::ReturnedResourceArray& resources) { | 404 const cc::ReturnedResourceArray& resources) { |
| 405 for (const auto& resource : resources) { | 405 for (const auto& resource : resources) { |
| 406 RefPtr<StaticBitmapImage> image = m_cachedImages.at(resource.id); | 406 RefPtr<StaticBitmapImage> image = m_cachedImages.at(resource.id); |
| 407 if (image) | 407 // Although image has MailboxTextureHolder at the time when it is |
| 408 // inserted to m_cachedImages, the | |
| 409 // OffscreenCanvasPlaceHolder::placeholderFrame() exposes this image to | |
| 410 // everyone accessing the placeholder canvas as an image source, some of | |
| 411 // which may want to consume the image as a SkImage, thereby converting | |
| 412 // the MailTextureHolder to a SkiaTextureHolder. So we must double check | |
| 413 // image->hasMailBox() here. | |
| 414 if (image && image->hasMailbox()) | |
|
Justin Novosad
2017/03/10 18:41:36
I don't think this is the right thing to do. I th
| |
| 408 image->updateSyncToken(resource.sync_token); | 415 image->updateSyncToken(resource.sync_token); |
| 409 reclaimResource(resource.id); | 416 reclaimResource(resource.id); |
| 410 } | 417 } |
| 411 } | 418 } |
| 412 | 419 |
| 413 void OffscreenCanvasFrameDispatcherImpl::WillDrawSurface( | 420 void OffscreenCanvasFrameDispatcherImpl::WillDrawSurface( |
| 414 const cc::LocalSurfaceId& localSurfaceId, | 421 const cc::LocalSurfaceId& localSurfaceId, |
| 415 ::gfx::mojom::blink::RectPtr damageRect) { | 422 ::gfx::mojom::blink::RectPtr damageRect) { |
| 416 // TODO(fsamuel, staraz): Implement this. | 423 // TODO(fsamuel, staraz): Implement this. |
| 417 } | 424 } |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 441 | 448 |
| 442 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { | 449 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { |
| 443 if (m_width != width || m_height != height) { | 450 if (m_width != width || m_height != height) { |
| 444 m_width = width; | 451 m_width = width; |
| 445 m_height = height; | 452 m_height = height; |
| 446 m_changeSizeForNextCommit = true; | 453 m_changeSizeForNextCommit = true; |
| 447 } | 454 } |
| 448 } | 455 } |
| 449 | 456 |
| 450 } // namespace blink | 457 } // namespace blink |
| OLD | NEW |