| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 | 8 | 
| 9 #include "base/bind.h" | 9 #include "base/bind.h" | 
| 10 #include "base/location.h" | 10 #include "base/location.h" | 
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 702         break; | 702         break; | 
| 703       case 19: | 703       case 19: | 
| 704         // Set another new frame, both layers should be damaged in the same | 704         // Set another new frame, both layers should be damaged in the same | 
| 705         // ways. | 705         // ways. | 
| 706         SetFrameData( | 706         SetFrameData( | 
| 707             CreateFrameData(gfx::Rect(0, 0, 10, 10), gfx::Rect(3, 3, 1, 1))); | 707             CreateFrameData(gfx::Rect(0, 0, 10, 10), gfx::Rect(3, 3, 1, 1))); | 
| 708     } | 708     } | 
| 709     first_draw_for_source_frame_ = true; | 709     first_draw_for_source_frame_ = true; | 
| 710   } | 710   } | 
| 711 | 711 | 
| 712   virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 712   virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread( | 
| 713                                      LayerTreeHostImpl::FrameData* frame, | 713       LayerTreeHostImpl* host_impl, | 
| 714                                      bool result) OVERRIDE { | 714       LayerTreeHostImpl::FrameData* frame, | 
| 715     EXPECT_TRUE(result); | 715       DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE { | 
|  | 716     EXPECT_EQ(DrawSwapReadbackResult::DRAW_SUCCESS, draw_result); | 
| 716 | 717 | 
| 717     if (!first_draw_for_source_frame_) | 718     if (!first_draw_for_source_frame_) | 
| 718       return result; | 719       return draw_result; | 
| 719 | 720 | 
| 720     gfx::RectF damage_rect; | 721     gfx::RectF damage_rect; | 
| 721     if (!frame->has_no_damage) { | 722     if (!frame->has_no_damage) { | 
| 722       damage_rect = frame->render_passes.back()->damage_rect; | 723       damage_rect = frame->render_passes.back()->damage_rect; | 
| 723     } else { | 724     } else { | 
| 724       // If there is no damage, then we have no render passes to send. | 725       // If there is no damage, then we have no render passes to send. | 
| 725       EXPECT_TRUE(frame->render_passes.empty()); | 726       EXPECT_TRUE(frame->render_passes.empty()); | 
| 726     } | 727     } | 
| 727 | 728 | 
| 728     switch (host_impl->active_tree()->source_frame_number()) { | 729     switch (host_impl->active_tree()->source_frame_number()) { | 
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 804                                   gfx::RectF(4.f, 0.f, 1.f, 1.f)).ToString(), | 805                                   gfx::RectF(4.f, 0.f, 1.f, 1.f)).ToString(), | 
| 805                   damage_rect.ToString()); | 806                   damage_rect.ToString()); | 
| 806         break; | 807         break; | 
| 807       case 19: | 808       case 19: | 
| 808         EXPECT_EQ(gfx::RectF(3.f, 3.f, 6.f, 1.f).ToString(), | 809         EXPECT_EQ(gfx::RectF(3.f, 3.f, 6.f, 1.f).ToString(), | 
| 809                   damage_rect.ToString()); | 810                   damage_rect.ToString()); | 
| 810         EndTest(); | 811         EndTest(); | 
| 811         break; | 812         break; | 
| 812     } | 813     } | 
| 813 | 814 | 
| 814     return result; | 815     return draw_result; | 
| 815   } | 816   } | 
| 816 | 817 | 
| 817  protected: | 818  protected: | 
| 818   scoped_refptr<DelegatedRendererLayer> delegated_copy_; | 819   scoped_refptr<DelegatedRendererLayer> delegated_copy_; | 
| 819   bool first_draw_for_source_frame_; | 820   bool first_draw_for_source_frame_; | 
| 820 }; | 821 }; | 
| 821 | 822 | 
| 822 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestLayerUsesFrameDamage); | 823 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestLayerUsesFrameDamage); | 
| 823 | 824 | 
| 824 class LayerTreeHostDelegatedTestMergeResources | 825 class LayerTreeHostDelegatedTestMergeResources | 
| (...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2334   } | 2335   } | 
| 2335 | 2336 | 
| 2336   scoped_refptr<DelegatedRendererLayer> delegated_thief_; | 2337   scoped_refptr<DelegatedRendererLayer> delegated_thief_; | 
| 2337 }; | 2338 }; | 
| 2338 | 2339 | 
| 2339 SINGLE_AND_MULTI_THREAD_TEST_F( | 2340 SINGLE_AND_MULTI_THREAD_TEST_F( | 
| 2340     LayerTreeHostDelegatedTestRemoveAndChangeResources); | 2341     LayerTreeHostDelegatedTestRemoveAndChangeResources); | 
| 2341 | 2342 | 
| 2342 }  // namespace | 2343 }  // namespace | 
| 2343 }  // namespace cc | 2344 }  // namespace cc | 
| OLD | NEW | 
|---|