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

Side by Side Diff: content/browser/renderer_host/delegated_frame_host.cc

Issue 2563783002: ui + mus: Split ContextFactory into ContextFactory(Client) and ContextFactoryPrivate (Closed)
Patch Set: Restore mash Created 4 years 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 last_compositor_frame_sink_id_(0), 72 last_compositor_frame_sink_id_(0),
73 pending_delegated_ack_count_(0), 73 pending_delegated_ack_count_(0),
74 skipped_frames_(false), 74 skipped_frames_(false),
75 background_color_(SK_ColorRED), 75 background_color_(SK_ColorRED),
76 current_scale_factor_(1.f), 76 current_scale_factor_(1.f),
77 can_lock_compositor_(YES_CAN_LOCK), 77 can_lock_compositor_(YES_CAN_LOCK),
78 delegated_frame_evictor_(new DelegatedFrameEvictor(this)) { 78 delegated_frame_evictor_(new DelegatedFrameEvictor(this)) {
79 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 79 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
80 factory->GetContextFactory()->AddObserver(this); 80 factory->GetContextFactory()->AddObserver(this);
81 id_allocator_.reset(new cc::SurfaceIdAllocator()); 81 id_allocator_.reset(new cc::SurfaceIdAllocator());
82 factory->GetContextFactory()->GetSurfaceManager()->RegisterFrameSinkId( 82 factory->GetContextFactoryPrivate()->GetSurfaceManager()->RegisterFrameSinkId(
83 frame_sink_id_); 83 frame_sink_id_);
84 factory->GetContextFactory() 84 factory->GetContextFactoryPrivate()
85 ->GetSurfaceManager() 85 ->GetSurfaceManager()
86 ->RegisterSurfaceFactoryClient(frame_sink_id_, this); 86 ->RegisterSurfaceFactoryClient(frame_sink_id_, this);
87 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( 87 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>(
88 frame_sink_id_, factory->GetContextFactory()->GetSurfaceManager(), this); 88 frame_sink_id_, factory->GetContextFactoryPrivate()->GetSurfaceManager(),
89 this);
89 } 90 }
90 91
91 void DelegatedFrameHost::WasShown(const ui::LatencyInfo& latency_info) { 92 void DelegatedFrameHost::WasShown(const ui::LatencyInfo& latency_info) {
92 delegated_frame_evictor_->SetVisible(true); 93 delegated_frame_evictor_->SetVisible(true);
93 94
94 if (!local_frame_id_.is_valid() && !released_front_lock_.get()) { 95 if (!local_frame_id_.is_valid() && !released_front_lock_.get()) {
95 if (compositor_) 96 if (compositor_)
96 released_front_lock_ = compositor_->GetCompositorLock(); 97 released_front_lock_ = compositor_->GetCompositorLock();
97 } 98 }
98 99
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 472
472 background_color_ = frame.metadata.root_background_color; 473 background_color_ = frame.metadata.root_background_color;
473 474
474 bool did_send_ack_callback = false; 475 bool did_send_ack_callback = false;
475 if (frame_size.IsEmpty()) { 476 if (frame_size.IsEmpty()) {
476 DCHECK(frame.resource_list.empty()); 477 DCHECK(frame.resource_list.empty());
477 EvictDelegatedFrame(); 478 EvictDelegatedFrame();
478 } else { 479 } else {
479 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 480 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
480 cc::SurfaceManager* manager = 481 cc::SurfaceManager* manager =
481 factory->GetContextFactory()->GetSurfaceManager(); 482 factory->GetContextFactoryPrivate()->GetSurfaceManager();
482 bool allocated_new_local_frame_id = false; 483 bool allocated_new_local_frame_id = false;
483 if (!local_frame_id_.is_valid() || frame_size != current_surface_size_ || 484 if (!local_frame_id_.is_valid() || frame_size != current_surface_size_ ||
484 frame_size_in_dip != current_frame_size_in_dip_) { 485 frame_size_in_dip != current_frame_size_in_dip_) {
485 local_frame_id_ = id_allocator_->GenerateId(); 486 local_frame_id_ = id_allocator_->GenerateId();
486 allocated_new_local_frame_id = true; 487 allocated_new_local_frame_id = true;
487 } 488 }
488 489
489 gfx::Size desired_size = client_->DelegatedFrameHostDesiredSizeInDIP(); 490 gfx::Size desired_size = client_->DelegatedFrameHostDesiredSizeInDIP();
490 if (desired_size != frame_size_in_dip && !desired_size.IsEmpty()) { 491 if (desired_size != frame_size_in_dip && !desired_size.IsEmpty()) {
491 skip_frame = true; 492 skip_frame = true;
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 } 827 }
827 828
828 //////////////////////////////////////////////////////////////////////////////// 829 ////////////////////////////////////////////////////////////////////////////////
829 // DelegatedFrameHost, private: 830 // DelegatedFrameHost, private:
830 831
831 DelegatedFrameHost::~DelegatedFrameHost() { 832 DelegatedFrameHost::~DelegatedFrameHost() {
832 DCHECK(!compositor_); 833 DCHECK(!compositor_);
833 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 834 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
834 factory->GetContextFactory()->RemoveObserver(this); 835 factory->GetContextFactory()->RemoveObserver(this);
835 surface_factory_->EvictSurface(); 836 surface_factory_->EvictSurface();
836 factory->GetContextFactory() 837 factory->GetContextFactoryPrivate()
837 ->GetSurfaceManager() 838 ->GetSurfaceManager()
838 ->UnregisterSurfaceFactoryClient(frame_sink_id_); 839 ->UnregisterSurfaceFactoryClient(frame_sink_id_);
839 factory->GetContextFactory()->GetSurfaceManager()->InvalidateFrameSinkId( 840 factory->GetContextFactoryPrivate()
840 frame_sink_id_); 841 ->GetSurfaceManager()
842 ->InvalidateFrameSinkId(frame_sink_id_);
841 843
842 DCHECK(!vsync_manager_.get()); 844 DCHECK(!vsync_manager_.get());
843 } 845 }
844 846
845 void DelegatedFrameHost::SetCompositor(ui::Compositor* compositor) { 847 void DelegatedFrameHost::SetCompositor(ui::Compositor* compositor) {
846 DCHECK(!compositor_); 848 DCHECK(!compositor_);
847 if (!compositor) 849 if (!compositor)
848 return; 850 return;
849 compositor_ = compositor; 851 compositor_ = compositor;
850 compositor_->AddObserver(this); 852 compositor_->AddObserver(this);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 std::move(request)); 889 std::move(request));
888 } 890 }
889 } 891 }
890 892
891 void DelegatedFrameHost::UnlockResources() { 893 void DelegatedFrameHost::UnlockResources() {
892 DCHECK(local_frame_id_.is_valid()); 894 DCHECK(local_frame_id_.is_valid());
893 delegated_frame_evictor_->UnlockFrame(); 895 delegated_frame_evictor_->UnlockFrame();
894 } 896 }
895 897
896 } // namespace content 898 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698