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

Unified Diff: ui/android/delegated_frame_host_android.cc

Issue 2476303004: Make SurfaceFactory lifetime match frame_sink_id_ registration in DelegatedFrameHostAndroid (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/delegated_frame_host_android.cc
diff --git a/ui/android/delegated_frame_host_android.cc b/ui/android/delegated_frame_host_android.cc
index 2412a064cafee54b1f30112c9ce1ac3679e5ccf4..72e98ef7652d61b7db05a1ccf08f52793176c361 100644
--- a/ui/android/delegated_frame_host_android.cc
+++ b/ui/android/delegated_frame_host_android.cc
@@ -85,6 +85,8 @@ DelegatedFrameHostAndroid::DelegatedFrameHostAndroid(
ui::ContextProviderFactory::GetInstance()->GetSurfaceManager();
surface_id_allocator_.reset(new cc::SurfaceIdAllocator());
surface_manager_->RegisterFrameSinkId(frame_sink_id_);
+ surface_factory_ = base::WrapUnique(
+ new cc::SurfaceFactory(frame_sink_id_, surface_manager_, this));
background_layer_->SetBackgroundColor(background_color);
view_->GetLayer()->AddChild(background_layer_);
@@ -106,11 +108,6 @@ DelegatedFrameHostAndroid::FrameData::~FrameData() = default;
void DelegatedFrameHostAndroid::SubmitCompositorFrame(
cc::CompositorFrame frame,
cc::SurfaceFactory::DrawCallback draw_callback) {
- if (!surface_factory_) {
- surface_factory_ = base::WrapUnique(
- new cc::SurfaceFactory(frame_sink_id_, surface_manager_, this));
- }
-
cc::RenderPass* root_pass = frame.render_pass_list.back().get();
gfx::Size surface_size = root_pass->output_rect.size();
@@ -191,7 +188,6 @@ void DelegatedFrameHostAndroid::DestroyDelegatedContent() {
if (!current_frame_)
return;
- DCHECK(surface_factory_.get());
DCHECK(content_layer_);
content_layer_->RemoveFromParent();
@@ -208,7 +204,7 @@ bool DelegatedFrameHostAndroid::HasDelegatedContent() const {
void DelegatedFrameHostAndroid::CompositorFrameSinkChanged() {
DestroyDelegatedContent();
- surface_factory_.reset();
+ surface_factory_->Reset();
}
void DelegatedFrameHostAndroid::UpdateBackgroundColor(SkColor color) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698