Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp

Issue 2333133003: Make Surface creation lazy for OffscreenCanvasFrameReceiverImpl (Closed)
Patch Set: Rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 14 matching lines...) Expand all
25 25
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);
36 cc::SurfaceLayer::SatisfyCallback satisfyCallback = convertToBaseCallback(WT F::bind(&CanvasSurfaceLayerBridge::satisfyCallback, WTF::unretained(this))); 35 cc::SurfaceLayer::SatisfyCallback satisfyCallback = convertToBaseCallback(WT F::bind(&CanvasSurfaceLayerBridge::satisfyCallback, WTF::unretained(this)));
37 cc::SurfaceLayer::RequireCallback requireCallback = convertToBaseCallback(WT F::bind(&CanvasSurfaceLayerBridge::requireCallback, WTF::unretained(this))); 36 cc::SurfaceLayer::RequireCallback requireCallback = convertToBaseCallback(WT F::bind(&CanvasSurfaceLayerBridge::requireCallback, WTF::unretained(this)));
38 m_surfaceLayer = cc::SurfaceLayer::Create(std::move(satisfyCallback), std::m ove(requireCallback)); 37 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)); 38 m_surfaceLayer->SetSurfaceId(m_surfaceId, 1.f, gfx::Size(canvasWidth, canvas Height));
40 39
41 m_webLayer = wrapUnique(Platform::current()->compositorSupport()->createLaye rFromCCLayer(m_surfaceLayer.get())); 40 m_webLayer = wrapUnique(Platform::current()->compositorSupport()->createLaye rFromCCLayer(m_surfaceLayer.get()));
42 GraphicsLayer::registerContentsLayer(m_webLayer.get()); 41 GraphicsLayer::registerContentsLayer(m_webLayer.get());
43 return true; 42 return true;
44 } 43 }
45 44
46 void CanvasSurfaceLayerBridge::satisfyCallback(const cc::SurfaceSequence& sequen ce) 45 void CanvasSurfaceLayerBridge::satisfyCallback(const cc::SurfaceSequence& sequen ce)
47 { 46 {
48 m_client->asyncSatisfy(sequence); 47 m_client->asyncSatisfy(sequence);
49 } 48 }
50 49
51 void CanvasSurfaceLayerBridge::requireCallback(const cc::SurfaceId& surfaceId, c onst cc::SurfaceSequence& sequence) 50 void CanvasSurfaceLayerBridge::requireCallback(const cc::SurfaceId& surfaceId, c onst cc::SurfaceSequence& sequence)
52 { 51 {
53 m_client->asyncRequire(surfaceId, sequence); 52 m_client->asyncRequire(surfaceId, sequence);
54 } 53 }
55 54
56 } // namespace blink 55 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698