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

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

Issue 2811193003: Reintroduce OffscreenCanvasSurfaceClient interface. (Closed)
Patch Set: Add dep on mojom. Created 3 years, 8 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 <memory> 8 #include <memory>
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "cc/ipc/frame_sink_manager.mojom-blink.h"
12 #include "cc/surfaces/surface_id.h" 11 #include "cc/surfaces/surface_id.h"
13 #include "cc/surfaces/surface_reference_factory.h" 12 #include "cc/surfaces/surface_reference_factory.h"
14 #include "mojo/public/cpp/bindings/binding.h" 13 #include "mojo/public/cpp/bindings/binding.h"
15 #include "platform/PlatformExport.h" 14 #include "platform/PlatformExport.h"
16 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom -blink.h" 15 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom -blink.h"
17 16
18 namespace cc { 17 namespace cc {
19 class Layer; 18 class Layer;
20 class SurfaceInfo; 19 class SurfaceInfo;
21 } // namespace cc 20 } // namespace cc
22 21
23 namespace blink { 22 namespace blink {
24 23
25 class WebLayer; 24 class WebLayer;
26 class WebLayerTreeView; 25 class WebLayerTreeView;
27 26
28 class PLATFORM_EXPORT CanvasSurfaceLayerBridgeObserver { 27 class PLATFORM_EXPORT CanvasSurfaceLayerBridgeObserver {
29 public: 28 public:
30 CanvasSurfaceLayerBridgeObserver() {} 29 CanvasSurfaceLayerBridgeObserver() {}
31 virtual ~CanvasSurfaceLayerBridgeObserver() {} 30 virtual ~CanvasSurfaceLayerBridgeObserver() {}
32 31
33 virtual void OnWebLayerReplaced() = 0; 32 virtual void OnWebLayerReplaced() = 0;
34 }; 33 };
35 34
36 class PLATFORM_EXPORT CanvasSurfaceLayerBridge 35 class PLATFORM_EXPORT CanvasSurfaceLayerBridge
37 : NON_EXPORTED_BASE(public cc::mojom::blink::FrameSinkManagerClient) { 36 : NON_EXPORTED_BASE(
37 public blink::mojom::blink::OffscreenCanvasSurfaceClient) {
38 public: 38 public:
39 explicit CanvasSurfaceLayerBridge(CanvasSurfaceLayerBridgeObserver*, 39 explicit CanvasSurfaceLayerBridge(CanvasSurfaceLayerBridgeObserver*,
40 WebLayerTreeView*); 40 WebLayerTreeView*);
41 ~CanvasSurfaceLayerBridge(); 41 ~CanvasSurfaceLayerBridge();
42 void CreateSolidColorLayer(); 42 void CreateSolidColorLayer();
43 WebLayer* GetWebLayer() const { return web_layer_.get(); } 43 WebLayer* GetWebLayer() const { return web_layer_.get(); }
44 const cc::FrameSinkId& GetFrameSinkId() const { return frame_sink_id_; } 44 const cc::FrameSinkId& GetFrameSinkId() const { return frame_sink_id_; }
45 45
46 // Implementation of cc::mojom::blink::FrameSinkManagerClient 46 // Implementation of blink::mojom::blink::OffscreenCanvasSurfaceClient
47 void OnSurfaceCreated(const cc::SurfaceInfo&) override; 47 void OnSurfaceCreated(const cc::SurfaceInfo&) override;
48 48
49 void SatisfyCallback(const cc::SurfaceSequence&); 49 void SatisfyCallback(const cc::SurfaceSequence&);
50 void RequireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); 50 void RequireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&);
51 51
52 private: 52 private:
53 scoped_refptr<cc::Layer> cc_layer_; 53 scoped_refptr<cc::Layer> cc_layer_;
54 std::unique_ptr<WebLayer> web_layer_; 54 std::unique_ptr<WebLayer> web_layer_;
55 55
56 scoped_refptr<cc::SurfaceReferenceFactory> ref_factory_; 56 scoped_refptr<cc::SurfaceReferenceFactory> ref_factory_;
57 base::WeakPtrFactory<CanvasSurfaceLayerBridge> weak_factory_; 57 base::WeakPtrFactory<CanvasSurfaceLayerBridge> weak_factory_;
58 58
59 CanvasSurfaceLayerBridgeObserver* observer_; 59 CanvasSurfaceLayerBridgeObserver* observer_;
60 60
61 mojom::blink::OffscreenCanvasSurfacePtr service_; 61 mojom::blink::OffscreenCanvasSurfacePtr service_;
62 mojo::Binding<cc::mojom::blink::FrameSinkManagerClient> binding_; 62 mojo::Binding<blink::mojom::blink::OffscreenCanvasSurfaceClient> binding_;
63 63
64 const cc::FrameSinkId frame_sink_id_; 64 const cc::FrameSinkId frame_sink_id_;
65 cc::SurfaceId current_surface_id_; 65 cc::SurfaceId current_surface_id_;
66 const cc::FrameSinkId parent_frame_sink_id_; 66 const cc::FrameSinkId parent_frame_sink_id_;
67 }; 67 };
68 68
69 } // namespace blink 69 } // namespace blink
70 70
71 #endif // CanvasSurfaceLayerBridge_h 71 #endif // CanvasSurfaceLayerBridge_h
OLDNEW
« no previous file with comments | « content/test/BUILD.gn ('k') | third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698