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

Side by Side Diff: cc/surfaces/surface_aggregator.cc

Issue 2140783002: services/ui: Detect when a video is playing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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 "cc/surfaces/surface_aggregator.h" 5 #include "cc/surfaces/surface_aggregator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 695
696 CHECK(debug_weak_this.get()); 696 CHECK(debug_weak_this.get());
697 for (const auto& render_pass : frame_data->render_pass_list) { 697 for (const auto& render_pass : frame_data->render_pass_list) {
698 if (!render_pass->copy_requests.empty()) { 698 if (!render_pass->copy_requests.empty()) {
699 RenderPassId remapped_pass_id = RemapPassId(render_pass->id, surface_id); 699 RenderPassId remapped_pass_id = RemapPassId(render_pass->id, surface_id);
700 copy_request_passes_.insert(remapped_pass_id); 700 copy_request_passes_.insert(remapped_pass_id);
701 } 701 }
702 } 702 }
703 703
704 referenced_surfaces_.erase(it); 704 referenced_surfaces_.erase(it);
705 if (!damage_rect.IsEmpty() && surface_frame.metadata.may_contain_video)
enne (OOO) 2016/07/25 19:17:35 Why does the damage rect come into play here? If y
sadrul 2016/07/26 04:39:20 Yes. The window server will need to notify observe
enne (OOO) 2016/07/26 21:43:54 Hmm, makes sense for paused videos, thanks for the
706 result->may_contain_video = true;
705 return damage_rect; 707 return damage_rect;
706 } 708 }
707 709
708 void SurfaceAggregator::CopyUndrawnSurfaces(PrewalkResult* prewalk_result) { 710 void SurfaceAggregator::CopyUndrawnSurfaces(PrewalkResult* prewalk_result) {
709 // undrawn_surfaces are Surfaces that were identified by prewalk as being 711 // undrawn_surfaces are Surfaces that were identified by prewalk as being
710 // referenced by a drawn Surface, but aren't contained in a SurfaceDrawQuad. 712 // referenced by a drawn Surface, but aren't contained in a SurfaceDrawQuad.
711 // They need to be iterated over to ensure that any copy requests on them 713 // They need to be iterated over to ensure that any copy requests on them
712 // (or on Surfaces they reference) are executed. 714 // (or on Surfaces they reference) are executed.
713 std::vector<SurfaceId> surfaces_to_copy( 715 std::vector<SurfaceId> surfaces_to_copy(
714 prewalk_result->undrawn_surfaces.begin(), 716 prewalk_result->undrawn_surfaces.begin(),
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 781
780 dest_resource_list_ = &frame.delegated_frame_data->resource_list; 782 dest_resource_list_ = &frame.delegated_frame_data->resource_list;
781 dest_pass_list_ = &frame.delegated_frame_data->render_pass_list; 783 dest_pass_list_ = &frame.delegated_frame_data->render_pass_list;
782 784
783 valid_surfaces_.clear(); 785 valid_surfaces_.clear();
784 PrewalkResult prewalk_result; 786 PrewalkResult prewalk_result;
785 root_damage_rect_ = 787 root_damage_rect_ =
786 PrewalkTree(surface_id, false, RenderPassId(), &prewalk_result); 788 PrewalkTree(surface_id, false, RenderPassId(), &prewalk_result);
787 PropagateCopyRequestPasses(); 789 PropagateCopyRequestPasses();
788 has_copy_requests_ = !copy_request_passes_.empty(); 790 has_copy_requests_ = !copy_request_passes_.empty();
791 frame.metadata.may_contain_video = prewalk_result.may_contain_video;
789 792
790 CopyUndrawnSurfaces(&prewalk_result); 793 CopyUndrawnSurfaces(&prewalk_result);
791 SurfaceSet::iterator it = referenced_surfaces_.insert(surface_id).first; 794 SurfaceSet::iterator it = referenced_surfaces_.insert(surface_id).first;
792 CopyPasses(root_surface_frame.delegated_frame_data.get(), surface); 795 CopyPasses(root_surface_frame.delegated_frame_data.get(), surface);
793 referenced_surfaces_.erase(it); 796 referenced_surfaces_.erase(it);
794 797
795 moved_pixel_passes_.clear(); 798 moved_pixel_passes_.clear();
796 copy_request_passes_.clear(); 799 copy_request_passes_.clear();
797 render_pass_dependencies_.clear(); 800 render_pass_dependencies_.clear();
798 801
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 834
832 void SurfaceAggregator::SetFullDamageForSurface(const SurfaceId& surface_id) { 835 void SurfaceAggregator::SetFullDamageForSurface(const SurfaceId& surface_id) {
833 auto it = previous_contained_surfaces_.find(surface_id); 836 auto it = previous_contained_surfaces_.find(surface_id);
834 if (it == previous_contained_surfaces_.end()) 837 if (it == previous_contained_surfaces_.end())
835 return; 838 return;
836 // Set the last drawn index as 0 to ensure full damage next time it's drawn. 839 // Set the last drawn index as 0 to ensure full damage next time it's drawn.
837 it->second = 0; 840 it->second = 0;
838 } 841 }
839 842
840 } // namespace cc 843 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698