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

Unified Diff: cc/surfaces/direct_compositor_frame_sink.cc

Issue 2383373002: Reduce SurfaceIdAllocator usage and tie SurfaceFactory to a single FrameSinkId (Closed)
Patch Set: Fix TestRenderViewHost + Mac Created 4 years, 2 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/direct_compositor_frame_sink.cc
diff --git a/cc/surfaces/direct_compositor_frame_sink.cc b/cc/surfaces/direct_compositor_frame_sink.cc
index 7a75fe182f511ebdb0842884ca5280fe95652d98..f95d970baaeafd24509da8837d17dd79934fd56d 100644
--- a/cc/surfaces/direct_compositor_frame_sink.cc
+++ b/cc/surfaces/direct_compositor_frame_sink.cc
@@ -8,6 +8,7 @@
#include "cc/output/compositor_frame.h"
#include "cc/output/compositor_frame_sink_client.h"
#include "cc/surfaces/display.h"
+#include "cc/surfaces/frame_sink_id.h"
#include "cc/surfaces/surface.h"
#include "cc/surfaces/surface_id_allocator.h"
#include "cc/surfaces/surface_manager.h"
@@ -15,17 +16,18 @@
namespace cc {
DirectCompositorFrameSink::DirectCompositorFrameSink(
+ const FrameSinkId& frame_sink_id,
SurfaceManager* surface_manager,
- SurfaceIdAllocator* surface_id_allocator,
Display* display,
scoped_refptr<ContextProvider> context_provider,
scoped_refptr<ContextProvider> worker_context_provider)
: CompositorFrameSink(std::move(context_provider),
std::move(worker_context_provider)),
+ frame_sink_id_(frame_sink_id),
surface_manager_(surface_manager),
- surface_id_allocator_(surface_id_allocator),
+ surface_id_allocator_(frame_sink_id),
display_(display),
- factory_(surface_manager, this) {
+ factory_(frame_sink_id, surface_manager, this) {
DCHECK(thread_checker_.CalledOnValidThread());
capabilities_.can_force_reclaim_resources = true;
// Display and DirectCompositorFrameSink share a GL context, so sync
@@ -35,15 +37,16 @@ DirectCompositorFrameSink::DirectCompositorFrameSink(
}
DirectCompositorFrameSink::DirectCompositorFrameSink(
+ const FrameSinkId& frame_sink_id,
SurfaceManager* surface_manager,
- SurfaceIdAllocator* surface_id_allocator,
Display* display,
scoped_refptr<VulkanContextProvider> vulkan_context_provider)
: CompositorFrameSink(std::move(vulkan_context_provider)),
+ frame_sink_id_(frame_sink_id),
surface_manager_(surface_manager),
- surface_id_allocator_(surface_id_allocator),
+ surface_id_allocator_(frame_sink_id_),
display_(display),
- factory_(surface_manager, this) {
+ factory_(frame_sink_id_, surface_manager, this) {
DCHECK(thread_checker_.CalledOnValidThread());
capabilities_.can_force_reclaim_resources = true;
}
@@ -58,8 +61,7 @@ bool DirectCompositorFrameSink::BindToClient(
CompositorFrameSinkClient* client) {
DCHECK(thread_checker_.CalledOnValidThread());
- surface_manager_->RegisterSurfaceFactoryClient(
- surface_id_allocator_->frame_sink_id(), this);
+ surface_manager_->RegisterSurfaceFactoryClient(frame_sink_id_, this);
if (!CompositorFrameSink::BindToClient(client))
return false;
@@ -72,8 +74,7 @@ bool DirectCompositorFrameSink::BindToClient(
// Avoid initializing GL context here, as this should be sharing the
// Display's context.
- display_->Initialize(this, surface_manager_,
- surface_id_allocator_->frame_sink_id());
+ display_->Initialize(this, surface_manager_, frame_sink_id_);
return true;
}
@@ -82,8 +83,7 @@ void DirectCompositorFrameSink::DetachFromClient() {
// Unregister the SurfaceFactoryClient here instead of the dtor so that only
// one client is alive for this namespace at any given time.
- surface_manager_->UnregisterSurfaceFactoryClient(
- surface_id_allocator_->frame_sink_id());
+ surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_);
if (!delegated_surface_id_.is_null())
factory_.Destroy(delegated_surface_id_);
@@ -97,7 +97,7 @@ void DirectCompositorFrameSink::SwapBuffers(CompositorFrame frame) {
if (!delegated_surface_id_.is_null()) {
factory_.Destroy(delegated_surface_id_);
}
- delegated_surface_id_ = surface_id_allocator_->GenerateId();
+ delegated_surface_id_ = surface_id_allocator_.GenerateId();
factory_.Create(delegated_surface_id_);
last_swap_frame_size_ = frame_size;
}

Powered by Google App Engine
This is Rietveld 408576698