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