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

Unified Diff: cc/surfaces/surface_factory.h

Issue 2676373004: Implement service-side surface synchronization (Closed)
Patch Set: Better unit test name Created 3 years, 10 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: cc/surfaces/surface_factory.h
diff --git a/cc/surfaces/surface_factory.h b/cc/surfaces/surface_factory.h
index f77fdc48e589344e5e60c2b64a58068408560cf2..4a9f6afe2548ab8eb0a873954b51eda5204a218f 100644
--- a/cc/surfaces/surface_factory.h
+++ b/cc/surfaces/surface_factory.h
@@ -13,6 +13,7 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "cc/output/compositor_frame.h"
+#include "cc/surfaces/pending_frame_observer.h"
#include "cc/surfaces/surface_id.h"
#include "cc/surfaces/surface_resource_holder.h"
#include "cc/surfaces/surface_sequence.h"
@@ -32,14 +33,14 @@ class SurfaceManager;
// particular factory will be returned to that factory's client when they are no
// longer being used. This is the only class most users of surfaces will need to
// directly interact with.
-class CC_SURFACES_EXPORT SurfaceFactory {
+class CC_SURFACES_EXPORT SurfaceFactory : public PendingFrameObserver {
public:
using DrawCallback = base::Callback<void()>;
SurfaceFactory(const FrameSinkId& frame_sink_id,
SurfaceManager* manager,
SurfaceFactoryClient* client);
- ~SurfaceFactory();
+ ~SurfaceFactory() override;
const FrameSinkId& frame_sink_id() const { return frame_sink_id_; }
@@ -78,6 +79,8 @@ class CC_SURFACES_EXPORT SurfaceFactory {
SurfaceManager* manager() { return manager_; }
+ Surface* current_surface_for_testing() { return current_surface_.get(); }
+
// This can be set to false if resources from this SurfaceFactory don't need
// to have sync points set on them when returned from the Display, for
// example if the Display shares a context with the creator.
@@ -89,6 +92,14 @@ class CC_SURFACES_EXPORT SurfaceFactory {
void DidDestroySurfaceManager() { manager_ = nullptr; }
private:
+ // PendingFrameObserver implementation.
+ void OnSurfaceActivated(Surface* pending_surface) override;
+ void OnSurfaceDependenciesChanged(
+ Surface* pending_surface,
+ const SurfaceDependencies& added_dependencies,
+ const SurfaceDependencies& removed_dependencies) override;
+ void OnSurfaceDiscarded(Surface* pending_surface) override;
+
std::unique_ptr<Surface> Create(const LocalSurfaceId& local_surface_id);
void Destroy(std::unique_ptr<Surface> surface);

Powered by Google App Engine
This is Rietveld 408576698