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

Unified Diff: cc/surfaces/surface_factory.cc

Issue 2383373002: Reduce SurfaceIdAllocator usage and tie SurfaceFactory to a single FrameSinkId (Closed)
Patch Set: Rebased 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
« no previous file with comments | « cc/surfaces/surface_factory.h ('k') | cc/surfaces/surface_factory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_factory.cc
diff --git a/cc/surfaces/surface_factory.cc b/cc/surfaces/surface_factory.cc
index 18cd8b33abd9726f46ca57c4de062c2f42e20fdf..5dbc9696ce3d11c1b435797064b540e5941df94e 100644
--- a/cc/surfaces/surface_factory.cc
+++ b/cc/surfaces/surface_factory.cc
@@ -15,13 +15,14 @@
#include "ui/gfx/geometry/size.h"
namespace cc {
-SurfaceFactory::SurfaceFactory(SurfaceManager* manager,
+SurfaceFactory::SurfaceFactory(const FrameSinkId& frame_sink_id,
+ SurfaceManager* manager,
SurfaceFactoryClient* client)
- : manager_(manager),
+ : frame_sink_id_(frame_sink_id),
+ manager_(manager),
client_(client),
holder_(client),
- needs_sync_points_(true) {
-}
+ needs_sync_points_(true) {}
SurfaceFactory::~SurfaceFactory() {
if (!surface_map_.empty()) {
@@ -40,6 +41,7 @@ void SurfaceFactory::DestroyAll() {
}
void SurfaceFactory::Create(const SurfaceId& surface_id) {
+ DCHECK(surface_id.frame_sink_id() == frame_sink_id_);
std::unique_ptr<Surface> surface(new Surface(surface_id, this));
manager_->RegisterSurface(surface.get());
DCHECK(!surface_map_.count(surface_id));
@@ -47,6 +49,7 @@ void SurfaceFactory::Create(const SurfaceId& surface_id) {
}
void SurfaceFactory::Destroy(const SurfaceId& surface_id) {
+ DCHECK(surface_id.frame_sink_id() == frame_sink_id_);
OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
DCHECK(it != surface_map_.end());
DCHECK(it->second->factory().get() == this);
@@ -58,6 +61,8 @@ void SurfaceFactory::Destroy(const SurfaceId& surface_id) {
void SurfaceFactory::SetPreviousFrameSurface(const SurfaceId& new_id,
const SurfaceId& old_id) {
+ DCHECK(new_id.frame_sink_id() == frame_sink_id_);
+ DCHECK(old_id.frame_sink_id() == frame_sink_id_);
OwningSurfaceMap::iterator it = surface_map_.find(new_id);
DCHECK(it != surface_map_.end());
Surface* old_surface = manager_->GetSurfaceForId(old_id);
@@ -70,6 +75,7 @@ void SurfaceFactory::SubmitCompositorFrame(const SurfaceId& surface_id,
CompositorFrame frame,
const DrawCallback& callback) {
TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame");
+ DCHECK(surface_id.frame_sink_id() == frame_sink_id_);
OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
DCHECK(it != surface_map_.end());
DCHECK(it->second->factory().get() == this);
@@ -83,6 +89,7 @@ void SurfaceFactory::SubmitCompositorFrame(const SurfaceId& surface_id,
void SurfaceFactory::RequestCopyOfSurface(
const SurfaceId& surface_id,
std::unique_ptr<CopyOutputRequest> copy_request) {
+ DCHECK(surface_id.frame_sink_id() == frame_sink_id_);
OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
if (it == surface_map_.end()) {
copy_request->SendEmptyResult();
@@ -95,6 +102,7 @@ void SurfaceFactory::RequestCopyOfSurface(
void SurfaceFactory::WillDrawSurface(const SurfaceId& id,
const gfx::Rect& damage_rect) {
+ DCHECK(id.frame_sink_id() == frame_sink_id_);
client_->WillDrawSurface(id, damage_rect);
}
« no previous file with comments | « cc/surfaces/surface_factory.h ('k') | cc/surfaces/surface_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698