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

Unified Diff: ui/compositor/test/in_process_context_factory.cc

Issue 1808313002: Register surface namespace in BlimpUiContextFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move SurfaceManager to ContextFactory Created 4 years, 9 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 | « ui/compositor/test/in_process_context_factory.h ('k') | ui/views/mus/surface_context_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/test/in_process_context_factory.cc
diff --git a/ui/compositor/test/in_process_context_factory.cc b/ui/compositor/test/in_process_context_factory.cc
index 6d842554ae4d179ad5d8567fb45c6981ffe4f1ec..439b212832c6deac28e8dbf867358e19a55ab0aa 100644
--- a/ui/compositor/test/in_process_context_factory.cc
+++ b/ui/compositor/test/in_process_context_factory.cc
@@ -85,12 +85,11 @@ class DirectOutputSurface : public cc::OutputSurface {
} // namespace
InProcessContextFactory::InProcessContextFactory(
- bool context_factory_for_test,
- cc::SurfaceManager* surface_manager)
+ bool context_factory_for_test)
: next_surface_id_namespace_(1u),
use_test_surface_(true),
context_factory_for_test_(context_factory_for_test),
- surface_manager_(surface_manager) {
+ surface_manager_(new cc::SurfaceManager()) {
DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone)
<< "If running tests, ensure that main() is calling "
<< "gfx::GLSurfaceTestSupport::InitializeOneOff()";
@@ -151,26 +150,26 @@ void InProcessContextFactory::CreateOutputSurface(
context_provider, shared_worker_context_provider_));
}
- if (surface_manager_) {
- scoped_ptr<cc::OnscreenDisplayClient> display_client(
- new cc::OnscreenDisplayClient(
- std::move(real_output_surface), surface_manager_,
- GetSharedBitmapManager(), GetGpuMemoryBufferManager(),
- compositor->GetRendererSettings(), compositor->task_runner()));
- scoped_ptr<cc::SurfaceDisplayOutputSurface> surface_output_surface(
- new cc::SurfaceDisplayOutputSurface(
- surface_manager_, compositor->surface_id_allocator(),
- context_provider, shared_worker_context_provider_));
- display_client->set_surface_output_surface(surface_output_surface.get());
- surface_output_surface->set_display_client(display_client.get());
-
- compositor->SetOutputSurface(std::move(surface_output_surface));
-
- delete per_compositor_data_[compositor.get()];
- per_compositor_data_[compositor.get()] = display_client.release();
- } else {
- compositor->SetOutputSurface(std::move(real_output_surface));
- }
+ scoped_ptr<cc::OnscreenDisplayClient> display_client(
+ new cc::OnscreenDisplayClient(
+ std::move(real_output_surface), surface_manager_.get(),
+ GetSharedBitmapManager(), GetGpuMemoryBufferManager(),
+ compositor->GetRendererSettings(), compositor->task_runner()));
+ scoped_ptr<cc::SurfaceDisplayOutputSurface> surface_output_surface(
+ new cc::SurfaceDisplayOutputSurface(
+ surface_manager_.get(), compositor->surface_id_allocator(),
+ context_provider, shared_worker_context_provider_));
+ display_client->set_surface_output_surface(surface_output_surface.get());
+ surface_output_surface->set_display_client(display_client.get());
+
+ compositor->SetOutputSurface(std::move(surface_output_surface));
+
+ delete per_compositor_data_[compositor.get()];
+ per_compositor_data_[compositor.get()] = display_client.release();
+
+ // In tests, the OnscreenDisplayClient doesn't exist yet and so the resize
+ // message is missed. Instead of recording it for later, just resize now.
+ ResizeDisplay(compositor.get(), compositor->size());
enne (OOO) 2016/03/19 01:31:32 This was needed because when switching to surfaces
}
scoped_ptr<Reflector> InProcessContextFactory::CreateReflector(
@@ -228,17 +227,21 @@ cc::TaskGraphRunner* InProcessContextFactory::GetTaskGraphRunner() {
return &task_graph_runner_;
}
+cc::SurfaceManager* InProcessContextFactory::GetSurfaceManager() {
+ return surface_manager_.get();
+}
+
scoped_ptr<cc::SurfaceIdAllocator>
InProcessContextFactory::CreateSurfaceIdAllocator() {
scoped_ptr<cc::SurfaceIdAllocator> allocator(
new cc::SurfaceIdAllocator(next_surface_id_namespace_++));
- if (surface_manager_)
- allocator->RegisterSurfaceIdNamespace(surface_manager_);
+ allocator->RegisterSurfaceIdNamespace(surface_manager_.get());
return allocator;
}
void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor,
const gfx::Size& size) {
+ // If it doesn't exist yet, this will be called again later.
if (!per_compositor_data_.count(compositor))
return;
per_compositor_data_[compositor]->display()->Resize(size);
« no previous file with comments | « ui/compositor/test/in_process_context_factory.h ('k') | ui/views/mus/surface_context_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698