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

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

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