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/CanvasSurfaceLayerBridge.h" | 5 #include "platform/graphics/CanvasSurfaceLayerBridge.h" |
6 | 6 |
7 #include "cc/layers/surface_layer.h" | 7 #include "cc/layers/surface_layer.h" |
8 #include "cc/surfaces/surface_id.h" | 8 #include "cc/surfaces/surface_id.h" |
9 #include "cc/surfaces/surface_sequence.h" | 9 #include "cc/surfaces/surface_sequence.h" |
10 #include "platform/graphics/GraphicsLayer.h" | 10 #include "platform/graphics/GraphicsLayer.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 CanvasSurfaceLayerBridge::~CanvasSurfaceLayerBridge() | 26 CanvasSurfaceLayerBridge::~CanvasSurfaceLayerBridge() |
27 { | 27 { |
28 } | 28 } |
29 | 29 |
30 bool CanvasSurfaceLayerBridge::createSurfaceLayer(int canvasWidth, int canvasHei
ght) | 30 bool CanvasSurfaceLayerBridge::createSurfaceLayer(int canvasWidth, int canvasHei
ght) |
31 { | 31 { |
32 if (!m_client->syncGetSurfaceId(&m_surfaceId)) | 32 if (!m_client->syncGetSurfaceId(&m_surfaceId)) |
33 return false; | 33 return false; |
34 | 34 |
35 m_client->asyncRequestSurfaceCreation(m_surfaceId); | 35 m_client->asyncRequestSurfaceCreation(m_surfaceId); |
36 cc::SurfaceLayer::SatisfyCallback satisfyCallback = createBaseCallback(bind(
&CanvasSurfaceLayerBridge::satisfyCallback, this)); | 36 cc::SurfaceLayer::SatisfyCallback satisfyCallback = createBaseCallback(bind(
&CanvasSurfaceLayerBridge::satisfyCallback, WTF::unretained(this))); |
37 cc::SurfaceLayer::RequireCallback requireCallback = createBaseCallback(bind(
&CanvasSurfaceLayerBridge::requireCallback, this)); | 37 cc::SurfaceLayer::RequireCallback requireCallback = createBaseCallback(bind(
&CanvasSurfaceLayerBridge::requireCallback, WTF::unretained(this))); |
38 m_surfaceLayer = cc::SurfaceLayer::Create(std::move(satisfyCallback), std::m
ove(requireCallback)); | 38 m_surfaceLayer = cc::SurfaceLayer::Create(std::move(satisfyCallback), std::m
ove(requireCallback)); |
39 m_surfaceLayer->SetSurfaceId(m_surfaceId, 1.f, gfx::Size(canvasWidth, canvas
Height)); | 39 m_surfaceLayer->SetSurfaceId(m_surfaceId, 1.f, gfx::Size(canvasWidth, canvas
Height)); |
40 | 40 |
41 m_webLayer = wrapUnique(Platform::current()->compositorSupport()->createLaye
rFromCCLayer(m_surfaceLayer.get())); | 41 m_webLayer = wrapUnique(Platform::current()->compositorSupport()->createLaye
rFromCCLayer(m_surfaceLayer.get())); |
42 GraphicsLayer::registerContentsLayer(m_webLayer.get()); | 42 GraphicsLayer::registerContentsLayer(m_webLayer.get()); |
43 return true; | 43 return true; |
44 } | 44 } |
45 | 45 |
46 void CanvasSurfaceLayerBridge::satisfyCallback(cc::SurfaceSequence sequence) | 46 void CanvasSurfaceLayerBridge::satisfyCallback(cc::SurfaceSequence sequence) |
47 { | 47 { |
48 m_client->asyncSatisfy(sequence); | 48 m_client->asyncSatisfy(sequence); |
49 } | 49 } |
50 | 50 |
51 void CanvasSurfaceLayerBridge::requireCallback(cc::SurfaceId surfaceId, cc::Surf
aceSequence sequence) | 51 void CanvasSurfaceLayerBridge::requireCallback(cc::SurfaceId surfaceId, cc::Surf
aceSequence sequence) |
52 { | 52 { |
53 m_client->asyncRequire(surfaceId, sequence); | 53 m_client->asyncRequire(surfaceId, sequence); |
54 } | 54 } |
55 | 55 |
56 } // namespace blink | 56 } // namespace blink |
OLD | NEW |