| 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/ipc/display_compositor.mojom-blink.h" |
| 7 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/quads/texture_draw_quad.h" | 9 #include "cc/quads/texture_draw_quad.h" |
| 9 #include "gpu/command_buffer/client/gles2_interface.h" | 10 #include "gpu/command_buffer/client/gles2_interface.h" |
| 10 #include "platform/CrossThreadFunctional.h" | 11 #include "platform/CrossThreadFunctional.h" |
| 11 #include "platform/Histogram.h" | 12 #include "platform/Histogram.h" |
| 12 #include "platform/WebTaskRunner.h" | 13 #include "platform/WebTaskRunner.h" |
| 13 #include "platform/graphics/OffscreenCanvasPlaceholder.h" | 14 #include "platform/graphics/OffscreenCanvasPlaceholder.h" |
| 14 #include "platform/graphics/gpu/SharedGpuContext.h" | 15 #include "platform/graphics/gpu/SharedGpuContext.h" |
| 15 #include "public/platform/InterfaceProvider.h" | 16 #include "public/platform/InterfaceProvider.h" |
| 16 #include "public/platform/Platform.h" | 17 #include "public/platform/Platform.h" |
| 17 #include "public/platform/WebGraphicsContext3DProvider.h" | 18 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 18 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom
-blink.h" | 19 //#include |
| 20 //"public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom-blink.
h" |
| 19 #include "third_party/khronos/GLES2/gl2.h" | 21 #include "third_party/khronos/GLES2/gl2.h" |
| 20 #include "third_party/khronos/GLES2/gl2ext.h" | 22 #include "third_party/khronos/GLES2/gl2ext.h" |
| 21 #include "third_party/skia/include/core/SkColor.h" | 23 #include "third_party/skia/include/core/SkColor.h" |
| 22 #include "third_party/skia/include/core/SkImage.h" | 24 #include "third_party/skia/include/core/SkImage.h" |
| 23 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
| 24 #include "ui/gfx/transform.h" | 26 #include "ui/gfx/transform.h" |
| 25 #include "wtf/typed_arrays/ArrayBuffer.h" | 27 #include "wtf/typed_arrays/ArrayBuffer.h" |
| 26 #include "wtf/typed_arrays/Uint8Array.h" | 28 #include "wtf/typed_arrays/Uint8Array.h" |
| 27 | 29 |
| 28 namespace blink { | 30 namespace blink { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 41 m_changeSizeForNextCommit(false), | 43 m_changeSizeForNextCommit(false), |
| 42 m_needsBeginFrame(false), | 44 m_needsBeginFrame(false), |
| 43 m_nextResourceId(1u), | 45 m_nextResourceId(1u), |
| 44 m_binding(this), | 46 m_binding(this), |
| 45 m_placeholderCanvasId(canvasId) { | 47 m_placeholderCanvasId(canvasId) { |
| 46 if (m_frameSinkId.is_valid()) { | 48 if (m_frameSinkId.is_valid()) { |
| 47 // Only frameless canvas pass an invalid frame sink id; we don't create | 49 // Only frameless canvas pass an invalid frame sink id; we don't create |
| 48 // mojo channel for this special case. | 50 // mojo channel for this special case. |
| 49 m_currentLocalSurfaceId = m_surfaceIdAllocator.GenerateId(); | 51 m_currentLocalSurfaceId = m_surfaceIdAllocator.GenerateId(); |
| 50 DCHECK(!m_sink.is_bound()); | 52 DCHECK(!m_sink.is_bound()); |
| 51 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; | 53 cc::mojom::blink::DisplayCompositorPtr compositor; |
| 52 Platform::current()->interfaceProvider()->getInterface( | 54 Platform::current()->interfaceProvider()->getInterface( |
| 53 mojo::MakeRequest(&provider)); | 55 mojo::MakeRequest(&compositor)); |
| 54 provider->CreateCompositorFrameSink(m_frameSinkId, | 56 compositor->CreateOffscreenCanvasCompositorFrameSink( |
| 55 m_binding.CreateInterfacePtrAndBind(), | 57 m_frameSinkId, mojo::MakeRequest(&m_sink), |
| 56 mojo::MakeRequest(&m_sink)); | 58 m_binding.CreateInterfacePtrAndBind()); |
| 57 } | 59 } |
| 58 } | 60 } |
| 59 | 61 |
| 60 OffscreenCanvasFrameDispatcherImpl::~OffscreenCanvasFrameDispatcherImpl() { | 62 OffscreenCanvasFrameDispatcherImpl::~OffscreenCanvasFrameDispatcherImpl() { |
| 61 } | 63 } |
| 62 | 64 |
| 63 void OffscreenCanvasFrameDispatcherImpl::setTransferableResourceToSharedBitmap( | 65 void OffscreenCanvasFrameDispatcherImpl::setTransferableResourceToSharedBitmap( |
| 64 cc::TransferableResource& resource, | 66 cc::TransferableResource& resource, |
| 65 RefPtr<StaticBitmapImage> image) { | 67 RefPtr<StaticBitmapImage> image) { |
| 66 std::unique_ptr<cc::SharedBitmap> bitmap = | 68 std::unique_ptr<cc::SharedBitmap> bitmap = |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 441 |
| 440 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { | 442 void OffscreenCanvasFrameDispatcherImpl::reshape(int width, int height) { |
| 441 if (m_width != width || m_height != height) { | 443 if (m_width != width || m_height != height) { |
| 442 m_width = width; | 444 m_width = width; |
| 443 m_height = height; | 445 m_height = height; |
| 444 m_changeSizeForNextCommit = true; | 446 m_changeSizeForNextCommit = true; |
| 445 } | 447 } |
| 446 } | 448 } |
| 447 | 449 |
| 448 } // namespace blink | 450 } // namespace blink |
| OLD | NEW |