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

Side by Side Diff: cc/trees/layer_tree_host_unittest_context.cc

Issue 2961633002: cc: HUD handle context lost in Gpu raster.
Patch Set: update Created 3 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "cc/base/filter_operations.h" 9 #include "cc/base/filter_operations.h"
10 #include "cc/layers/heads_up_display_layer.h" 10 #include "cc/layers/heads_up_display_layer.h"
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 // video frames should not be reused by the VideoFrameProvider, but 995 // video frames should not be reused by the VideoFrameProvider, but
996 // software frames can be. 996 // software frames can be.
997 hw_frame_provider_.set_frame(NULL); 997 hw_frame_provider_.set_frame(NULL);
998 scaled_hw_frame_provider_.set_frame(NULL); 998 scaled_hw_frame_provider_.set_frame(NULL);
999 } 999 }
1000 } 1000 }
1001 1001
1002 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 1002 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
1003 LayerTreeHostImpl::FrameData* frame, 1003 LayerTreeHostImpl::FrameData* frame,
1004 DrawResult draw_result) override { 1004 DrawResult draw_result) override {
1005 if (host_impl->active_tree()->source_frame_number() == 2) {
1006 // Lose the context after draw on the second commit. This will cause
1007 // a third commit to recover.
1008 context3d_->set_times_bind_texture_succeeds(0);
1009 }
1005 return draw_result; 1010 return draw_result;
1006 } 1011 }
1007 1012
1008 void RequestNewLayerTreeFrameSink() override { 1013 void RequestNewLayerTreeFrameSink() override {
1009 // This will get called twice: 1014 // This will get called twice:
1010 // First when we create the initial LayerTreeFrameSink... 1015 // First when we create the initial LayerTreeFrameSink...
1011 if (layer_tree_host()->SourceFrameNumber() > 0) { 1016 if (layer_tree_host()->SourceFrameNumber() > 0) {
1012 // ... and then again after we forced the context to be lost. 1017 // ... and then again after we forced the context to be lost.
1013 lost_context_ = true; 1018 lost_context_ = true;
1014 } 1019 }
1015 LayerTreeHostContextTest::RequestNewLayerTreeFrameSink(); 1020 LayerTreeHostContextTest::RequestNewLayerTreeFrameSink();
1016 } 1021 }
1017 1022
1018 void DidCommitAndDrawFrame() override { 1023 void DidCommitAndDrawFrame() override {
1019 ASSERT_TRUE(layer_tree_host()->hud_layer()); 1024 ASSERT_TRUE(layer_tree_host()->hud_layer());
1020
1021 if (layer_tree_host()->SourceFrameNumber() == 2) {
1022 // Lose the context after draw on the second commit. This will cause
1023 // a third commit to recover.
1024 context3d_->set_times_bind_texture_succeeds(0);
1025 }
1026
1027 // End the test once we know the 3nd frame drew. 1025 // End the test once we know the 3nd frame drew.
1028 if (layer_tree_host()->SourceFrameNumber() < 5) { 1026 if (layer_tree_host()->SourceFrameNumber() < 5) {
1029 layer_tree_host()->root_layer()->SetNeedsDisplay(); 1027 layer_tree_host()->root_layer()->SetNeedsDisplay();
1030 layer_tree_host()->SetNeedsCommit(); 1028 layer_tree_host()->SetNeedsCommit();
1031 } else { 1029 } else {
1032 EndTest(); 1030 EndTest();
1033 } 1031 }
1034 } 1032 }
1035 1033
1036 void AfterTest() override { EXPECT_TRUE(lost_context_); } 1034 void AfterTest() override { EXPECT_TRUE(lost_context_); }
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 1641
1644 FakeContentLayerClient client_; 1642 FakeContentLayerClient client_;
1645 int num_draws_ = 0; 1643 int num_draws_ = 0;
1646 }; 1644 };
1647 1645
1648 MULTI_THREAD_TEST_F( 1646 MULTI_THREAD_TEST_F(
1649 LayerTreeHostContextTestLoseWorkerContextDuringPrepareTiles); 1647 LayerTreeHostContextTestLoseWorkerContextDuringPrepareTiles);
1650 1648
1651 } // namespace 1649 } // namespace
1652 } // namespace cc 1650 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698