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

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

Issue 2956713003: Replaces VideoLayer with a SurfaceLayer in WebMediaPlayerImpl (Closed)
Patch Set: Moves some implementation into SurfaceLayerBridge. Created 3 years, 5 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/surfaces/surface_id.h" 11 #include "cc/surfaces/surface_id.h"
12 #include "cc/surfaces/surface_reference_factory.h" 12 #include "cc/surfaces/surface_reference_factory.h"
13 #include "mojo/public/cpp/bindings/binding.h" 13 #include "mojo/public/cpp/bindings/binding.h"
14 #include "platform/PlatformExport.h" 14 #include "platform/PlatformExport.h"
15 #include "platform/graphics/SurfaceLayerBridge.h"
15 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom -blink.h" 16 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom -blink.h"
16 17
17 namespace cc { 18 namespace cc {
18 class Layer; 19 class Layer;
19 class SurfaceInfo; 20 class SurfaceInfo;
20 } // namespace cc 21 } // namespace cc
21 22
22 namespace blink { 23 namespace blink {
23 24
24 class WebLayer; 25 class WebLayer;
25 class WebLayerTreeView; 26 class WebLayerTreeView;
26 27
27 class PLATFORM_EXPORT CanvasSurfaceLayerBridgeObserver { 28 class PLATFORM_EXPORT CanvasSurfaceLayerBridgeObserver {
28 public: 29 public:
29 CanvasSurfaceLayerBridgeObserver() {} 30 CanvasSurfaceLayerBridgeObserver() {}
30 virtual ~CanvasSurfaceLayerBridgeObserver() {} 31 virtual ~CanvasSurfaceLayerBridgeObserver() {}
31 32
32 virtual void OnWebLayerReplaced() = 0; 33 virtual void OnWebLayerReplaced() = 0;
33 }; 34 };
34 35
35 class PLATFORM_EXPORT CanvasSurfaceLayerBridge 36 class PLATFORM_EXPORT CanvasSurfaceLayerBridge
36 : NON_EXPORTED_BASE( 37 : public NON_EXPORTED_BASE(SurfaceLayerBridge) {
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
apacible 2017/07/07 18:25:38 nit: remove newline.
CJ 2017/07/07 18:50:47 I think you are reviewing an older patch set. Thre
42 void CreateSolidColorLayer(); 43 void CreateSolidColorLayer();
43 WebLayer* GetWebLayer() const { return web_layer_.get(); }
44 const cc::FrameSinkId& GetFrameSinkId() const { return frame_sink_id_; }
45 44
46 // Implementation of blink::mojom::blink::OffscreenCanvasSurfaceClient 45 // Implementation of blink::mojom::blink::OffscreenCanvasSurfaceClient
47 void OnSurfaceCreated(const cc::SurfaceInfo&) override; 46 void OnSurfaceCreated(const cc::SurfaceInfo&) override;
48 47
49 void SatisfyCallback(const cc::SurfaceSequence&); 48 WebLayer* GetWebLayer() const { return web_layer_.get(); }
50 void RequireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); 49 const cc::FrameSinkId& GetFrameSinkId() const { return frame_sink_id_; }
51 50
52 private: 51 private:
53 scoped_refptr<cc::Layer> cc_layer_; 52 scoped_refptr<cc::Layer> cc_layer_;
54 std::unique_ptr<WebLayer> web_layer_; 53 std::unique_ptr<WebLayer> web_layer_;
55 54
56 scoped_refptr<cc::SurfaceReferenceFactory> ref_factory_; 55 scoped_refptr<cc::SurfaceReferenceFactory> ref_factory_;
57 base::WeakPtrFactory<CanvasSurfaceLayerBridge> weak_factory_; 56 base::WeakPtrFactory<CanvasSurfaceLayerBridge> weak_factory_;
58 57
59 CanvasSurfaceLayerBridgeObserver* observer_; 58 CanvasSurfaceLayerBridgeObserver* observer_;
60 59
61 mojom::blink::OffscreenCanvasSurfacePtr service_;
62 mojo::Binding<blink::mojom::blink::OffscreenCanvasSurfaceClient> binding_; 60 mojo::Binding<blink::mojom::blink::OffscreenCanvasSurfaceClient> binding_;
63 61
64 const cc::FrameSinkId frame_sink_id_; 62 const cc::FrameSinkId frame_sink_id_;
65 cc::SurfaceId current_surface_id_; 63 cc::SurfaceId current_surface_id_;
66 const cc::FrameSinkId parent_frame_sink_id_; 64 const cc::FrameSinkId parent_frame_sink_id_;
67 }; 65 };
68 66
69 } // namespace blink 67 } // namespace blink
70 68
71 #endif // CanvasSurfaceLayerBridge_h 69 #endif // CanvasSurfaceLayerBridge_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698