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

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

Issue 22926024: cc: Control activation from the Scheduler (Closed) Base URL: http://git.chromium.org/chromium/src.git@schedOutputSurface4
Patch Set: git cl format Created 7 years, 3 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') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 class LayerTreeHostImplTest : public testing::Test, 62 class LayerTreeHostImplTest : public testing::Test,
63 public LayerTreeHostImplClient { 63 public LayerTreeHostImplClient {
64 public: 64 public:
65 LayerTreeHostImplTest() 65 LayerTreeHostImplTest()
66 : proxy_(), 66 : proxy_(),
67 always_impl_thread_(&proxy_), 67 always_impl_thread_(&proxy_),
68 always_main_thread_blocked_(&proxy_), 68 always_main_thread_blocked_(&proxy_),
69 did_try_initialize_renderer_(false), 69 did_try_initialize_renderer_(false),
70 on_can_draw_state_changed_called_(false), 70 on_can_draw_state_changed_called_(false),
71 has_pending_tree_(false), 71 did_notify_ready_to_activate_(false),
72 did_request_commit_(false), 72 did_request_commit_(false),
73 did_request_redraw_(false), 73 did_request_redraw_(false),
74 did_upload_visible_tile_(false), 74 did_upload_visible_tile_(false),
75 reduce_memory_result_(true), 75 reduce_memory_result_(true),
76 current_limit_bytes_(0), 76 current_limit_bytes_(0),
77 current_priority_cutoff_value_(0) { 77 current_priority_cutoff_value_(0) {
78 media::InitializeMediaLibraryForTesting(); 78 media::InitializeMediaLibraryForTesting();
79 } 79 }
80 80
81 virtual void SetUp() OVERRIDE { 81 virtual void SetUp() OVERRIDE {
(...skipping 17 matching lines...) Expand all
99 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE { 99 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE {
100 did_try_initialize_renderer_ = true; 100 did_try_initialize_renderer_ = true;
101 } 101 }
102 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {} 102 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {}
103 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {} 103 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {}
104 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) 104 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args)
105 OVERRIDE {} 105 OVERRIDE {}
106 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE { 106 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE {
107 on_can_draw_state_changed_called_ = true; 107 on_can_draw_state_changed_called_ = true;
108 } 108 }
109 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE { 109 virtual void NotifyReadyToActivate() OVERRIDE {
110 has_pending_tree_ = has_pending_tree; 110 did_notify_ready_to_activate_ = true;
111 host_impl_->ActivatePendingTree();
111 } 112 }
112 virtual void SetNeedsRedrawOnImplThread() OVERRIDE { 113 virtual void SetNeedsRedrawOnImplThread() OVERRIDE {
113 did_request_redraw_ = true; 114 did_request_redraw_ = true;
114 } 115 }
115 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) OVERRIDE { 116 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) OVERRIDE {
116 did_request_redraw_ = true; 117 did_request_redraw_ = true;
117 } 118 }
118 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE { 119 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE {
119 did_upload_visible_tile_ = true; 120 did_upload_visible_tile_ = true;
120 } 121 }
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 } 347 }
347 348
348 FakeProxy proxy_; 349 FakeProxy proxy_;
349 DebugScopedSetImplThread always_impl_thread_; 350 DebugScopedSetImplThread always_impl_thread_;
350 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; 351 DebugScopedSetMainThreadBlocked always_main_thread_blocked_;
351 352
352 scoped_ptr<LayerTreeHostImpl> host_impl_; 353 scoped_ptr<LayerTreeHostImpl> host_impl_;
353 FakeRenderingStatsInstrumentation stats_instrumentation_; 354 FakeRenderingStatsInstrumentation stats_instrumentation_;
354 bool did_try_initialize_renderer_; 355 bool did_try_initialize_renderer_;
355 bool on_can_draw_state_changed_called_; 356 bool on_can_draw_state_changed_called_;
356 bool has_pending_tree_; 357 bool did_notify_ready_to_activate_;
357 bool did_request_commit_; 358 bool did_request_commit_;
358 bool did_request_redraw_; 359 bool did_request_redraw_;
359 bool did_upload_visible_tile_; 360 bool did_upload_visible_tile_;
360 bool reduce_memory_result_; 361 bool reduce_memory_result_;
361 base::TimeDelta requested_scrollbar_animation_delay_; 362 base::TimeDelta requested_scrollbar_animation_delay_;
362 size_t current_limit_bytes_; 363 size_t current_limit_bytes_;
363 int current_priority_cutoff_value_; 364 int current_priority_cutoff_value_;
364 }; 365 };
365 366
366 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { 367 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) {
(...skipping 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after
3015 bool always_draw = true; 3016 bool always_draw = true;
3016 CreateLayerTreeHostImpl(always_draw); 3017 CreateLayerTreeHostImpl(always_draw);
3017 3018
3018 // Set larger viewport and activate it to active tree. 3019 // Set larger viewport and activate it to active tree.
3019 host_impl_->CreatePendingTree(); 3020 host_impl_->CreatePendingTree();
3020 gfx::Size larger_viewport(viewport_size_.width() + 100, 3021 gfx::Size larger_viewport(viewport_size_.width() + 100,
3021 viewport_size_.height() + 100); 3022 viewport_size_.height() + 100);
3022 host_impl_->SetViewportSize(larger_viewport); 3023 host_impl_->SetViewportSize(larger_viewport);
3023 EXPECT_TRUE(host_impl_->active_tree()->ViewportSizeInvalid()); 3024 EXPECT_TRUE(host_impl_->active_tree()->ViewportSizeInvalid());
3024 did_activate_pending_tree_ = false; 3025 did_activate_pending_tree_ = false;
3025 host_impl_->ActivatePendingTreeIfNeeded(); 3026 host_impl_->ActivatePendingTree();
3026 EXPECT_TRUE(did_activate_pending_tree_); 3027 EXPECT_TRUE(did_activate_pending_tree_);
3027 EXPECT_FALSE(host_impl_->active_tree()->ViewportSizeInvalid()); 3028 EXPECT_FALSE(host_impl_->active_tree()->ViewportSizeInvalid());
3028 3029
3029 // Shrink pending tree viewport without activating. 3030 // Shrink pending tree viewport without activating.
3030 host_impl_->CreatePendingTree(); 3031 host_impl_->CreatePendingTree();
3031 host_impl_->SetViewportSize(viewport_size_); 3032 host_impl_->SetViewportSize(viewport_size_);
3032 EXPECT_TRUE(host_impl_->active_tree()->ViewportSizeInvalid()); 3033 EXPECT_TRUE(host_impl_->active_tree()->ViewportSizeInvalid());
3033 3034
3034 SetupActiveTreeLayers(); 3035 SetupActiveTreeLayers();
3035 TestEmptyLayer(); 3036 TestEmptyLayer();
(...skipping 3273 matching lines...) Expand 10 before | Expand all | Expand 10 after
6309 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); 6310 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id));
6310 EXPECT_EQ(0u, context3d->NumTextures()); 6311 EXPECT_EQ(0u, context3d->NumTextures());
6311 6312
6312 // Should not change state for multiple deletion on one UIResourceId 6313 // Should not change state for multiple deletion on one UIResourceId
6313 host_impl_->DeleteUIResource(ui_resource_id); 6314 host_impl_->DeleteUIResource(ui_resource_id);
6314 EXPECT_EQ(0u, context3d->NumTextures()); 6315 EXPECT_EQ(0u, context3d->NumTextures());
6315 } 6316 }
6316 6317
6317 } // namespace 6318 } // namespace
6318 } // namespace cc 6319 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698