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

Unified Diff: content/renderer/android/synchronous_compositor_frame_sink.cc

Issue 2485473003: Remove SurfaceFactory::Create and SurfaceFactory::Destroy (Closed)
Patch Set: up Created 4 years, 1 month 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/renderer/android/synchronous_compositor_frame_sink.cc
diff --git a/content/renderer/android/synchronous_compositor_frame_sink.cc b/content/renderer/android/synchronous_compositor_frame_sink.cc
index 36f96311be2b0e2788c98f8291aa50a940ecfe52..aedee52ad50ac891ccb720ada3cf48fbb03de0e6 100644
--- a/content/renderer/android/synchronous_compositor_frame_sink.cc
+++ b/content/renderer/android/synchronous_compositor_frame_sink.cc
@@ -122,7 +122,9 @@ SynchronousCompositorFrameSink::SynchronousCompositorFrameSink(
frame_swap_message_queue_(frame_swap_message_queue),
surface_manager_(new cc::SurfaceManager),
surface_id_allocator_(new cc::SurfaceIdAllocator()),
- surface_factory_(
+ root_factory_(
+ new cc::SurfaceFactory(kFrameSinkId, surface_manager_.get(), this)),
+ child_factory_(
new cc::SurfaceFactory(kFrameSinkId, surface_manager_.get(), this)),
begin_frame_source_(std::move(begin_frame_source)) {
DCHECK(registry_);
@@ -198,15 +200,12 @@ void SynchronousCompositorFrameSink::DetachFromClient() {
begin_frame_source_ = nullptr;
registry_->UnregisterCompositorFrameSink(routing_id_, this);
client_->SetTreeActivationCallback(base::Closure());
- if (root_local_frame_id_.is_valid()) {
- surface_factory_->Destroy(root_local_frame_id_);
- surface_factory_->Destroy(child_local_frame_id_);
- }
surface_manager_->UnregisterSurfaceFactoryClient(kFrameSinkId);
surface_manager_->InvalidateFrameSinkId(kFrameSinkId);
software_output_surface_ = nullptr;
display_ = nullptr;
- surface_factory_ = nullptr;
+ child_factory_ = nullptr;
+ root_factory_ = nullptr;
surface_id_allocator_ = nullptr;
surface_manager_ = nullptr;
cc::CompositorFrameSink::DetachFromClient();
@@ -237,9 +236,7 @@ void SynchronousCompositorFrameSink::SubmitCompositorFrame(
if (!root_local_frame_id_.is_valid()) {
root_local_frame_id_ = surface_id_allocator_->GenerateId();
- surface_factory_->Create(root_local_frame_id_);
child_local_frame_id_ = surface_id_allocator_->GenerateId();
- surface_factory_->Create(child_local_frame_id_);
}
display_->SetSurfaceId(cc::SurfaceId(kFrameSinkId, root_local_frame_id_),
@@ -288,11 +285,11 @@ void SynchronousCompositorFrameSink::SubmitCompositorFrame(
gfx::Rect(child_size),
cc::SurfaceId(kFrameSinkId, child_local_frame_id_));
- surface_factory_->SubmitCompositorFrame(
+ child_factory_->SubmitCompositorFrame(
child_local_frame_id_, std::move(frame), base::Bind(&NoOpDrawCallback));
- surface_factory_->SubmitCompositorFrame(root_local_frame_id_,
- std::move(embed_frame),
- base::Bind(&NoOpDrawCallback));
+ root_factory_->SubmitCompositorFrame(root_local_frame_id_,
+ std::move(embed_frame),
+ base::Bind(&NoOpDrawCallback));
display_->DrawAndSwap();
} else {
// For hardware draws we send the whole frame to the client so it can draw

Powered by Google App Engine
This is Rietveld 408576698