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

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

Issue 2752833002: cc: Use gpu raster in HUD. (Closed)
Patch Set: fix failing test. Created 3 years, 7 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 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 // video frames should not be reused by the VideoFrameProvider, but 992 // video frames should not be reused by the VideoFrameProvider, but
993 // software frames can be. 993 // software frames can be.
994 hw_frame_provider_.set_frame(NULL); 994 hw_frame_provider_.set_frame(NULL);
995 scaled_hw_frame_provider_.set_frame(NULL); 995 scaled_hw_frame_provider_.set_frame(NULL);
996 } 996 }
997 } 997 }
998 998
999 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 999 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
1000 LayerTreeHostImpl::FrameData* frame, 1000 LayerTreeHostImpl::FrameData* frame,
1001 DrawResult draw_result) override { 1001 DrawResult draw_result) override {
1002 if (host_impl->active_tree()->source_frame_number() == 2) {
1003 // Lose the context during draw on the second commit. This will cause
1004 // a third commit to recover.
1005 context3d_->set_times_bind_texture_succeeds(0);
1006 }
sohanjg_ 2017/05/11 14:47:21 This was causing the context loss cb to be execute
1007 return draw_result; 1002 return draw_result;
1008 } 1003 }
1009 1004
1010 void RequestNewCompositorFrameSink() override { 1005 void RequestNewCompositorFrameSink() override {
1011 // This will get called twice: 1006 // This will get called twice:
1012 // First when we create the initial CompositorFrameSink... 1007 // First when we create the initial CompositorFrameSink...
1013 if (layer_tree_host()->SourceFrameNumber() > 0) { 1008 if (layer_tree_host()->SourceFrameNumber() > 0) {
1014 // ... and then again after we forced the context to be lost. 1009 // ... and then again after we forced the context to be lost.
1015 lost_context_ = true; 1010 lost_context_ = true;
1016 } 1011 }
1017 LayerTreeHostContextTest::RequestNewCompositorFrameSink(); 1012 LayerTreeHostContextTest::RequestNewCompositorFrameSink();
1018 } 1013 }
1019 1014
1020 void DidCommitAndDrawFrame() override { 1015 void DidCommitAndDrawFrame() override {
1021 ASSERT_TRUE(layer_tree_host()->hud_layer()); 1016 ASSERT_TRUE(layer_tree_host()->hud_layer());
1017
1018 if (layer_tree_host()->SourceFrameNumber() == 2) {
1019 // Lose the context after draw on the second commit. This will cause
1020 // a third commit to recover.
1021 context3d_->set_times_bind_texture_succeeds(0);
1022 }
1023
1022 // End the test once we know the 3nd frame drew. 1024 // End the test once we know the 3nd frame drew.
1023 if (layer_tree_host()->SourceFrameNumber() < 5) { 1025 if (layer_tree_host()->SourceFrameNumber() < 5) {
1024 layer_tree_host()->root_layer()->SetNeedsDisplay(); 1026 layer_tree_host()->root_layer()->SetNeedsDisplay();
1025 layer_tree_host()->SetNeedsCommit(); 1027 layer_tree_host()->SetNeedsCommit();
1026 } else { 1028 } else {
1027 EndTest(); 1029 EndTest();
1028 } 1030 }
1029 } 1031 }
1030 1032
1031 void AfterTest() override { EXPECT_TRUE(lost_context_); } 1033 void AfterTest() override { EXPECT_TRUE(lost_context_); }
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 1640
1639 FakeContentLayerClient client_; 1641 FakeContentLayerClient client_;
1640 int num_draws_ = 0; 1642 int num_draws_ = 0;
1641 }; 1643 };
1642 1644
1643 MULTI_THREAD_TEST_F( 1645 MULTI_THREAD_TEST_F(
1644 LayerTreeHostContextTestLoseWorkerContextDuringPrepareTiles); 1646 LayerTreeHostContextTestLoseWorkerContextDuringPrepareTiles);
1645 1647
1646 } // namespace 1648 } // namespace
1647 } // namespace cc 1649 } // namespace cc
OLDNEW
« cc/layers/heads_up_display_layer_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