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

Unified Diff: third_party/WebKit/Source/platform/graphics/VideoSurfaceLayerBridge.cpp

Issue 2956713003: Replaces VideoLayer with a SurfaceLayer in WebMediaPlayerImpl (Closed)
Patch Set: Replaces VideoLayer with SurfaceLayer. Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/VideoSurfaceLayerBridge.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/VideoSurfaceLayerBridge.cpp
similarity index 59%
copy from third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
copy to third_party/WebKit/Source/platform/graphics/VideoSurfaceLayerBridge.cpp
index a19b255b812b2db6f33a8b42b3b98732ada22e00..167acc8e9739a8120d46a6743c90bfddd139f06c 100644
--- a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
+++ b/third_party/WebKit/Source/platform/graphics/VideoSurfaceLayerBridge.cpp
@@ -1,8 +1,8 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "platform/graphics/CanvasSurfaceLayerBridge.h"
+#include "platform/graphics/VideoSurfaceLayerBridge.h"
#include "cc/layers/layer.h"
#include "cc/layers/solid_color_layer.h"
@@ -24,48 +24,15 @@
namespace blink {
-namespace {
-
-class OffscreenCanvasSurfaceReferenceFactory
- : public cc::SequenceSurfaceReferenceFactory {
- public:
- OffscreenCanvasSurfaceReferenceFactory(
- base::WeakPtr<CanvasSurfaceLayerBridge> bridge)
- : bridge_(bridge) {}
-
- private:
- ~OffscreenCanvasSurfaceReferenceFactory() override = default;
-
- // cc::SequenceSurfaceReferenceFactory implementation:
- void RequireSequence(const cc::SurfaceId& id,
- const cc::SurfaceSequence& sequence) const override {
- DCHECK(bridge_);
- bridge_->RequireCallback(id, sequence);
- }
-
- void SatisfySequence(const cc::SurfaceSequence& sequence) const override {
- if (bridge_)
- bridge_->SatisfyCallback(sequence);
- }
-
- base::WeakPtr<CanvasSurfaceLayerBridge> bridge_;
-
- DISALLOW_COPY_AND_ASSIGN(OffscreenCanvasSurfaceReferenceFactory);
-};
-
-} // namespace
-
-CanvasSurfaceLayerBridge::CanvasSurfaceLayerBridge(
- CanvasSurfaceLayerBridgeObserver* observer,
- WebLayerTreeView* layer_tree_view)
+VideoSurfaceLayerBridge::VideoSurfaceLayerBridge(
+ WebSurfaceLayerBridgeObserver* observer)
: weak_factory_(this),
observer_(observer),
binding_(this),
frame_sink_id_(Platform::Current()->GenerateFrameSinkId()),
- parent_frame_sink_id_(layer_tree_view ? layer_tree_view->GetFrameSinkId()
- : cc::FrameSinkId()) {
+ parent_frame_sink_id_(cc::FrameSinkId()) {
ref_factory_ =
- new OffscreenCanvasSurfaceReferenceFactory(weak_factory_.GetWeakPtr());
+ new SequenceSurfaceReferenceFactoryImpl(weak_factory_.GetWeakPtr());
DCHECK(!service_.is_bound());
mojom::blink::OffscreenCanvasProviderPtr provider;
liberato (no reviews please) 2017/06/26 22:39:30 do you know yet if the the OffscreenCanvasProvider
CJ 2017/06/29 19:51:33 Not sure, was gonna handle that in another CL
@@ -79,30 +46,23 @@ CanvasSurfaceLayerBridge::CanvasSurfaceLayerBridge(
provider->CreateOffscreenCanvasSurface(parent_frame_sink_id_, frame_sink_id_,
std::move(client),
mojo::MakeRequest(&service_));
+ cc_layer_ = cc::SolidColorLayer::Create();
}
-CanvasSurfaceLayerBridge::~CanvasSurfaceLayerBridge() {
+VideoSurfaceLayerBridge::~VideoSurfaceLayerBridge() {
observer_ = nullptr;
- if (web_layer_) {
- GraphicsLayer::UnregisterContentsLayer(web_layer_.get());
- }
}
-void CanvasSurfaceLayerBridge::CreateSolidColorLayer() {
+void VideoSurfaceLayerBridge::CreateSolidColorLayer() {
cc_layer_ = cc::SolidColorLayer::Create();
cc_layer_->SetBackgroundColor(SK_ColorTRANSPARENT);
- web_layer_ = Platform::Current()->CompositorSupport()->CreateLayerFromCCLayer(
- cc_layer_.get());
- GraphicsLayer::RegisterContentsLayer(web_layer_.get());
}
-void CanvasSurfaceLayerBridge::OnSurfaceCreated(
+void VideoSurfaceLayerBridge::OnSurfaceCreated(
const cc::SurfaceInfo& surface_info) {
if (!current_surface_id_.is_valid() && surface_info.is_valid()) {
// First time a SurfaceId is received
current_surface_id_ = surface_info.id();
- GraphicsLayer::UnregisterContentsLayer(web_layer_.get());
- web_layer_->RemoveFromParent();
scoped_refptr<cc::SurfaceLayer> surface_layer =
cc::SurfaceLayer::Create(ref_factory_);
@@ -111,10 +71,6 @@ void CanvasSurfaceLayerBridge::OnSurfaceCreated(
surface_layer->SetStretchContentToFillBounds(true);
cc_layer_ = surface_layer;
- web_layer_ =
- Platform::Current()->CompositorSupport()->CreateLayerFromCCLayer(
- cc_layer_.get());
- GraphicsLayer::RegisterContentsLayer(web_layer_.get());
} else if (current_surface_id_ != surface_info.id()) {
// A different SurfaceId is received, prompting change to existing
// SurfaceLayer
@@ -129,12 +85,12 @@ void CanvasSurfaceLayerBridge::OnSurfaceCreated(
cc_layer_->SetBounds(surface_info.size_in_pixels());
}
-void CanvasSurfaceLayerBridge::SatisfyCallback(
+void VideoSurfaceLayerBridge::SatisfyCallback(
const cc::SurfaceSequence& sequence) {
service_->Satisfy(sequence);
}
-void CanvasSurfaceLayerBridge::RequireCallback(
+void VideoSurfaceLayerBridge::RequireCallback(
const cc::SurfaceId& surface_id,
const cc::SurfaceSequence& sequence) {
service_->Require(surface_id, sequence);

Powered by Google App Engine
This is Rietveld 408576698