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

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

Issue 2485473003: Remove SurfaceFactory::Create and SurfaceFactory::Destroy (Closed)
Patch Set: SetPreviousFrame lint 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 4113e6210d05e592ebc7534a07c63e7f8867d2cf..779dd15d193425d9c9ac6533803d296bf5badd35 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,14 @@ 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_);
- }
+ root_factory_->Reset();
+ child_factory_->Reset();
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 +238,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_->SetLocalFrameId(root_local_frame_id_,
@@ -288,11 +287,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