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

Side by Side Diff: content/browser/renderer_host/delegated_frame_host.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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/delegated_frame_host.h" 5 #include "content/browser/renderer_host/delegated_frame_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 tick_clock_(new base::DefaultTickClock()), 68 tick_clock_(new base::DefaultTickClock()),
69 last_output_surface_id_(0), 69 last_output_surface_id_(0),
70 pending_delegated_ack_count_(0), 70 pending_delegated_ack_count_(0),
71 skipped_frames_(false), 71 skipped_frames_(false),
72 background_color_(SK_ColorRED), 72 background_color_(SK_ColorRED),
73 current_scale_factor_(1.f), 73 current_scale_factor_(1.f),
74 can_lock_compositor_(YES_CAN_LOCK), 74 can_lock_compositor_(YES_CAN_LOCK),
75 delegated_frame_evictor_(new DelegatedFrameEvictor(this)) { 75 delegated_frame_evictor_(new DelegatedFrameEvictor(this)) {
76 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 76 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
77 factory->GetContextFactory()->AddObserver(this); 77 factory->GetContextFactory()->AddObserver(this);
78 id_allocator_ = factory->GetContextFactory()->CreateSurfaceIdAllocator(); 78 id_allocator_.reset(new cc::SurfaceIdAllocator(
79 factory->GetContextFactory()->AllocateSurfaceClientId()));
80 factory->GetSurfaceManager()->RegisterSurfaceClientId(
81 id_allocator_->client_id());
79 factory->GetSurfaceManager()->RegisterSurfaceFactoryClient( 82 factory->GetSurfaceManager()->RegisterSurfaceFactoryClient(
80 id_allocator_->client_id(), this); 83 id_allocator_->client_id(), this);
81 } 84 }
82 85
83 void DelegatedFrameHost::WasShown(const ui::LatencyInfo& latency_info) { 86 void DelegatedFrameHost::WasShown(const ui::LatencyInfo& latency_info) {
84 delegated_frame_evictor_->SetVisible(true); 87 delegated_frame_evictor_->SetVisible(true);
85 88
86 if (surface_id_.is_null() && !released_front_lock_.get()) { 89 if (surface_id_.is_null() && !released_front_lock_.get()) {
87 if (compositor_) 90 if (compositor_)
88 released_front_lock_ = compositor_->GetCompositorLock(); 91 released_front_lock_ = compositor_->GetCompositorLock();
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 814
812 DelegatedFrameHost::~DelegatedFrameHost() { 815 DelegatedFrameHost::~DelegatedFrameHost() {
813 DCHECK(!compositor_); 816 DCHECK(!compositor_);
814 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 817 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
815 factory->GetContextFactory()->RemoveObserver(this); 818 factory->GetContextFactory()->RemoveObserver(this);
816 819
817 if (!surface_id_.is_null()) 820 if (!surface_id_.is_null())
818 surface_factory_->Destroy(surface_id_); 821 surface_factory_->Destroy(surface_id_);
819 factory->GetSurfaceManager()->UnregisterSurfaceFactoryClient( 822 factory->GetSurfaceManager()->UnregisterSurfaceFactoryClient(
820 id_allocator_->client_id()); 823 id_allocator_->client_id());
824 factory->GetSurfaceManager()->InvalidateSurfaceClientId(
825 id_allocator_->client_id());
821 826
822 DCHECK(!vsync_manager_.get()); 827 DCHECK(!vsync_manager_.get());
823 } 828 }
824 829
825 void DelegatedFrameHost::SetCompositor(ui::Compositor* compositor) { 830 void DelegatedFrameHost::SetCompositor(ui::Compositor* compositor) {
826 DCHECK(!compositor_); 831 DCHECK(!compositor_);
827 if (!compositor) 832 if (!compositor)
828 return; 833 return;
829 compositor_ = compositor; 834 compositor_ = compositor;
830 compositor_->AddObserver(this); 835 compositor_->AddObserver(this);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 904 cc::SurfaceManager* manager = factory->GetSurfaceManager();
900 new_layer->SetShowSurface( 905 new_layer->SetShowSurface(
901 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), 906 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)),
902 base::Bind(&RequireCallback, base::Unretained(manager)), 907 base::Bind(&RequireCallback, base::Unretained(manager)),
903 current_surface_size_, current_scale_factor_, 908 current_surface_size_, current_scale_factor_,
904 current_frame_size_in_dip_); 909 current_frame_size_in_dip_);
905 } 910 }
906 } 911 }
907 912
908 } // namespace content 913 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698