| 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 25 matching lines...) Expand all Loading... |
| 36 : m_frameSinkId(cc::FrameSinkId(clientId, sinkId)), | 36 : m_frameSinkId(cc::FrameSinkId(clientId, sinkId)), |
| 37 m_width(width), | 37 m_width(width), |
| 38 m_height(height), | 38 m_height(height), |
| 39 m_nextResourceId(1u), | 39 m_nextResourceId(1u), |
| 40 m_binding(this), | 40 m_binding(this), |
| 41 m_placeholderCanvasId(canvasId) { | 41 m_placeholderCanvasId(canvasId) { |
| 42 m_currentLocalFrameId = m_surfaceIdAllocator.GenerateId(); | 42 m_currentLocalFrameId = m_surfaceIdAllocator.GenerateId(); |
| 43 DCHECK(!m_sink.is_bound()); | 43 DCHECK(!m_sink.is_bound()); |
| 44 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; | 44 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; |
| 45 Platform::current()->interfaceProvider()->getInterface( | 45 Platform::current()->interfaceProvider()->getInterface( |
| 46 mojo::GetProxy(&provider)); | 46 mojo::MakeRequest(&provider)); |
| 47 provider->CreateCompositorFrameSink(m_frameSinkId, | 47 provider->CreateCompositorFrameSink(m_frameSinkId, |
| 48 m_binding.CreateInterfacePtrAndBind(), | 48 m_binding.CreateInterfacePtrAndBind(), |
| 49 mojo::GetProxy(&m_sink)); | 49 mojo::MakeRequest(&m_sink)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void OffscreenCanvasFrameDispatcherImpl::setTransferableResourceToSharedBitmap( | 52 void OffscreenCanvasFrameDispatcherImpl::setTransferableResourceToSharedBitmap( |
| 53 cc::TransferableResource& resource, | 53 cc::TransferableResource& resource, |
| 54 RefPtr<StaticBitmapImage> image) { | 54 RefPtr<StaticBitmapImage> image) { |
| 55 std::unique_ptr<cc::SharedBitmap> bitmap = | 55 std::unique_ptr<cc::SharedBitmap> bitmap = |
| 56 Platform::current()->allocateSharedBitmap(IntSize(m_width, m_height)); | 56 Platform::current()->allocateSharedBitmap(IntSize(m_width, m_height)); |
| 57 if (!bitmap) | 57 if (!bitmap) |
| 58 return; | 58 return; |
| 59 unsigned char* pixels = bitmap->pixels(); | 59 unsigned char* pixels = bitmap->pixels(); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 return true; | 404 return true; |
| 405 return false; | 405 return false; |
| 406 } | 406 } |
| 407 | 407 |
| 408 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { | 408 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { |
| 409 m_width = width; | 409 m_width = width; |
| 410 m_height = height; | 410 m_height = height; |
| 411 } | 411 } |
| 412 | 412 |
| 413 } // namespace blink | 413 } // namespace blink |
| OLD | NEW |