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 12 matching lines...) Expand all Loading... |
23 #include "ui/gfx/geometry/rect.h" | 23 #include "ui/gfx/geometry/rect.h" |
24 #include "ui/gfx/transform.h" | 24 #include "ui/gfx/transform.h" |
25 #include "wtf/typed_arrays/ArrayBuffer.h" | 25 #include "wtf/typed_arrays/ArrayBuffer.h" |
26 #include "wtf/typed_arrays/Uint8Array.h" | 26 #include "wtf/typed_arrays/Uint8Array.h" |
27 | 27 |
28 namespace blink { | 28 namespace blink { |
29 | 29 |
30 OffscreenCanvasFrameDispatcherImpl::OffscreenCanvasFrameDispatcherImpl( | 30 OffscreenCanvasFrameDispatcherImpl::OffscreenCanvasFrameDispatcherImpl( |
31 uint32_t clientId, | 31 uint32_t clientId, |
32 uint32_t sinkId, | 32 uint32_t sinkId, |
33 uint32_t localId, | |
34 uint64_t nonceHigh, | |
35 uint64_t nonceLow, | |
36 int canvasId, | 33 int canvasId, |
37 int width, | 34 int width, |
38 int height) | 35 int height) |
39 : m_frameSinkId(cc::FrameSinkId(clientId, sinkId)), | 36 : m_frameSinkId(cc::FrameSinkId(clientId, sinkId)), |
40 m_currentLocalFrameId(cc::LocalFrameId( | |
41 localId, | |
42 base::UnguessableToken::Deserialize(nonceHigh, nonceLow))), | |
43 m_width(width), | 37 m_width(width), |
44 m_height(height), | 38 m_height(height), |
45 m_nextResourceId(1u), | 39 m_nextResourceId(1u), |
46 m_binding(this), | 40 m_binding(this), |
47 m_placeholderCanvasId(canvasId) { | 41 m_placeholderCanvasId(canvasId) { |
| 42 m_currentLocalFrameId = m_surfaceIdAllocator.GenerateId(); |
48 DCHECK(!m_sink.is_bound()); | 43 DCHECK(!m_sink.is_bound()); |
49 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; | 44 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; |
50 Platform::current()->interfaceProvider()->getInterface( | 45 Platform::current()->interfaceProvider()->getInterface( |
51 mojo::GetProxy(&provider)); | 46 mojo::GetProxy(&provider)); |
52 cc::SurfaceId surfaceId(m_frameSinkId, m_currentLocalFrameId); | 47 provider->CreateCompositorFrameSink(m_frameSinkId, |
53 provider->CreateCompositorFrameSink(surfaceId, | |
54 m_binding.CreateInterfacePtrAndBind(), | 48 m_binding.CreateInterfacePtrAndBind(), |
55 mojo::GetProxy(&m_sink)); | 49 mojo::GetProxy(&m_sink)); |
56 } | 50 } |
57 | 51 |
58 void OffscreenCanvasFrameDispatcherImpl::setTransferableResourceToSharedBitmap( | 52 void OffscreenCanvasFrameDispatcherImpl::setTransferableResourceToSharedBitmap( |
59 cc::TransferableResource& resource, | 53 cc::TransferableResource& resource, |
60 RefPtr<StaticBitmapImage> image) { | 54 RefPtr<StaticBitmapImage> image) { |
61 std::unique_ptr<cc::SharedBitmap> bitmap = | 55 std::unique_ptr<cc::SharedBitmap> bitmap = |
62 Platform::current()->allocateSharedBitmap(IntSize(m_width, m_height)); | 56 Platform::current()->allocateSharedBitmap(IntSize(m_width, m_height)); |
63 if (!bitmap) | 57 if (!bitmap) |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 return true; | 404 return true; |
411 return false; | 405 return false; |
412 } | 406 } |
413 | 407 |
414 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { | 408 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { |
415 m_width = width; | 409 m_width = width; |
416 m_height = height; | 410 m_height = height; |
417 } | 411 } |
418 | 412 |
419 } // namespace blink | 413 } // namespace blink |
OLD | NEW |