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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 did_notify_ready_to_activate_(false), |
71 has_pending_tree_(false), | 72 has_pending_tree_(false), |
72 did_request_commit_(false), | 73 did_request_commit_(false), |
73 did_request_redraw_(false), | 74 did_request_redraw_(false), |
74 did_upload_visible_tile_(false), | 75 did_upload_visible_tile_(false), |
75 reduce_memory_result_(true), | 76 reduce_memory_result_(true), |
76 current_limit_bytes_(0), | 77 current_limit_bytes_(0), |
77 current_priority_cutoff_value_(0) { | 78 current_priority_cutoff_value_(0) { |
78 media::InitializeMediaLibraryForTesting(); | 79 media::InitializeMediaLibraryForTesting(); |
79 } | 80 } |
80 | 81 |
(...skipping 18 matching lines...) Expand all Loading... |
99 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE { | 100 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE { |
100 did_try_initialize_renderer_ = true; | 101 did_try_initialize_renderer_ = true; |
101 } | 102 } |
102 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {} | 103 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {} |
103 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {} | 104 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {} |
104 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) | 105 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) |
105 OVERRIDE {} | 106 OVERRIDE {} |
106 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE { | 107 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE { |
107 on_can_draw_state_changed_called_ = true; | 108 on_can_draw_state_changed_called_ = true; |
108 } | 109 } |
| 110 virtual void NotifyReadyToActivate() OVERRIDE { |
| 111 did_notify_ready_to_activate_ = true; |
| 112 host_impl_->ActivatePendingTree(); |
| 113 } |
109 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE { | 114 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE { |
110 has_pending_tree_ = has_pending_tree; | 115 has_pending_tree_ = has_pending_tree; |
111 } | 116 } |
112 virtual void SetNeedsRedrawOnImplThread() OVERRIDE { | 117 virtual void SetNeedsRedrawOnImplThread() OVERRIDE { |
113 did_request_redraw_ = true; | 118 did_request_redraw_ = true; |
114 } | 119 } |
115 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) OVERRIDE { | 120 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) OVERRIDE { |
116 did_request_redraw_ = true; | 121 did_request_redraw_ = true; |
117 } | 122 } |
118 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE { | 123 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE { |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 } | 351 } |
347 | 352 |
348 FakeProxy proxy_; | 353 FakeProxy proxy_; |
349 DebugScopedSetImplThread always_impl_thread_; | 354 DebugScopedSetImplThread always_impl_thread_; |
350 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; | 355 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; |
351 | 356 |
352 scoped_ptr<LayerTreeHostImpl> host_impl_; | 357 scoped_ptr<LayerTreeHostImpl> host_impl_; |
353 FakeRenderingStatsInstrumentation stats_instrumentation_; | 358 FakeRenderingStatsInstrumentation stats_instrumentation_; |
354 bool did_try_initialize_renderer_; | 359 bool did_try_initialize_renderer_; |
355 bool on_can_draw_state_changed_called_; | 360 bool on_can_draw_state_changed_called_; |
| 361 bool did_notify_ready_to_activate_; |
356 bool has_pending_tree_; | 362 bool has_pending_tree_; |
357 bool did_request_commit_; | 363 bool did_request_commit_; |
358 bool did_request_redraw_; | 364 bool did_request_redraw_; |
359 bool did_upload_visible_tile_; | 365 bool did_upload_visible_tile_; |
360 bool reduce_memory_result_; | 366 bool reduce_memory_result_; |
361 base::TimeDelta requested_scrollbar_animation_delay_; | 367 base::TimeDelta requested_scrollbar_animation_delay_; |
362 size_t current_limit_bytes_; | 368 size_t current_limit_bytes_; |
363 int current_priority_cutoff_value_; | 369 int current_priority_cutoff_value_; |
364 }; | 370 }; |
365 | 371 |
(...skipping 5945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6311 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); | 6317 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); |
6312 EXPECT_EQ(0u, context3d->NumTextures()); | 6318 EXPECT_EQ(0u, context3d->NumTextures()); |
6313 | 6319 |
6314 // Should not change state for multiple deletion on one UIResourceId | 6320 // Should not change state for multiple deletion on one UIResourceId |
6315 host_impl_->DeleteUIResource(ui_resource_id); | 6321 host_impl_->DeleteUIResource(ui_resource_id); |
6316 EXPECT_EQ(0u, context3d->NumTextures()); | 6322 EXPECT_EQ(0u, context3d->NumTextures()); |
6317 } | 6323 } |
6318 | 6324 |
6319 } // namespace | 6325 } // namespace |
6320 } // namespace cc | 6326 } // namespace cc |
OLD | NEW |