| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 ->GetSurfaceManager() | 63 ->GetSurfaceManager() |
| 64 ->RegisterSurfaceFactoryClient(frame_sink_id_, this); | 64 ->RegisterSurfaceFactoryClient(frame_sink_id_, this); |
| 65 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( | 65 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( |
| 66 frame_sink_id_, factory->GetContextFactoryPrivate()->GetSurfaceManager(), | 66 frame_sink_id_, factory->GetContextFactoryPrivate()->GetSurfaceManager(), |
| 67 this); | 67 this); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void DelegatedFrameHost::WasShown(const ui::LatencyInfo& latency_info) { | 70 void DelegatedFrameHost::WasShown(const ui::LatencyInfo& latency_info) { |
| 71 delegated_frame_evictor_->SetVisible(true); | 71 delegated_frame_evictor_->SetVisible(true); |
| 72 | 72 |
| 73 if (!local_frame_id_.is_valid() && !released_front_lock_.get()) { | 73 if (!local_surface_id_.is_valid() && !released_front_lock_.get()) { |
| 74 if (compositor_) | 74 if (compositor_) |
| 75 released_front_lock_ = compositor_->GetCompositorLock(); | 75 released_front_lock_ = compositor_->GetCompositorLock(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 if (compositor_) { | 78 if (compositor_) { |
| 79 compositor_->SetLatencyInfo(latency_info); | 79 compositor_->SetLatencyInfo(latency_info); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool DelegatedFrameHost::HasSavedFrame() { | 83 bool DelegatedFrameHost::HasSavedFrame() { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 191 } |
| 192 | 192 |
| 193 cc::FrameSinkId DelegatedFrameHost::GetFrameSinkId() { | 193 cc::FrameSinkId DelegatedFrameHost::GetFrameSinkId() { |
| 194 return frame_sink_id_; | 194 return frame_sink_id_; |
| 195 } | 195 } |
| 196 | 196 |
| 197 cc::SurfaceId DelegatedFrameHost::SurfaceIdAtPoint( | 197 cc::SurfaceId DelegatedFrameHost::SurfaceIdAtPoint( |
| 198 cc::SurfaceHittestDelegate* delegate, | 198 cc::SurfaceHittestDelegate* delegate, |
| 199 const gfx::Point& point, | 199 const gfx::Point& point, |
| 200 gfx::Point* transformed_point) { | 200 gfx::Point* transformed_point) { |
| 201 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); | 201 cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_); |
| 202 if (!surface_id.is_valid()) | 202 if (!surface_id.is_valid()) |
| 203 return surface_id; | 203 return surface_id; |
| 204 cc::SurfaceHittest hittest(delegate, GetSurfaceManager()); | 204 cc::SurfaceHittest hittest(delegate, GetSurfaceManager()); |
| 205 gfx::Transform target_transform; | 205 gfx::Transform target_transform; |
| 206 cc::SurfaceId target_local_frame_id = | 206 cc::SurfaceId target_local_surface_id = |
| 207 hittest.GetTargetSurfaceAtPoint(surface_id, point, &target_transform); | 207 hittest.GetTargetSurfaceAtPoint(surface_id, point, &target_transform); |
| 208 *transformed_point = point; | 208 *transformed_point = point; |
| 209 if (target_local_frame_id.is_valid()) | 209 if (target_local_surface_id.is_valid()) |
| 210 target_transform.TransformPoint(transformed_point); | 210 target_transform.TransformPoint(transformed_point); |
| 211 return target_local_frame_id; | 211 return target_local_surface_id; |
| 212 } | 212 } |
| 213 | 213 |
| 214 bool DelegatedFrameHost::TransformPointToLocalCoordSpace( | 214 bool DelegatedFrameHost::TransformPointToLocalCoordSpace( |
| 215 const gfx::Point& point, | 215 const gfx::Point& point, |
| 216 const cc::SurfaceId& original_surface, | 216 const cc::SurfaceId& original_surface, |
| 217 gfx::Point* transformed_point) { | 217 gfx::Point* transformed_point) { |
| 218 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); | 218 cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_); |
| 219 if (!surface_id.is_valid()) | 219 if (!surface_id.is_valid()) |
| 220 return false; | 220 return false; |
| 221 *transformed_point = point; | 221 *transformed_point = point; |
| 222 if (original_surface == surface_id) | 222 if (original_surface == surface_id) |
| 223 return true; | 223 return true; |
| 224 | 224 |
| 225 cc::SurfaceHittest hittest(nullptr, GetSurfaceManager()); | 225 cc::SurfaceHittest hittest(nullptr, GetSurfaceManager()); |
| 226 return hittest.TransformPointToTargetSurface(original_surface, surface_id, | 226 return hittest.TransformPointToTargetSurface(original_surface, surface_id, |
| 227 transformed_point); | 227 transformed_point); |
| 228 } | 228 } |
| 229 | 229 |
| 230 bool DelegatedFrameHost::TransformPointToCoordSpaceForView( | 230 bool DelegatedFrameHost::TransformPointToCoordSpaceForView( |
| 231 const gfx::Point& point, | 231 const gfx::Point& point, |
| 232 RenderWidgetHostViewBase* target_view, | 232 RenderWidgetHostViewBase* target_view, |
| 233 gfx::Point* transformed_point) { | 233 gfx::Point* transformed_point) { |
| 234 if (!local_frame_id_.is_valid()) | 234 if (!local_surface_id_.is_valid()) |
| 235 return false; | 235 return false; |
| 236 | 236 |
| 237 return target_view->TransformPointToLocalCoordSpace( | 237 return target_view->TransformPointToLocalCoordSpace( |
| 238 point, cc::SurfaceId(frame_sink_id_, local_frame_id_), transformed_point); | 238 point, cc::SurfaceId(frame_sink_id_, local_surface_id_), |
| 239 transformed_point); |
| 239 } | 240 } |
| 240 | 241 |
| 241 bool DelegatedFrameHost::ShouldSkipFrame(gfx::Size size_in_dip) const { | 242 bool DelegatedFrameHost::ShouldSkipFrame(gfx::Size size_in_dip) const { |
| 242 // Should skip a frame only when another frame from the renderer is guaranteed | 243 // Should skip a frame only when another frame from the renderer is guaranteed |
| 243 // to replace it. Otherwise may cause hangs when the renderer is waiting for | 244 // to replace it. Otherwise may cause hangs when the renderer is waiting for |
| 244 // the completion of latency infos (such as when taking a Snapshot.) | 245 // the completion of latency infos (such as when taking a Snapshot.) |
| 245 if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || | 246 if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || |
| 246 can_lock_compositor_ == NO_PENDING_COMMIT || !resize_lock_.get()) | 247 can_lock_compositor_ == NO_PENDING_COMMIT || !resize_lock_.get()) |
| 247 return false; | 248 return false; |
| 248 | 249 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 259 } | 260 } |
| 260 | 261 |
| 261 SkColor DelegatedFrameHost::GetGutterColor() const { | 262 SkColor DelegatedFrameHost::GetGutterColor() const { |
| 262 // In fullscreen mode resizing is uncommon, so it makes more sense to | 263 // In fullscreen mode resizing is uncommon, so it makes more sense to |
| 263 // make the initial switch to fullscreen mode look better by using black as | 264 // make the initial switch to fullscreen mode look better by using black as |
| 264 // the gutter color. | 265 // the gutter color. |
| 265 return client_->DelegatedFrameHostGetGutterColor(background_color_); | 266 return client_->DelegatedFrameHostGetGutterColor(background_color_); |
| 266 } | 267 } |
| 267 | 268 |
| 268 void DelegatedFrameHost::UpdateGutters() { | 269 void DelegatedFrameHost::UpdateGutters() { |
| 269 if (!local_frame_id_.is_valid()) { | 270 if (!local_surface_id_.is_valid()) { |
| 270 right_gutter_.reset(); | 271 right_gutter_.reset(); |
| 271 bottom_gutter_.reset(); | 272 bottom_gutter_.reset(); |
| 272 return; | 273 return; |
| 273 } | 274 } |
| 274 | 275 |
| 275 if (current_frame_size_in_dip_.width() < | 276 if (current_frame_size_in_dip_.width() < |
| 276 client_->DelegatedFrameHostDesiredSizeInDIP().width()) { | 277 client_->DelegatedFrameHostDesiredSizeInDIP().width()) { |
| 277 right_gutter_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); | 278 right_gutter_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); |
| 278 right_gutter_->SetColor(GetGutterColor()); | 279 right_gutter_->SetColor(GetGutterColor()); |
| 279 int width = client_->DelegatedFrameHostDesiredSizeInDIP().width() - | 280 int width = client_->DelegatedFrameHostDesiredSizeInDIP().width() - |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // DelegatedFrameHost (e.g., a call to CopyFromCompositingSurface() for | 364 // DelegatedFrameHost (e.g., a call to CopyFromCompositingSurface() for |
| 364 // screenshots) since those copy requests do not specify |frame_subscriber()| | 365 // screenshots) since those copy requests do not specify |frame_subscriber()| |
| 365 // as a source. | 366 // as a source. |
| 366 request->set_source(frame_subscriber()); | 367 request->set_source(frame_subscriber()); |
| 367 if (subscriber_texture.get()) { | 368 if (subscriber_texture.get()) { |
| 368 request->SetTextureMailbox(cc::TextureMailbox( | 369 request->SetTextureMailbox(cc::TextureMailbox( |
| 369 subscriber_texture->mailbox(), subscriber_texture->sync_token(), | 370 subscriber_texture->mailbox(), subscriber_texture->sync_token(), |
| 370 subscriber_texture->target())); | 371 subscriber_texture->target())); |
| 371 } | 372 } |
| 372 | 373 |
| 373 if (local_frame_id_.is_valid()) { | 374 if (local_surface_id_.is_valid()) { |
| 374 // To avoid unnecessary composites, go directly to the Surface rather than | 375 // To avoid unnecessary composites, go directly to the Surface rather than |
| 375 // through RequestCopyOfOutput (which goes through the browser | 376 // through RequestCopyOfOutput (which goes through the browser |
| 376 // compositor). | 377 // compositor). |
| 377 if (!request_copy_of_output_callback_for_testing_.is_null()) | 378 if (!request_copy_of_output_callback_for_testing_.is_null()) |
| 378 request_copy_of_output_callback_for_testing_.Run(std::move(request)); | 379 request_copy_of_output_callback_for_testing_.Run(std::move(request)); |
| 379 else | 380 else |
| 380 surface_factory_->RequestCopyOfSurface(std::move(request)); | 381 surface_factory_->RequestCopyOfSurface(std::move(request)); |
| 381 } else { | 382 } else { |
| 382 request->set_area(gfx::Rect(current_frame_size_in_dip_)); | 383 request->set_area(gfx::Rect(current_frame_size_in_dip_)); |
| 383 RequestCopyOfOutput(std::move(request)); | 384 RequestCopyOfOutput(std::move(request)); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 background_color_ = frame.metadata.root_background_color; | 452 background_color_ = frame.metadata.root_background_color; |
| 452 | 453 |
| 453 bool did_send_ack_callback = false; | 454 bool did_send_ack_callback = false; |
| 454 if (frame_size.IsEmpty()) { | 455 if (frame_size.IsEmpty()) { |
| 455 DCHECK(frame.resource_list.empty()); | 456 DCHECK(frame.resource_list.empty()); |
| 456 EvictDelegatedFrame(); | 457 EvictDelegatedFrame(); |
| 457 } else { | 458 } else { |
| 458 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 459 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 459 cc::SurfaceManager* manager = | 460 cc::SurfaceManager* manager = |
| 460 factory->GetContextFactoryPrivate()->GetSurfaceManager(); | 461 factory->GetContextFactoryPrivate()->GetSurfaceManager(); |
| 461 bool allocated_new_local_frame_id = false; | 462 bool allocated_new_local_surface_id = false; |
| 462 if (!local_frame_id_.is_valid() || frame_size != current_surface_size_ || | 463 if (!local_surface_id_.is_valid() || frame_size != current_surface_size_ || |
| 463 frame_size_in_dip != current_frame_size_in_dip_) { | 464 frame_size_in_dip != current_frame_size_in_dip_) { |
| 464 local_frame_id_ = id_allocator_->GenerateId(); | 465 local_surface_id_ = id_allocator_->GenerateId(); |
| 465 allocated_new_local_frame_id = true; | 466 allocated_new_local_surface_id = true; |
| 466 } | 467 } |
| 467 | 468 |
| 468 gfx::Size desired_size = client_->DelegatedFrameHostDesiredSizeInDIP(); | 469 gfx::Size desired_size = client_->DelegatedFrameHostDesiredSizeInDIP(); |
| 469 if (desired_size != frame_size_in_dip && !desired_size.IsEmpty()) { | 470 if (desired_size != frame_size_in_dip && !desired_size.IsEmpty()) { |
| 470 skip_frame = true; | 471 skip_frame = true; |
| 471 skipped_latency_info_list_.insert(skipped_latency_info_list_.end(), | 472 skipped_latency_info_list_.insert(skipped_latency_info_list_.end(), |
| 472 frame.metadata.latency_info.begin(), | 473 frame.metadata.latency_info.begin(), |
| 473 frame.metadata.latency_info.end()); | 474 frame.metadata.latency_info.end()); |
| 474 frame.metadata.latency_info.clear(); | 475 frame.metadata.latency_info.clear(); |
| 475 } else { | 476 } else { |
| 476 frame.metadata.latency_info.insert(frame.metadata.latency_info.end(), | 477 frame.metadata.latency_info.insert(frame.metadata.latency_info.end(), |
| 477 skipped_latency_info_list_.begin(), | 478 skipped_latency_info_list_.begin(), |
| 478 skipped_latency_info_list_.end()); | 479 skipped_latency_info_list_.end()); |
| 479 skipped_latency_info_list_.clear(); | 480 skipped_latency_info_list_.clear(); |
| 480 } | 481 } |
| 481 | 482 |
| 482 cc::SurfaceFactory::DrawCallback ack_callback; | 483 cc::SurfaceFactory::DrawCallback ack_callback; |
| 483 if (compositor_ && !skip_frame) { | 484 if (compositor_ && !skip_frame) { |
| 484 ack_callback = base::Bind(&DelegatedFrameHost::SurfaceDrawn, AsWeakPtr(), | 485 ack_callback = base::Bind(&DelegatedFrameHost::SurfaceDrawn, AsWeakPtr(), |
| 485 compositor_frame_sink_id); | 486 compositor_frame_sink_id); |
| 486 did_send_ack_callback = true; | 487 did_send_ack_callback = true; |
| 487 } | 488 } |
| 488 surface_factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame), | 489 surface_factory_->SubmitCompositorFrame(local_surface_id_, std::move(frame), |
| 489 ack_callback); | 490 ack_callback); |
| 490 if (allocated_new_local_frame_id) { | 491 if (allocated_new_local_surface_id) { |
| 491 // manager must outlive compositors using it. | 492 // manager must outlive compositors using it. |
| 492 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); | 493 cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_); |
| 493 cc::SurfaceInfo surface_info(surface_id, frame_device_scale_factor, | 494 cc::SurfaceInfo surface_info(surface_id, frame_device_scale_factor, |
| 494 frame_size); | 495 frame_size); |
| 495 client_->DelegatedFrameHostGetLayer()->SetShowSurface( | 496 client_->DelegatedFrameHostGetLayer()->SetShowSurface( |
| 496 surface_info, manager->reference_factory()); | 497 surface_info, manager->reference_factory()); |
| 497 current_surface_size_ = frame_size; | 498 current_surface_size_ = frame_size; |
| 498 current_scale_factor_ = frame_device_scale_factor; | 499 current_scale_factor_ = frame_device_scale_factor; |
| 499 } | 500 } |
| 500 } | 501 } |
| 501 released_front_lock_ = NULL; | 502 released_front_lock_ = NULL; |
| 502 current_frame_size_in_dip_ = frame_size_in_dip; | 503 current_frame_size_in_dip_ = frame_size_in_dip; |
| 503 CheckResizeLock(); | 504 CheckResizeLock(); |
| 504 | 505 |
| 505 UpdateGutters(); | 506 UpdateGutters(); |
| 506 | 507 |
| 507 if (!damage_rect_in_dip.IsEmpty()) { | 508 if (!damage_rect_in_dip.IsEmpty()) { |
| 508 client_->DelegatedFrameHostGetLayer()->OnDelegatedFrameDamage( | 509 client_->DelegatedFrameHostGetLayer()->OnDelegatedFrameDamage( |
| 509 damage_rect_in_dip); | 510 damage_rect_in_dip); |
| 510 } | 511 } |
| 511 | 512 |
| 512 // Note that |compositor_| may be reset by SetShowSurface or | 513 // Note that |compositor_| may be reset by SetShowSurface or |
| 513 // SetShowDelegatedContent above. | 514 // SetShowDelegatedContent above. |
| 514 if (!compositor_ || skip_frame) { | 515 if (!compositor_ || skip_frame) { |
| 515 SendReclaimCompositorResources(compositor_frame_sink_id, | 516 SendReclaimCompositorResources(compositor_frame_sink_id, |
| 516 !did_send_ack_callback /* is_swap_ack */); | 517 !did_send_ack_callback /* is_swap_ack */); |
| 517 } else { | 518 } else { |
| 518 can_lock_compositor_ = NO_PENDING_COMMIT; | 519 can_lock_compositor_ = NO_PENDING_COMMIT; |
| 519 } | 520 } |
| 520 if (local_frame_id_.is_valid()) { | 521 if (local_surface_id_.is_valid()) { |
| 521 delegated_frame_evictor_->SwappedFrame( | 522 delegated_frame_evictor_->SwappedFrame( |
| 522 client_->DelegatedFrameHostIsVisible()); | 523 client_->DelegatedFrameHostIsVisible()); |
| 523 } | 524 } |
| 524 // Note: the frame may have been evicted immediately. | 525 // Note: the frame may have been evicted immediately. |
| 525 } | 526 } |
| 526 | 527 |
| 527 void DelegatedFrameHost::ClearDelegatedFrame() { | 528 void DelegatedFrameHost::ClearDelegatedFrame() { |
| 528 if (local_frame_id_.is_valid()) | 529 if (local_surface_id_.is_valid()) |
| 529 EvictDelegatedFrame(); | 530 EvictDelegatedFrame(); |
| 530 } | 531 } |
| 531 | 532 |
| 532 void DelegatedFrameHost::SendReclaimCompositorResources( | 533 void DelegatedFrameHost::SendReclaimCompositorResources( |
| 533 uint32_t compositor_frame_sink_id, | 534 uint32_t compositor_frame_sink_id, |
| 534 bool is_swap_ack) { | 535 bool is_swap_ack) { |
| 535 client_->DelegatedFrameHostSendReclaimCompositorResources( | 536 client_->DelegatedFrameHostSendReclaimCompositorResources( |
| 536 compositor_frame_sink_id, is_swap_ack, surface_returned_resources_); | 537 compositor_frame_sink_id, is_swap_ack, surface_returned_resources_); |
| 537 surface_returned_resources_.clear(); | 538 surface_returned_resources_.clear(); |
| 538 if (is_swap_ack) { | 539 if (is_swap_ack) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 551 if (resources.empty()) | 552 if (resources.empty()) |
| 552 return; | 553 return; |
| 553 std::copy(resources.begin(), resources.end(), | 554 std::copy(resources.begin(), resources.end(), |
| 554 std::back_inserter(surface_returned_resources_)); | 555 std::back_inserter(surface_returned_resources_)); |
| 555 if (!pending_delegated_ack_count_) { | 556 if (!pending_delegated_ack_count_) { |
| 556 SendReclaimCompositorResources(last_compositor_frame_sink_id_, | 557 SendReclaimCompositorResources(last_compositor_frame_sink_id_, |
| 557 false /* is_swap_ack */); | 558 false /* is_swap_ack */); |
| 558 } | 559 } |
| 559 } | 560 } |
| 560 | 561 |
| 561 void DelegatedFrameHost::WillDrawSurface(const cc::LocalFrameId& id, | 562 void DelegatedFrameHost::WillDrawSurface(const cc::LocalSurfaceId& id, |
| 562 const gfx::Rect& damage_rect) { | 563 const gfx::Rect& damage_rect) { |
| 563 // Frame subscribers are only interested in changes to the target surface, so | 564 // Frame subscribers are only interested in changes to the target surface, so |
| 564 // do not attempt capture if |damage_rect| is empty. This prevents the draws | 565 // do not attempt capture if |damage_rect| is empty. This prevents the draws |
| 565 // of parent surfaces from triggering extra frame captures, which can affect | 566 // of parent surfaces from triggering extra frame captures, which can affect |
| 566 // smoothness. | 567 // smoothness. |
| 567 if (id != local_frame_id_ || damage_rect.IsEmpty()) | 568 if (id != local_surface_id_ || damage_rect.IsEmpty()) |
| 568 return; | 569 return; |
| 569 AttemptFrameSubscriberCapture(damage_rect); | 570 AttemptFrameSubscriberCapture(damage_rect); |
| 570 } | 571 } |
| 571 | 572 |
| 572 void DelegatedFrameHost::SetBeginFrameSource( | 573 void DelegatedFrameHost::SetBeginFrameSource( |
| 573 cc::BeginFrameSource* begin_frame_source) { | 574 cc::BeginFrameSource* begin_frame_source) { |
| 574 client_->SetBeginFrameSource(begin_frame_source); | 575 client_->SetBeginFrameSource(begin_frame_source); |
| 575 } | 576 } |
| 576 | 577 |
| 577 void DelegatedFrameHost::EvictDelegatedFrame() { | 578 void DelegatedFrameHost::EvictDelegatedFrame() { |
| 578 client_->DelegatedFrameHostGetLayer()->SetShowSolidColorContent(); | 579 client_->DelegatedFrameHostGetLayer()->SetShowSolidColorContent(); |
| 579 if (local_frame_id_.is_valid()) { | 580 if (local_surface_id_.is_valid()) { |
| 580 surface_factory_->EvictSurface(); | 581 surface_factory_->EvictSurface(); |
| 581 local_frame_id_ = cc::LocalFrameId(); | 582 local_surface_id_ = cc::LocalSurfaceId(); |
| 582 } | 583 } |
| 583 delegated_frame_evictor_->DiscardedFrame(); | 584 delegated_frame_evictor_->DiscardedFrame(); |
| 584 UpdateGutters(); | 585 UpdateGutters(); |
| 585 } | 586 } |
| 586 | 587 |
| 587 // static | 588 // static |
| 588 void DelegatedFrameHost::ReturnSubscriberTexture( | 589 void DelegatedFrameHost::ReturnSubscriberTexture( |
| 589 base::WeakPtr<DelegatedFrameHost> dfh, | 590 base::WeakPtr<DelegatedFrameHost> dfh, |
| 590 scoped_refptr<OwnedMailbox> subscriber_texture, | 591 scoped_refptr<OwnedMailbox> subscriber_texture, |
| 591 const gpu::SyncToken& sync_token) { | 592 const gpu::SyncToken& sync_token) { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 void DelegatedFrameHost::OnUpdateVSyncParameters(base::TimeTicks timebase, | 792 void DelegatedFrameHost::OnUpdateVSyncParameters(base::TimeTicks timebase, |
| 792 base::TimeDelta interval) { | 793 base::TimeDelta interval) { |
| 793 vsync_timebase_ = timebase; | 794 vsync_timebase_ = timebase; |
| 794 vsync_interval_ = interval; | 795 vsync_interval_ = interval; |
| 795 } | 796 } |
| 796 | 797 |
| 797 //////////////////////////////////////////////////////////////////////////////// | 798 //////////////////////////////////////////////////////////////////////////////// |
| 798 // DelegatedFrameHost, ImageTransportFactoryObserver implementation: | 799 // DelegatedFrameHost, ImageTransportFactoryObserver implementation: |
| 799 | 800 |
| 800 void DelegatedFrameHost::OnLostResources() { | 801 void DelegatedFrameHost::OnLostResources() { |
| 801 if (local_frame_id_.is_valid()) | 802 if (local_surface_id_.is_valid()) |
| 802 EvictDelegatedFrame(); | 803 EvictDelegatedFrame(); |
| 803 idle_frame_subscriber_textures_.clear(); | 804 idle_frame_subscriber_textures_.clear(); |
| 804 yuv_readback_pipeline_.reset(); | 805 yuv_readback_pipeline_.reset(); |
| 805 } | 806 } |
| 806 | 807 |
| 807 //////////////////////////////////////////////////////////////////////////////// | 808 //////////////////////////////////////////////////////////////////////////////// |
| 808 // DelegatedFrameHost, private: | 809 // DelegatedFrameHost, private: |
| 809 | 810 |
| 810 DelegatedFrameHost::~DelegatedFrameHost() { | 811 DelegatedFrameHost::~DelegatedFrameHost() { |
| 811 DCHECK(!compositor_); | 812 DCHECK(!compositor_); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 if (vsync_manager_) { | 848 if (vsync_manager_) { |
| 848 vsync_manager_->RemoveObserver(this); | 849 vsync_manager_->RemoveObserver(this); |
| 849 vsync_manager_ = nullptr; | 850 vsync_manager_ = nullptr; |
| 850 } | 851 } |
| 851 | 852 |
| 852 compositor_->RemoveFrameSink(frame_sink_id_); | 853 compositor_->RemoveFrameSink(frame_sink_id_); |
| 853 compositor_ = nullptr; | 854 compositor_ = nullptr; |
| 854 } | 855 } |
| 855 | 856 |
| 856 void DelegatedFrameHost::LockResources() { | 857 void DelegatedFrameHost::LockResources() { |
| 857 DCHECK(local_frame_id_.is_valid()); | 858 DCHECK(local_surface_id_.is_valid()); |
| 858 delegated_frame_evictor_->LockFrame(); | 859 delegated_frame_evictor_->LockFrame(); |
| 859 } | 860 } |
| 860 | 861 |
| 861 void DelegatedFrameHost::RequestCopyOfOutput( | 862 void DelegatedFrameHost::RequestCopyOfOutput( |
| 862 std::unique_ptr<cc::CopyOutputRequest> request) { | 863 std::unique_ptr<cc::CopyOutputRequest> request) { |
| 863 if (!request_copy_of_output_callback_for_testing_.is_null()) { | 864 if (!request_copy_of_output_callback_for_testing_.is_null()) { |
| 864 request_copy_of_output_callback_for_testing_.Run(std::move(request)); | 865 request_copy_of_output_callback_for_testing_.Run(std::move(request)); |
| 865 } else { | 866 } else { |
| 866 client_->DelegatedFrameHostGetLayer()->RequestCopyOfOutput( | 867 client_->DelegatedFrameHostGetLayer()->RequestCopyOfOutput( |
| 867 std::move(request)); | 868 std::move(request)); |
| 868 } | 869 } |
| 869 } | 870 } |
| 870 | 871 |
| 871 void DelegatedFrameHost::UnlockResources() { | 872 void DelegatedFrameHost::UnlockResources() { |
| 872 DCHECK(local_frame_id_.is_valid()); | 873 DCHECK(local_surface_id_.is_valid()); |
| 873 delegated_frame_evictor_->UnlockFrame(); | 874 delegated_frame_evictor_->UnlockFrame(); |
| 874 } | 875 } |
| 875 | 876 |
| 876 } // namespace content | 877 } // namespace content |
| OLD | NEW |