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

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

Issue 1057283003: Remove parts of //cc we aren't using (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 8 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/test/fake_layer_tree_host_impl.h ('k') | cc/test/fake_layer_tree_host_impl_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/test/begin_frame_args_test.h"
6 #include "cc/test/fake_layer_tree_host_impl.h"
7 #include "cc/test/test_shared_bitmap_manager.h"
8 #include "cc/trees/layer_tree_impl.h"
9
10 namespace cc {
11
12 FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy,
13 SharedBitmapManager* manager,
14 TaskGraphRunner* task_graph_runner)
15 : LayerTreeHostImpl(LayerTreeSettings(),
16 &client_,
17 proxy,
18 &stats_instrumentation_,
19 manager,
20 NULL,
21 task_graph_runner,
22 0) {
23 // Explicitly clear all debug settings.
24 SetDebugState(LayerTreeDebugState());
25 SetViewportSize(gfx::Size(100, 100));
26
27 // Avoid using Now() as the frame time in unit tests.
28 base::TimeTicks time_ticks = base::TimeTicks::FromInternalValue(1);
29 SetCurrentBeginFrameArgs(
30 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
31 }
32
33 FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
34 Proxy* proxy,
35 SharedBitmapManager* manager,
36 TaskGraphRunner* task_graph_runner)
37 : LayerTreeHostImpl(settings,
38 &client_,
39 proxy,
40 &stats_instrumentation_,
41 manager,
42 NULL,
43 task_graph_runner,
44 0) {
45 // Explicitly clear all debug settings.
46 SetDebugState(LayerTreeDebugState());
47
48 // Avoid using Now() as the frame time in unit tests.
49 base::TimeTicks time_ticks = base::TimeTicks::FromInternalValue(1);
50 SetCurrentBeginFrameArgs(
51 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
52 }
53
54 FakeLayerTreeHostImpl::~FakeLayerTreeHostImpl() {}
55
56 void FakeLayerTreeHostImpl::CreatePendingTree() {
57 LayerTreeHostImpl::CreatePendingTree();
58 float arbitrary_large_page_scale = 100000.f;
59 pending_tree()->PushPageScaleFromMainThread(
60 1.f, 1.f / arbitrary_large_page_scale, arbitrary_large_page_scale);
61 }
62
63 BeginFrameArgs FakeLayerTreeHostImpl::CurrentBeginFrameArgs() const {
64 if (!current_begin_frame_args_.IsValid())
65 return LayerTreeHostImpl::CurrentBeginFrameArgs();
66 return current_begin_frame_args_;
67 }
68
69 void FakeLayerTreeHostImpl::SetCurrentBeginFrameArgs(
70 const BeginFrameArgs& args) {
71 current_begin_frame_args_ = args;
72 }
73
74 int FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(LayerImpl* layer) {
75 int num_children_that_draw_content = 0;
76 for (size_t i = 0; i < layer->children().size(); ++i) {
77 num_children_that_draw_content +=
78 RecursiveUpdateNumChildren(layer->children()[i]);
79 }
80 if (layer->DrawsContent() && layer->HasDelegatedContent())
81 num_children_that_draw_content += 1000;
82 layer->SetNumDescendantsThatDrawContent(num_children_that_draw_content);
83 return num_children_that_draw_content + (layer->DrawsContent() ? 1 : 0);
84 }
85
86 void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawPropertiesForActiveTree() {
87 UpdateNumChildrenAndDrawProperties(active_tree());
88 }
89
90 void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawProperties(
91 LayerTreeImpl* layerTree) {
92 RecursiveUpdateNumChildren(layerTree->root_layer());
93 bool update_lcd_text = false;
94 layerTree->UpdateDrawProperties(update_lcd_text);
95 }
96
97 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_layer_tree_host_impl.h ('k') | cc/test/fake_layer_tree_host_impl_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698