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

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 comments. 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 // video frames should not be reused by the VideoFrameProvider, but 996 // video frames should not be reused by the VideoFrameProvider, but
997 // software frames can be. 997 // software frames can be.
998 hw_frame_provider_.set_frame(NULL); 998 hw_frame_provider_.set_frame(NULL);
999 scaled_hw_frame_provider_.set_frame(NULL); 999 scaled_hw_frame_provider_.set_frame(NULL);
1000 } 1000 }
1001 } 1001 }
1002 1002
1003 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 1003 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
1004 LayerTreeHostImpl::FrameData* frame, 1004 LayerTreeHostImpl::FrameData* frame,
1005 DrawResult draw_result) override { 1005 DrawResult draw_result) override {
1006 if (host_impl->active_tree()->source_frame_number() == 2) {
1007 // Lose the context after draw on the second commit. This will cause
1008 // a third commit to recover.
1009 context3d_->set_times_bind_texture_succeeds(0);
1010 }
1006 return draw_result; 1011 return draw_result;
1007 } 1012 }
1008 1013
1009 void RequestNewLayerTreeFrameSink() override { 1014 void RequestNewLayerTreeFrameSink() override {
1010 // This will get called twice: 1015 // This will get called twice:
1011 // First when we create the initial LayerTreeFrameSink... 1016 // First when we create the initial LayerTreeFrameSink...
1012 if (layer_tree_host()->SourceFrameNumber() > 0) { 1017 if (layer_tree_host()->SourceFrameNumber() > 0) {
1013 // ... and then again after we forced the context to be lost. 1018 // ... and then again after we forced the context to be lost.
1014 lost_context_ = true; 1019 lost_context_ = true;
1015 } 1020 }
1016 LayerTreeHostContextTest::RequestNewLayerTreeFrameSink(); 1021 LayerTreeHostContextTest::RequestNewLayerTreeFrameSink();
1017 } 1022 }
1018 1023
1019 void DidCommitAndDrawFrame() override { 1024 void DidCommitAndDrawFrame() override {
1020 ASSERT_TRUE(layer_tree_host()->hud_layer()); 1025 ASSERT_TRUE(layer_tree_host()->hud_layer());
1021
1022 if (layer_tree_host()->SourceFrameNumber() == 2) {
1023 // Lose the context after draw on the second commit. This will cause
1024 // a third commit to recover.
1025 context3d_->set_times_bind_texture_succeeds(0);
1026 }
1027
1028 // End the test once we know the 3nd frame drew. 1026 // End the test once we know the 3nd frame drew.
1029 if (layer_tree_host()->SourceFrameNumber() < 5) { 1027 if (layer_tree_host()->SourceFrameNumber() < 5) {
1030 layer_tree_host()->root_layer()->SetNeedsDisplay(); 1028 layer_tree_host()->root_layer()->SetNeedsDisplay();
1031 layer_tree_host()->SetNeedsCommit(); 1029 layer_tree_host()->SetNeedsCommit();
1032 } else { 1030 } else {
1033 EndTest(); 1031 EndTest();
1034 } 1032 }
1035 } 1033 }
1036 1034
1037 void AfterTest() override { EXPECT_TRUE(lost_context_); } 1035 void AfterTest() override { EXPECT_TRUE(lost_context_); }
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 1642
1645 FakeContentLayerClient client_; 1643 FakeContentLayerClient client_;
1646 int num_draws_ = 0; 1644 int num_draws_ = 0;
1647 }; 1645 };
1648 1646
1649 MULTI_THREAD_TEST_F( 1647 MULTI_THREAD_TEST_F(
1650 LayerTreeHostContextTestLoseWorkerContextDuringPrepareTiles); 1648 LayerTreeHostContextTestLoseWorkerContextDuringPrepareTiles);
1651 1649
1652 } // namespace 1650 } // namespace
1653 } // namespace cc 1651 } // namespace cc
OLDNEW
« no previous file with comments | « 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