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

Unified Diff: components/exo/surface.cc

Issue 2514033002: Introducing SurfaceReferenceFactory (Closed)
Patch Set: ref Created 4 years 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: components/exo/surface.cc
diff --git a/components/exo/surface.cc b/components/exo/surface.cc
index f295aaa46096e5edef0e3a5c9121a23820f4fdb3..7876284a6dc0ba2d04d008288b2b1ae03aee2478 100644
--- a/components/exo/surface.cc
+++ b/components/exo/surface.cc
@@ -18,6 +18,7 @@
#include "cc/quads/texture_draw_quad.h"
#include "cc/resources/single_release_callback.h"
#include "cc/surfaces/surface.h"
+#include "cc/surfaces/surface_embedding.h"
#include "cc/surfaces/surface_id_allocator.h"
#include "components/exo/buffer.h"
#include "components/exo/surface_delegate.h"
@@ -45,6 +46,25 @@ DECLARE_WINDOW_PROPERTY_TYPE(exo::Surface*);
namespace exo {
namespace {
+class SurfaceEmbedding : public cc::SurfaceEmbeddingUsingSequence {
+ public:
+ explicit SurfaceEmbedding(
+ scoped_refptr<CompositorFrameSinkHolder> sink_holder)
+ : sink_holder_(sink_holder) {}
+
+ protected:
+ ~SurfaceEmbedding() override = default;
+
+ private:
+ void SatisfySequence(const cc::SurfaceSequence& seq) const override {
+ sink_holder_->Satisfy(seq);
+ }
+ void RequireSequence(const cc::SurfaceId& id,
+ const cc::SurfaceSequence& seq) const override {
+ sink_holder_->Require(id, seq);
+ }
+ scoped_refptr<CompositorFrameSinkHolder> sink_holder_;
+};
// A property key containing the surface that is associated with
// window. If unset, no surface is associated with window.
DEFINE_WINDOW_PROPERTY_KEY(Surface*, kSurfaceKey, nullptr);
@@ -417,13 +437,13 @@ void Surface::CommitSurfaceHierarchy() {
// mirror layer to update its surface using the latest bounds.
window_->layer()->SetBounds(
gfx::Rect(window_->layer()->bounds().origin(), content_size_));
+ cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_);
+ cc::SurfaceEmbeddingPtr embedding =
+ new SurfaceEmbedding(compositor_frame_sink_holder_);
window_->layer()->SetShowSurface(
- cc::SurfaceId(frame_sink_id_, local_frame_id_),
- base::Bind(&CompositorFrameSinkHolder::Satisfy,
- compositor_frame_sink_holder_),
- base::Bind(&CompositorFrameSinkHolder::Require,
- compositor_frame_sink_holder_),
- content_size_, contents_surface_to_layer_scale, content_size_);
+ cc::SurfaceInfo(surface_id, contents_surface_to_layer_scale,
+ content_size_),
+ std::move(embedding), content_size_);
window_->layer()->SetFillsBoundsOpaquely(
state_.blend_mode == SkBlendMode::kSrc ||
state_.opaque_region.contains(

Powered by Google App Engine
This is Rietveld 408576698