OLD | NEW |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 class LayerTreeHostImplTest : public testing::Test, | 61 class LayerTreeHostImplTest : public testing::Test, |
62 public LayerTreeHostImplClient { | 62 public LayerTreeHostImplClient { |
63 public: | 63 public: |
64 LayerTreeHostImplTest() | 64 LayerTreeHostImplTest() |
65 : proxy_(), | 65 : proxy_(), |
66 always_impl_thread_(&proxy_), | 66 always_impl_thread_(&proxy_), |
67 always_main_thread_blocked_(&proxy_), | 67 always_main_thread_blocked_(&proxy_), |
68 did_try_initialize_renderer_(false), | 68 did_try_initialize_renderer_(false), |
69 on_can_draw_state_changed_called_(false), | 69 on_can_draw_state_changed_called_(false), |
| 70 did_notify_ready_to_activate_(false), |
70 has_pending_tree_(false), | 71 has_pending_tree_(false), |
71 did_request_commit_(false), | 72 did_request_commit_(false), |
72 did_request_redraw_(false), | 73 did_request_redraw_(false), |
73 did_upload_visible_tile_(false), | 74 did_upload_visible_tile_(false), |
74 reduce_memory_result_(true), | 75 reduce_memory_result_(true), |
75 current_limit_bytes_(0), | 76 current_limit_bytes_(0), |
76 current_priority_cutoff_value_(0) { | 77 current_priority_cutoff_value_(0) { |
77 media::InitializeMediaLibraryForTesting(); | 78 media::InitializeMediaLibraryForTesting(); |
78 } | 79 } |
79 | 80 |
(...skipping 18 matching lines...) Expand all Loading... |
98 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE { | 99 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE { |
99 did_try_initialize_renderer_ = true; | 100 did_try_initialize_renderer_ = true; |
100 } | 101 } |
101 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {} | 102 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {} |
102 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {} | 103 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {} |
103 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) | 104 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) |
104 OVERRIDE {} | 105 OVERRIDE {} |
105 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE { | 106 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE { |
106 on_can_draw_state_changed_called_ = true; | 107 on_can_draw_state_changed_called_ = true; |
107 } | 108 } |
| 109 virtual void NotifyReadyToActivate() OVERRIDE { |
| 110 did_notify_ready_to_activate_ = true; |
| 111 host_impl_->ActivatePendingTree(); |
| 112 } |
108 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE { | 113 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE { |
109 has_pending_tree_ = has_pending_tree; | 114 has_pending_tree_ = has_pending_tree; |
110 } | 115 } |
111 virtual void SetNeedsRedrawOnImplThread() OVERRIDE { | 116 virtual void SetNeedsRedrawOnImplThread() OVERRIDE { |
112 did_request_redraw_ = true; | 117 did_request_redraw_ = true; |
113 } | 118 } |
114 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) OVERRIDE { | 119 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) OVERRIDE { |
115 did_request_redraw_ = true; | 120 did_request_redraw_ = true; |
116 } | 121 } |
117 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE { | 122 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 } | 348 } |
344 | 349 |
345 FakeProxy proxy_; | 350 FakeProxy proxy_; |
346 DebugScopedSetImplThread always_impl_thread_; | 351 DebugScopedSetImplThread always_impl_thread_; |
347 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; | 352 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; |
348 | 353 |
349 scoped_ptr<LayerTreeHostImpl> host_impl_; | 354 scoped_ptr<LayerTreeHostImpl> host_impl_; |
350 FakeRenderingStatsInstrumentation stats_instrumentation_; | 355 FakeRenderingStatsInstrumentation stats_instrumentation_; |
351 bool did_try_initialize_renderer_; | 356 bool did_try_initialize_renderer_; |
352 bool on_can_draw_state_changed_called_; | 357 bool on_can_draw_state_changed_called_; |
| 358 bool did_notify_ready_to_activate_; |
353 bool has_pending_tree_; | 359 bool has_pending_tree_; |
354 bool did_request_commit_; | 360 bool did_request_commit_; |
355 bool did_request_redraw_; | 361 bool did_request_redraw_; |
356 bool did_upload_visible_tile_; | 362 bool did_upload_visible_tile_; |
357 bool reduce_memory_result_; | 363 bool reduce_memory_result_; |
358 base::TimeDelta requested_scrollbar_animation_delay_; | 364 base::TimeDelta requested_scrollbar_animation_delay_; |
359 size_t current_limit_bytes_; | 365 size_t current_limit_bytes_; |
360 int current_priority_cutoff_value_; | 366 int current_priority_cutoff_value_; |
361 }; | 367 }; |
362 | 368 |
(...skipping 5920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6283 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); | 6289 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); |
6284 EXPECT_EQ(0u, context3d->NumTextures()); | 6290 EXPECT_EQ(0u, context3d->NumTextures()); |
6285 | 6291 |
6286 // Should not change state for multiple deletion on one UIResourceId | 6292 // Should not change state for multiple deletion on one UIResourceId |
6287 host_impl_->DeleteUIResource(ui_resource_id); | 6293 host_impl_->DeleteUIResource(ui_resource_id); |
6288 EXPECT_EQ(0u, context3d->NumTextures()); | 6294 EXPECT_EQ(0u, context3d->NumTextures()); |
6289 } | 6295 } |
6290 | 6296 |
6291 } // namespace | 6297 } // namespace |
6292 } // namespace cc | 6298 } // namespace cc |
OLD | NEW |