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

Unified Diff: cc/surfaces/surface_manager.cc

Issue 2802023002: Remove SurfaceFactory And SurfaceFactoryClient (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: cc/surfaces/surface_manager.cc
diff --git a/cc/surfaces/surface_manager.cc b/cc/surfaces/surface_manager.cc
index 2c2e2f69cef0d5c658cfb80110be374690fd7975..5f6daa6d72df305492bea9538f59c789781acf57 100644
--- a/cc/surfaces/surface_manager.cc
+++ b/cc/surfaces/surface_manager.cc
@@ -11,10 +11,10 @@
#include <utility>
#include "base/logging.h"
+#include "cc/surfaces/compositor_frame_sink_support.h"
#include "cc/surfaces/direct_surface_reference_factory.h"
#include "cc/surfaces/local_surface_id_allocator.h"
#include "cc/surfaces/surface.h"
-#include "cc/surfaces/surface_factory_client.h"
#include "cc/surfaces/surface_info.h"
#if DCHECK_IS_ON()
@@ -75,18 +75,20 @@ void SurfaceManager::RequestSurfaceResolution(Surface* pending_surface) {
}
std::unique_ptr<Surface> SurfaceManager::CreateSurface(
- base::WeakPtr<SurfaceFactory> surface_factory,
+ base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support,
const LocalSurfaceId& local_surface_id) {
DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(local_surface_id.is_valid() && surface_factory);
+ DCHECK(local_surface_id.is_valid() && compositor_frame_sink_support);
- SurfaceId surface_id(surface_factory->frame_sink_id(), local_surface_id);
+ SurfaceId surface_id(compositor_frame_sink_support->frame_sink_id(),
+ local_surface_id);
// If no surface with this SurfaceId exists, simply create the surface and
// return.
auto surface_iter = surface_map_.find(surface_id);
if (surface_iter == surface_map_.end()) {
- auto surface = base::MakeUnique<Surface>(surface_id, surface_factory);
+ auto surface =
+ base::MakeUnique<Surface>(surface_id, compositor_frame_sink_support);
surface_map_[surface->surface_id()] = surface.get();
return surface;
}
@@ -108,7 +110,8 @@ std::unique_ptr<Surface> SurfaceManager::CreateSurface(
std::unique_ptr<Surface> surface = std::move(*it);
surfaces_to_destroy_.erase(it);
surface->set_destroyed(false);
- DCHECK_EQ(surface_factory.get(), surface->factory().get());
+ DCHECK_EQ(compositor_frame_sink_support.get(),
+ surface->compositor_frame_sink_support().get());
return surface;
}
@@ -400,15 +403,15 @@ void SurfaceManager::RemoveTemporaryReference(const SurfaceId& surface_id,
temporary_reference_ranges_.erase(frame_sink_id);
}
-void SurfaceManager::RegisterSurfaceFactoryClient(
+void SurfaceManager::RegisterCompositorFrameSinkSupport(
const FrameSinkId& frame_sink_id,
- SurfaceFactoryClient* client) {
- framesink_manager_.RegisterSurfaceFactoryClient(frame_sink_id, client);
+ CompositorFrameSinkSupport* support) {
+ framesink_manager_.RegisterCompositorFrameSinkSupport(frame_sink_id, support);
}
-void SurfaceManager::UnregisterSurfaceFactoryClient(
+void SurfaceManager::UnregisterCompositorFrameSinkSupport(
const FrameSinkId& frame_sink_id) {
- framesink_manager_.UnregisterSurfaceFactoryClient(frame_sink_id);
+ framesink_manager_.UnregisterCompositorFrameSinkSupport(frame_sink_id);
}
void SurfaceManager::RegisterBeginFrameSource(
@@ -458,9 +461,10 @@ void SurfaceManager::SurfaceCreated(const SurfaceInfo& surface_info) {
// We can get into a situation where multiple CompositorFrames arrive for
// a CompositorFrameSink before the client can add any references for the
// frame. When the second frame with a new size arrives, the first will be
- // destroyed in SurfaceFactory and then if there are no references it will
- // be deleted during surface GC. A temporary reference, removed when a
- // real reference is received, is added to prevent this from happening.
+ // destroyed in CompositorFrameSinkSupport and then if there are no
+ // references it will be deleted during surface GC. A temporary reference,
+ // removed when a real reference is received, is added to prevent this from
+ // happening.
auto it = child_to_parent_refs_.find(surface_info.id());
// TODO(fsamuel): Tests create empty sets and so we also need to check that
// they're not empty here. Ideally tests shouldn't do that and we shouldn't

Powered by Google App Engine
This is Rietveld 408576698