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 28 matching lines...) Expand all Loading... |
39 m_width(width), | 39 m_width(width), |
40 m_height(height), | 40 m_height(height), |
41 m_changeSizeForNextCommit(false), | 41 m_changeSizeForNextCommit(false), |
42 m_needsBeginFrame(false), | 42 m_needsBeginFrame(false), |
43 m_nextResourceId(1u), | 43 m_nextResourceId(1u), |
44 m_binding(this), | 44 m_binding(this), |
45 m_placeholderCanvasId(canvasId) { | 45 m_placeholderCanvasId(canvasId) { |
46 if (m_frameSinkId.is_valid()) { | 46 if (m_frameSinkId.is_valid()) { |
47 // Only frameless canvas pass an invalid frame sink id; we don't create | 47 // Only frameless canvas pass an invalid frame sink id; we don't create |
48 // mojo channel for this special case. | 48 // mojo channel for this special case. |
49 m_currentLocalSurfaceId = m_surfaceIdAllocator.GenerateId(); | 49 m_currentLocalSurfaceId = m_localSurfaceIdAllocator.GenerateId(); |
50 DCHECK(!m_sink.is_bound()); | 50 DCHECK(!m_sink.is_bound()); |
51 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; | 51 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; |
52 Platform::current()->interfaceProvider()->getInterface( | 52 Platform::current()->interfaceProvider()->getInterface( |
53 mojo::MakeRequest(&provider)); | 53 mojo::MakeRequest(&provider)); |
54 provider->CreateCompositorFrameSink(m_frameSinkId, | 54 provider->CreateCompositorFrameSink(m_frameSinkId, |
55 m_binding.CreateInterfacePtrAndBind(), | 55 m_binding.CreateInterfacePtrAndBind(), |
56 mojo::MakeRequest(&m_sink)); | 56 mojo::MakeRequest(&m_sink)); |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 0, 10000000, 50)); | 368 0, 10000000, 50)); |
369 commitSoftwareCanvasSoftwareCompositingWorkerTimer.count(elapsedTime * | 369 commitSoftwareCanvasSoftwareCompositingWorkerTimer.count(elapsedTime * |
370 1000000.0); | 370 1000000.0); |
371 } | 371 } |
372 break; | 372 break; |
373 case OffscreenCanvasCommitTypeCount: | 373 case OffscreenCanvasCommitTypeCount: |
374 NOTREACHED(); | 374 NOTREACHED(); |
375 } | 375 } |
376 | 376 |
377 if (m_changeSizeForNextCommit) { | 377 if (m_changeSizeForNextCommit) { |
378 m_currentLocalSurfaceId = m_surfaceIdAllocator.GenerateId(); | 378 m_currentLocalSurfaceId = m_localSurfaceIdAllocator.GenerateId(); |
379 m_changeSizeForNextCommit = false; | 379 m_changeSizeForNextCommit = false; |
380 } | 380 } |
381 | 381 |
382 m_sink->SubmitCompositorFrame(m_currentLocalSurfaceId, std::move(frame)); | 382 m_sink->SubmitCompositorFrame(m_currentLocalSurfaceId, std::move(frame)); |
383 } | 383 } |
384 | 384 |
385 void OffscreenCanvasFrameDispatcherImpl::DidReceiveCompositorFrameAck() { | 385 void OffscreenCanvasFrameDispatcherImpl::DidReceiveCompositorFrameAck() { |
386 // TODO(fsamuel): Implement this. | 386 // TODO(fsamuel): Implement this. |
387 } | 387 } |
388 | 388 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 441 |
442 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { | 442 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { |
443 if (m_width != width || m_height != height) { | 443 if (m_width != width || m_height != height) { |
444 m_width = width; | 444 m_width = width; |
445 m_height = height; | 445 m_height = height; |
446 m_changeSizeForNextCommit = true; | 446 m_changeSizeForNextCommit = true; |
447 } | 447 } |
448 } | 448 } |
449 | 449 |
450 } // namespace blink | 450 } // namespace blink |
OLD | NEW |