fake_layer_tree_host_impl.cc revision 58537e28ecd584eab876aee8be7156509866d23a
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/fake_layer_tree_host_impl.h"
6#include "cc/trees/layer_tree_impl.h"
7
8namespace cc {
9
10FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy)
11    : LayerTreeHostImpl(LayerTreeSettings(),
12                        &client_,
13                        proxy,
14                        &stats_instrumentation_) {
15  // Explicitly clear all debug settings.
16  SetDebugState(LayerTreeDebugState());
17}
18
19FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(
20    const LayerTreeSettings& settings,
21    Proxy* proxy)
22    : LayerTreeHostImpl(settings,
23                        &client_,
24                        proxy,
25                        &stats_instrumentation_) {
26  // Explicitly clear all debug settings.
27  SetDebugState(LayerTreeDebugState());
28}
29
30FakeLayerTreeHostImpl::~FakeLayerTreeHostImpl() {}
31
32void FakeLayerTreeHostImpl::CreatePendingTree() {
33  LayerTreeHostImpl::CreatePendingTree();
34  float arbitrary_large_page_scale = 100000.f;
35  pending_tree()->SetPageScaleFactorAndLimits(
36      1.f, 1.f / arbitrary_large_page_scale, arbitrary_large_page_scale);
37}
38
39base::TimeTicks FakeLayerTreeHostImpl::CurrentFrameTimeTicks() {
40  if (current_frame_time_ticks_.is_null())
41    return LayerTreeHostImpl::CurrentFrameTimeTicks();
42  return current_frame_time_ticks_;
43}
44
45void FakeLayerTreeHostImpl::SetCurrentFrameTimeTicks(
46    base::TimeTicks current_frame_time_ticks) {
47  current_frame_time_ticks_ = current_frame_time_ticks;
48}
49
50}  // namespace cc
51