| 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 30 matching lines...) Expand all Loading... |
| 41 int width, | 41 int width, |
| 42 int height) | 42 int height) |
| 43 : OffscreenCanvasFrameDispatcher(client), | 43 : OffscreenCanvasFrameDispatcher(client), |
| 44 m_frameSinkId(cc::FrameSinkId(clientId, sinkId)), | 44 m_frameSinkId(cc::FrameSinkId(clientId, sinkId)), |
| 45 m_width(width), | 45 m_width(width), |
| 46 m_height(height), | 46 m_height(height), |
| 47 m_changeSizeForNextCommit(false), | 47 m_changeSizeForNextCommit(false), |
| 48 m_nextResourceId(1u), | 48 m_nextResourceId(1u), |
| 49 m_binding(this), | 49 m_binding(this), |
| 50 m_placeholderCanvasId(canvasId) { | 50 m_placeholderCanvasId(canvasId) { |
| 51 m_currentLocalFrameId = m_surfaceIdAllocator.GenerateId(); | 51 m_currentLocalSurfaceId = m_surfaceIdAllocator.GenerateId(); |
| 52 DCHECK(!m_sink.is_bound()); | 52 DCHECK(!m_sink.is_bound()); |
| 53 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; | 53 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; |
| 54 Platform::current()->interfaceProvider()->getInterface( | 54 Platform::current()->interfaceProvider()->getInterface( |
| 55 mojo::MakeRequest(&provider)); | 55 mojo::MakeRequest(&provider)); |
| 56 provider->CreateCompositorFrameSink(m_frameSinkId, | 56 provider->CreateCompositorFrameSink(m_frameSinkId, |
| 57 m_binding.CreateInterfacePtrAndBind(), | 57 m_binding.CreateInterfacePtrAndBind(), |
| 58 mojo::MakeRequest(&m_sink)); | 58 mojo::MakeRequest(&m_sink)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 OffscreenCanvasFrameDispatcherImpl::~OffscreenCanvasFrameDispatcherImpl() { | 61 OffscreenCanvasFrameDispatcherImpl::~OffscreenCanvasFrameDispatcherImpl() { |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 0, 10000000, 50)); | 361 0, 10000000, 50)); |
| 362 commitSoftwareCanvasSoftwareCompositingWorkerTimer.count(elapsedTime * | 362 commitSoftwareCanvasSoftwareCompositingWorkerTimer.count(elapsedTime * |
| 363 1000000.0); | 363 1000000.0); |
| 364 } | 364 } |
| 365 break; | 365 break; |
| 366 case OffscreenCanvasCommitTypeCount: | 366 case OffscreenCanvasCommitTypeCount: |
| 367 NOTREACHED(); | 367 NOTREACHED(); |
| 368 } | 368 } |
| 369 | 369 |
| 370 if (m_changeSizeForNextCommit) { | 370 if (m_changeSizeForNextCommit) { |
| 371 m_currentLocalFrameId = m_surfaceIdAllocator.GenerateId(); | 371 m_currentLocalSurfaceId = m_surfaceIdAllocator.GenerateId(); |
| 372 m_changeSizeForNextCommit = false; | 372 m_changeSizeForNextCommit = false; |
| 373 } | 373 } |
| 374 m_sink->SubmitCompositorFrame(m_currentLocalFrameId, std::move(frame)); | 374 m_sink->SubmitCompositorFrame(m_currentLocalSurfaceId, std::move(frame)); |
| 375 | 375 |
| 376 // TODO(crbug.com/674744): Get BeginFrame to fire on its own. | 376 // TODO(crbug.com/674744): Get BeginFrame to fire on its own. |
| 377 scheduleSyntheticBeginFrame(); | 377 scheduleSyntheticBeginFrame(); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void OffscreenCanvasFrameDispatcherImpl::scheduleSyntheticBeginFrame() { | 380 void OffscreenCanvasFrameDispatcherImpl::scheduleSyntheticBeginFrame() { |
| 381 m_syntheticBeginFrameTask = | 381 m_syntheticBeginFrameTask = |
| 382 Platform::current() | 382 Platform::current() |
| 383 ->currentThread() | 383 ->currentThread() |
| 384 ->getWebTaskRunner() | 384 ->getWebTaskRunner() |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 450 |
| 451 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { | 451 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { |
| 452 if (m_width != width || m_height != height) { | 452 if (m_width != width || m_height != height) { |
| 453 m_width = width; | 453 m_width = width; |
| 454 m_height = height; | 454 m_height = height; |
| 455 m_changeSizeForNextCommit = true; | 455 m_changeSizeForNextCommit = true; |
| 456 } | 456 } |
| 457 } | 457 } |
| 458 | 458 |
| 459 } // namespace blink | 459 } // namespace blink |
| OLD | NEW |