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

Unified Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 2166423002: ui::ContextFactory should not create SurfaceIdAllocators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Dana's nit Created 4 years, 5 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: content/browser/renderer_host/compositor_impl_android.cc
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index d563c6f287edba4550016f34fbc1d815c4e861d6..c06a342f3ef292467ccad377375d5cb5d342fec0 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -337,14 +337,8 @@ cc::SurfaceManager* CompositorImpl::GetSurfaceManager() {
}
// static
-std::unique_ptr<cc::SurfaceIdAllocator>
-CompositorImpl::CreateSurfaceIdAllocator() {
- std::unique_ptr<cc::SurfaceIdAllocator> allocator(
- new cc::SurfaceIdAllocator(++g_surface_client_id));
- cc::SurfaceManager* manager = GetSurfaceManager();
- DCHECK(manager);
- allocator->RegisterSurfaceClientId(manager);
- return allocator;
+uint32_t CompositorImpl::AllocateSurfaceClientId() {
+ return ++g_surface_client_id;
}
// static
@@ -363,7 +357,8 @@ CompositorImpl::SharedVulkanContextProviderAndroid() {
CompositorImpl::CompositorImpl(CompositorClient* client,
gfx::NativeWindow root_window)
- : surface_id_allocator_(CreateSurfaceIdAllocator()),
+ : surface_id_allocator_(
+ new cc::SurfaceIdAllocator(AllocateSurfaceClientId())),
resource_manager_(root_window),
has_transparent_background_(false),
device_scale_factor_(1),
@@ -377,6 +372,8 @@ CompositorImpl::CompositorImpl(CompositorClient* client,
output_surface_request_pending_(false),
needs_begin_frames_(false),
weak_factory_(this) {
+ GetSurfaceManager()->RegisterSurfaceClientId(
+ surface_id_allocator_->client_id());
DCHECK(client);
DCHECK(root_window);
DCHECK(root_window->GetLayer() == nullptr);
@@ -391,6 +388,8 @@ CompositorImpl::~CompositorImpl() {
root_window_->SetLayer(nullptr);
// Clean-up any surface references.
SetSurface(NULL);
+ GetSurfaceManager()->InvalidateSurfaceClientId(
+ surface_id_allocator_->client_id());
}
ui::UIResourceProvider& CompositorImpl::GetUIResourceProvider() {
« no previous file with comments | « content/browser/renderer_host/compositor_impl_android.h ('k') | content/browser/renderer_host/delegated_frame_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698