| OLD | NEW |
| 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 Loading... |
| 68 compositor_(nullptr), | 68 compositor_(nullptr), |
| 69 tick_clock_(new base::DefaultTickClock()), | 69 tick_clock_(new base::DefaultTickClock()), |
| 70 last_output_surface_id_(0), | 70 last_output_surface_id_(0), |
| 71 pending_delegated_ack_count_(0), | 71 pending_delegated_ack_count_(0), |
| 72 skipped_frames_(false), | 72 skipped_frames_(false), |
| 73 background_color_(SK_ColorRED), | 73 background_color_(SK_ColorRED), |
| 74 current_scale_factor_(1.f), | 74 current_scale_factor_(1.f), |
| 75 can_lock_compositor_(YES_CAN_LOCK), | 75 can_lock_compositor_(YES_CAN_LOCK), |
| 76 delegated_frame_evictor_(new DelegatedFrameEvictor(this)) { | 76 delegated_frame_evictor_(new DelegatedFrameEvictor(this)) { |
| 77 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 77 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 78 factory->AddObserver(this); | 78 factory->GetContextFactory()->AddObserver(this); |
| 79 id_allocator_ = factory->GetContextFactory()->CreateSurfaceIdAllocator(); | 79 id_allocator_ = factory->GetContextFactory()->CreateSurfaceIdAllocator(); |
| 80 factory->GetSurfaceManager()->RegisterSurfaceFactoryClient( | 80 factory->GetSurfaceManager()->RegisterSurfaceFactoryClient( |
| 81 id_allocator_->id_namespace(), this); | 81 id_allocator_->id_namespace(), this); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void DelegatedFrameHost::WasShown(const ui::LatencyInfo& latency_info) { | 84 void DelegatedFrameHost::WasShown(const ui::LatencyInfo& latency_info) { |
| 85 delegated_frame_evictor_->SetVisible(true); | 85 delegated_frame_evictor_->SetVisible(true); |
| 86 | 86 |
| 87 if (surface_id_.is_null() && !released_front_lock_.get()) { | 87 if (surface_id_.is_null() && !released_front_lock_.get()) { |
| 88 if (compositor_) | 88 if (compositor_) |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 | 802 |
| 803 client_->DelegatedFrameHostOnLostCompositorResources(); | 803 client_->DelegatedFrameHostOnLostCompositorResources(); |
| 804 } | 804 } |
| 805 | 805 |
| 806 //////////////////////////////////////////////////////////////////////////////// | 806 //////////////////////////////////////////////////////////////////////////////// |
| 807 // DelegatedFrameHost, private: | 807 // DelegatedFrameHost, private: |
| 808 | 808 |
| 809 DelegatedFrameHost::~DelegatedFrameHost() { | 809 DelegatedFrameHost::~DelegatedFrameHost() { |
| 810 DCHECK(!compositor_); | 810 DCHECK(!compositor_); |
| 811 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 811 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 812 factory->RemoveObserver(this); | 812 factory->GetContextFactory()->RemoveObserver(this); |
| 813 | 813 |
| 814 if (!surface_id_.is_null()) | 814 if (!surface_id_.is_null()) |
| 815 surface_factory_->Destroy(surface_id_); | 815 surface_factory_->Destroy(surface_id_); |
| 816 factory->GetSurfaceManager()->UnregisterSurfaceFactoryClient( | 816 factory->GetSurfaceManager()->UnregisterSurfaceFactoryClient( |
| 817 id_allocator_->id_namespace()); | 817 id_allocator_->id_namespace()); |
| 818 | 818 |
| 819 DCHECK(!vsync_manager_.get()); | 819 DCHECK(!vsync_manager_.get()); |
| 820 } | 820 } |
| 821 | 821 |
| 822 void DelegatedFrameHost::SetCompositor(ui::Compositor* compositor) { | 822 void DelegatedFrameHost::SetCompositor(ui::Compositor* compositor) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 896 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
| 897 new_layer->SetShowSurface( | 897 new_layer->SetShowSurface( |
| 898 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 898 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
| 899 base::Bind(&RequireCallback, base::Unretained(manager)), | 899 base::Bind(&RequireCallback, base::Unretained(manager)), |
| 900 current_surface_size_, current_scale_factor_, | 900 current_surface_size_, current_scale_factor_, |
| 901 current_frame_size_in_dip_); | 901 current_frame_size_in_dip_); |
| 902 } | 902 } |
| 903 } | 903 } |
| 904 | 904 |
| 905 } // namespace content | 905 } // namespace content |
| OLD | NEW |