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/output/delegated_frame_data.h" | 8 #include "cc/output/delegated_frame_data.h" |
9 #include "cc/quads/render_pass.h" | 9 #include "cc/quads/render_pass.h" |
10 #include "cc/quads/shared_quad_state.h" | 10 #include "cc/quads/shared_quad_state.h" |
11 #include "cc/quads/solid_color_draw_quad.h" | 11 #include "cc/quads/solid_color_draw_quad.h" |
12 #include "cc/quads/texture_draw_quad.h" | 12 #include "cc/quads/texture_draw_quad.h" |
13 #include "cc/resources/returned_resource.h" | 13 #include "cc/resources/returned_resource.h" |
14 #include "public/platform/InterfaceProvider.h" | 14 #include "public/platform/InterfaceProvider.h" |
15 #include "public/platform/Platform.h" | 15 #include "public/platform/Platform.h" |
16 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom
-blink.h" | 16 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom
-blink.h" |
17 #include "third_party/khronos/GLES2/gl2.h" | 17 #include "third_party/khronos/GLES2/gl2.h" |
18 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
19 #include "third_party/skia/include/core/SkXfermode.h" | 19 #include "third_party/skia/include/core/SkXfermode.h" |
20 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
21 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
22 | 22 |
23 namespace blink { | 23 namespace blink { |
24 | 24 |
25 OffscreenCanvasFrameDispatcherImpl::OffscreenCanvasFrameDispatcherImpl(uint32_t
clientId, uint32_t localId, uint64_t nonce, int width, int height) | 25 OffscreenCanvasFrameDispatcherImpl::OffscreenCanvasFrameDispatcherImpl(uint32_t
clientId, uint32_t localId, uint64_t nonce, int width, int height) |
26 : m_surfaceId(cc::SurfaceId(clientId, localId, nonce)) | 26 : m_surfaceId(cc::SurfaceId(cc::FrameSinkId(clientId, 0 /* sink_id */), loca
lId, nonce)) |
27 , m_width(width) | 27 , m_width(width) |
28 , m_height(height) | 28 , m_height(height) |
29 , m_binding(this) | 29 , m_binding(this) |
30 { | 30 { |
31 DCHECK(!m_sink.is_bound()); | 31 DCHECK(!m_sink.is_bound()); |
32 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; | 32 mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; |
33 Platform::current()->interfaceProvider()->getInterface(mojo::GetProxy(&provi
der)); | 33 Platform::current()->interfaceProvider()->getInterface(mojo::GetProxy(&provi
der)); |
34 provider->CreateCompositorFrameSink(m_surfaceId, m_binding.CreateInterfacePt
rAndBind(), mojo::GetProxy(&m_sink)); | 34 provider->CreateCompositorFrameSink(m_surfaceId, m_binding.CreateInterfacePt
rAndBind(), mojo::GetProxy(&m_sink)); |
35 } | 35 } |
36 | 36 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 m_sink->SubmitCompositorFrame(std::move(frame), base::Closure()); | 96 m_sink->SubmitCompositorFrame(std::move(frame), base::Closure()); |
97 } | 97 } |
98 | 98 |
99 void OffscreenCanvasFrameDispatcherImpl::ReturnResources(Vector<cc::mojom::blink
::ReturnedResourcePtr> resources) | 99 void OffscreenCanvasFrameDispatcherImpl::ReturnResources(Vector<cc::mojom::blink
::ReturnedResourcePtr> resources) |
100 { | 100 { |
101 for (const auto& resource : resources) | 101 for (const auto& resource : resources) |
102 m_cachedImages.remove(resource->id); | 102 m_cachedImages.remove(resource->id); |
103 } | 103 } |
104 | 104 |
105 } // namespace blink | 105 } // namespace blink |
OLD | NEW |