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

Unified Diff: content/test/test_render_view_host.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 | « content/test/test_render_view_host.h ('k') | services/ui/surfaces/compositor_frame_sink.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/test_render_view_host.cc
diff --git a/content/test/test_render_view_host.cc b/content/test/test_render_view_host.cc
index 70cd8b1fb03486446974c6c78af4de21d65520a6..d23784f6354093d8900a131c35e95f5a730f3a37 100644
--- a/content/test/test_render_view_host.cc
+++ b/content/test/test_render_view_host.cc
@@ -69,18 +69,18 @@ TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh)
#if defined(OS_ANDROID)
// Not all tests initialize or need a context provider factory.
if (ContextProviderFactoryImpl::GetInstance()) {
- surface_id_allocator_.reset(
- new cc::SurfaceIdAllocator(AllocateFrameSinkId()));
- GetSurfaceManager()->RegisterFrameSinkId(
- surface_id_allocator_->frame_sink_id());
+ frame_sink_id_ = AllocateFrameSinkId();
+ surface_id_allocator_ =
+ base::MakeUnique<cc::SurfaceIdAllocator>(frame_sink_id_);
+ GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_);
}
#else
// Not all tests initialize or need an image transport factory.
if (ImageTransportFactory::GetInstance()) {
- surface_id_allocator_.reset(
- new cc::SurfaceIdAllocator(AllocateFrameSinkId()));
- GetSurfaceManager()->RegisterFrameSinkId(
- surface_id_allocator_->frame_sink_id());
+ frame_sink_id_ = AllocateFrameSinkId();
+ surface_id_allocator_ =
+ base::MakeUnique<cc::SurfaceIdAllocator>(frame_sink_id_);
+ GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_);
}
#endif
@@ -96,7 +96,7 @@ TestRenderWidgetHostView::~TestRenderWidgetHostView() {
manager = GetSurfaceManager();
#endif
if (manager) {
- manager->InvalidateFrameSinkId(surface_id_allocator_->frame_sink_id());
+ manager->InvalidateFrameSinkId(frame_sink_id_);
}
}
@@ -229,10 +229,7 @@ void TestRenderWidgetHostView::UnlockMouse() {
}
cc::FrameSinkId TestRenderWidgetHostView::GetFrameSinkId() {
- // See constructor. If a test needs this, its harness needs to construct an
- // ImageTransportFactory.
- DCHECK(surface_id_allocator_);
- return surface_id_allocator_->frame_sink_id();
+ return frame_sink_id_;
}
TestRenderViewHost::TestRenderViewHost(
« no previous file with comments | « content/test/test_render_view_host.h ('k') | services/ui/surfaces/compositor_frame_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698