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

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

Issue 2610723002: Unify SurfaceInfo (Closed)
Patch Set: Cleanup offscreen canvas Created 3 years, 11 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 #ifndef CanvasSurfaceLayerBridge_h 5 #ifndef CanvasSurfaceLayerBridge_h
6 #define CanvasSurfaceLayerBridge_h 6 #define CanvasSurfaceLayerBridge_h
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "cc/surfaces/surface_id.h" 10 #include "cc/surfaces/surface_id.h"
11 #include "cc/surfaces/surface_reference_factory.h" 11 #include "cc/surfaces/surface_reference_factory.h"
12 #include "mojo/public/cpp/bindings/binding.h" 12 #include "mojo/public/cpp/bindings/binding.h"
13 #include "platform/PlatformExport.h" 13 #include "platform/PlatformExport.h"
14 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom -blink.h" 14 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom -blink.h"
15 #include <memory> 15 #include <memory>
16 16
17 namespace cc { 17 namespace cc {
18 class Layer; 18 class Layer;
19 class SurfaceInfo;
19 } // namespace cc 20 } // namespace cc
20 21
21 namespace blink { 22 namespace blink {
22 23
23 class WebLayer; 24 class WebLayer;
24 25
25 class PLATFORM_EXPORT CanvasSurfaceLayerBridgeObserver { 26 class PLATFORM_EXPORT CanvasSurfaceLayerBridgeObserver {
26 public: 27 public:
27 CanvasSurfaceLayerBridgeObserver() {} 28 CanvasSurfaceLayerBridgeObserver() {}
28 virtual ~CanvasSurfaceLayerBridgeObserver() {} 29 virtual ~CanvasSurfaceLayerBridgeObserver() {}
29 30
30 virtual void OnWebLayerReplaced() = 0; 31 virtual void OnWebLayerReplaced() = 0;
31 }; 32 };
32 33
33 class PLATFORM_EXPORT CanvasSurfaceLayerBridge 34 class PLATFORM_EXPORT CanvasSurfaceLayerBridge
34 : NON_EXPORTED_BASE(public mojom::blink::OffscreenCanvasSurfaceClient) { 35 : NON_EXPORTED_BASE(public mojom::blink::OffscreenCanvasSurfaceClient) {
35 public: 36 public:
36 explicit CanvasSurfaceLayerBridge(CanvasSurfaceLayerBridgeObserver*); 37 explicit CanvasSurfaceLayerBridge(CanvasSurfaceLayerBridgeObserver*);
37 ~CanvasSurfaceLayerBridge(); 38 ~CanvasSurfaceLayerBridge();
38 void createSolidColorLayer(); 39 void createSolidColorLayer();
39 WebLayer* getWebLayer() const { return m_webLayer.get(); } 40 WebLayer* getWebLayer() const { return m_webLayer.get(); }
40 const cc::FrameSinkId& getFrameSinkId() const { return m_frameSinkId; } 41 const cc::FrameSinkId& getFrameSinkId() const { return m_frameSinkId; }
41 42
42 // Implementation of mojom::blink::OffscreenCanvasSurfaceClient 43 // Implementation of mojom::blink::OffscreenCanvasSurfaceClient
43 void OnSurfaceCreated(const cc::SurfaceId&, 44 void OnSurfaceCreated(const cc::SurfaceInfo&) override;
44 int32_t width,
45 int32_t height,
46 float deviceScaleFactor) override;
47 45
48 void satisfyCallback(const cc::SurfaceSequence&); 46 void satisfyCallback(const cc::SurfaceSequence&);
49 void requireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); 47 void requireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&);
50 48
51 private: 49 private:
52 scoped_refptr<cc::Layer> m_CCLayer; 50 scoped_refptr<cc::Layer> m_CCLayer;
53 std::unique_ptr<WebLayer> m_webLayer; 51 std::unique_ptr<WebLayer> m_webLayer;
54 52
55 scoped_refptr<cc::SurfaceReferenceFactory> m_refFactory; 53 scoped_refptr<cc::SurfaceReferenceFactory> m_refFactory;
56 base::WeakPtrFactory<CanvasSurfaceLayerBridge> m_weakFactory; 54 base::WeakPtrFactory<CanvasSurfaceLayerBridge> m_weakFactory;
57 55
58 CanvasSurfaceLayerBridgeObserver* m_observer; 56 CanvasSurfaceLayerBridgeObserver* m_observer;
59 57
60 mojom::blink::OffscreenCanvasSurfacePtr m_service; 58 mojom::blink::OffscreenCanvasSurfacePtr m_service;
61 mojo::Binding<mojom::blink::OffscreenCanvasSurfaceClient> m_binding; 59 mojo::Binding<mojom::blink::OffscreenCanvasSurfaceClient> m_binding;
62 60
63 cc::FrameSinkId m_frameSinkId; 61 cc::FrameSinkId m_frameSinkId;
64 cc::SurfaceId m_currentSurfaceId; 62 cc::SurfaceId m_currentSurfaceId;
65 }; 63 };
66 64
67 } // namespace blink 65 } // namespace blink
68 66
69 #endif // CanvasSurfaceLayerBridge_h 67 #endif // CanvasSurfaceLayerBridge_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698