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

Side by Side Diff: cc/test/fake_layer_tree_host_impl.cc

Issue 429743003: Rename Animate as Begin(Main)Frame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix. Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « cc/test/fake_layer_tree_host_impl.h ('k') | cc/test/layer_tree_test.h » ('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 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 "cc/test/begin_frame_args_test.h"
5 #include "cc/test/fake_layer_tree_host_impl.h" 6 #include "cc/test/fake_layer_tree_host_impl.h"
6 #include "cc/test/test_shared_bitmap_manager.h" 7 #include "cc/test/test_shared_bitmap_manager.h"
7 #include "cc/trees/layer_tree_impl.h" 8 #include "cc/trees/layer_tree_impl.h"
8 9
9 namespace cc { 10 namespace cc {
10 11
11 FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy, 12 FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy,
12 SharedBitmapManager* manager) 13 SharedBitmapManager* manager)
13 : LayerTreeHostImpl(LayerTreeSettings(), 14 : LayerTreeHostImpl(LayerTreeSettings(),
14 &client_, 15 &client_,
15 proxy, 16 proxy,
16 &stats_instrumentation_, 17 &stats_instrumentation_,
17 manager, 18 manager,
18 0) { 19 0) {
19 // Explicitly clear all debug settings. 20 // Explicitly clear all debug settings.
20 SetDebugState(LayerTreeDebugState()); 21 SetDebugState(LayerTreeDebugState());
21 SetViewportSize(gfx::Size(100, 100)); 22 SetViewportSize(gfx::Size(100, 100));
22 23
23 // Avoid using Now() as the frame time in unit tests. 24 // Avoid using Now() as the frame time in unit tests.
24 base::TimeTicks time_ticks = base::TimeTicks::FromInternalValue(1); 25 base::TimeTicks time_ticks = base::TimeTicks::FromInternalValue(1);
25 SetCurrentFrameTimeTicks(time_ticks); 26 SetCurrentBeginFrameArgs(CreateBeginFrameArgsForTesting(time_ticks));
26 } 27 }
27 28
28 FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(const LayerTreeSettings& settings, 29 FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
29 Proxy* proxy, 30 Proxy* proxy,
30 SharedBitmapManager* manager) 31 SharedBitmapManager* manager)
31 : LayerTreeHostImpl(settings, 32 : LayerTreeHostImpl(settings,
32 &client_, 33 &client_,
33 proxy, 34 proxy,
34 &stats_instrumentation_, 35 &stats_instrumentation_,
35 manager, 36 manager,
36 0) { 37 0) {
37 // Explicitly clear all debug settings. 38 // Explicitly clear all debug settings.
38 SetDebugState(LayerTreeDebugState()); 39 SetDebugState(LayerTreeDebugState());
39 40
40 // Avoid using Now() as the frame time in unit tests. 41 // Avoid using Now() as the frame time in unit tests.
41 base::TimeTicks time_ticks = base::TimeTicks::FromInternalValue(1); 42 base::TimeTicks time_ticks = base::TimeTicks::FromInternalValue(1);
42 SetCurrentFrameTimeTicks(time_ticks); 43 SetCurrentBeginFrameArgs(CreateBeginFrameArgsForTesting(time_ticks));
43 } 44 }
44 45
45 FakeLayerTreeHostImpl::~FakeLayerTreeHostImpl() {} 46 FakeLayerTreeHostImpl::~FakeLayerTreeHostImpl() {}
46 47
47 void FakeLayerTreeHostImpl::CreatePendingTree() { 48 void FakeLayerTreeHostImpl::CreatePendingTree() {
48 LayerTreeHostImpl::CreatePendingTree(); 49 LayerTreeHostImpl::CreatePendingTree();
49 float arbitrary_large_page_scale = 100000.f; 50 float arbitrary_large_page_scale = 100000.f;
50 pending_tree()->SetPageScaleFactorAndLimits( 51 pending_tree()->SetPageScaleFactorAndLimits(
51 1.f, 1.f / arbitrary_large_page_scale, arbitrary_large_page_scale); 52 1.f, 1.f / arbitrary_large_page_scale, arbitrary_large_page_scale);
52 } 53 }
53 54
54 base::TimeTicks FakeLayerTreeHostImpl::CurrentFrameTimeTicks() { 55 BeginFrameArgs FakeLayerTreeHostImpl::CurrentBeginFrameArgs() const {
55 if (current_frame_time_ticks_.is_null()) 56 if (!current_begin_frame_args_.IsValid())
56 return LayerTreeHostImpl::CurrentFrameTimeTicks(); 57 return LayerTreeHostImpl::CurrentBeginFrameArgs();
57 return current_frame_time_ticks_; 58 return current_begin_frame_args_;
58 } 59 }
59 60
60 void FakeLayerTreeHostImpl::SetCurrentFrameTimeTicks( 61 void FakeLayerTreeHostImpl::SetCurrentBeginFrameArgs(
61 base::TimeTicks current_frame_time_ticks) { 62 const BeginFrameArgs& args) {
62 current_frame_time_ticks_ = current_frame_time_ticks; 63 current_begin_frame_args_ = args;
63 } 64 }
64 65
65 int FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(LayerImpl* layer) { 66 int FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(LayerImpl* layer) {
66 int num_children_that_draw_content = 0; 67 int num_children_that_draw_content = 0;
67 for (size_t i = 0; i < layer->children().size(); ++i) { 68 for (size_t i = 0; i < layer->children().size(); ++i) {
68 num_children_that_draw_content += 69 num_children_that_draw_content +=
69 RecursiveUpdateNumChildren(layer->children()[i]); 70 RecursiveUpdateNumChildren(layer->children()[i]);
70 } 71 }
71 if (layer->DrawsContent() && layer->HasDelegatedContent()) 72 if (layer->DrawsContent() && layer->HasDelegatedContent())
72 num_children_that_draw_content += 1000; 73 num_children_that_draw_content += 1000;
73 layer->SetNumDescendantsThatDrawContent(num_children_that_draw_content); 74 layer->SetNumDescendantsThatDrawContent(num_children_that_draw_content);
74 return num_children_that_draw_content + (layer->DrawsContent() ? 1 : 0); 75 return num_children_that_draw_content + (layer->DrawsContent() ? 1 : 0);
75 } 76 }
76 77
77 void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawPropertiesForActiveTree() { 78 void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawPropertiesForActiveTree() {
78 UpdateNumChildrenAndDrawProperties(active_tree()); 79 UpdateNumChildrenAndDrawProperties(active_tree());
79 } 80 }
80 81
81 void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawProperties( 82 void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawProperties(
82 LayerTreeImpl* layerTree) { 83 LayerTreeImpl* layerTree) {
83 RecursiveUpdateNumChildren(layerTree->root_layer()); 84 RecursiveUpdateNumChildren(layerTree->root_layer());
84 layerTree->UpdateDrawProperties(); 85 layerTree->UpdateDrawProperties();
85 } 86 }
86 87
87 } // namespace cc 88 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_layer_tree_host_impl.h ('k') | cc/test/layer_tree_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698