190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Copyright 2012 The Chromium Authors. All rights reserved.
290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// found in the LICENSE file.
490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "cc/test/fake_picture_layer.h"
690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "cc/test/fake_picture_layer_impl.h"
890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace cc {
1090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)FakePictureLayer::FakePictureLayer(ContentLayerClient* client)
1290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    : PictureLayer(client),
137dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch      update_count_(0),
14558790d6acca3451cf3a6b497803a5f07d0bec58Ben Murdoch      push_properties_count_(0),
151320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      always_update_resources_(false),
161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      output_surface_created_count_(0) {
1790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  SetBounds(gfx::Size(1, 1));
1890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  SetIsDrawable(true);
1990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
2090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)FakePictureLayer::~FakePictureLayer() {}
2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)scoped_ptr<LayerImpl> FakePictureLayer::CreateLayerImpl(
2490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    LayerTreeImpl* tree_impl) {
2590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  return FakePictureLayerImpl::Create(tree_impl, layer_id_).PassAs<LayerImpl>();
2690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
2790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
287dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochbool FakePictureLayer::Update(ResourceUpdateQueue* queue,
29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                              const OcclusionTracker<Layer>* occlusion) {
307dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  bool updated = PictureLayer::Update(queue, occlusion);
3190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  update_count_++;
32558790d6acca3451cf3a6b497803a5f07d0bec58Ben Murdoch  return updated || always_update_resources_;
3390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
3490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
357dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochvoid FakePictureLayer::PushPropertiesTo(LayerImpl* layer) {
367dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  PictureLayer::PushPropertiesTo(layer);
377dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  push_properties_count_++;
387dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch}
397dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccivoid FakePictureLayer::OnOutputSurfaceCreated() {
411320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  PictureLayer::OnOutputSurfaceCreated();
421320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  output_surface_created_count_++;
431320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}
447dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
4590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}  // namespace cc
46