summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/paint/stub_chrome_client_for_cap.h
blob: 96db31bf235b8cb18fa6f0da5cc762d97e2a3455 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_STUB_CHROME_CLIENT_FOR_CAP_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_STUB_CHROME_CLIENT_FOR_CAP_H_

#include "third_party/blink/renderer/core/loader/empty_clients.h"
#include "third_party/blink/renderer/platform/testing/layer_tree_host_embedder.h"

namespace cc {
class Layer;
}

namespace blink {

// A simple ChromeClient implementation which forwards painted artifacts to a
// PaintArtifactCompositor attached to a testing cc::LayerTreeHost, and permits
// simple analysis of the results.
class StubChromeClientForCAP : public EmptyChromeClient {
 public:
  bool HasLayer(const cc::Layer& layer) {
    return layer.layer_tree_host() == layer_tree_.layer_tree_host();
  }

  void AttachRootLayer(scoped_refptr<cc::Layer> layer,
                       LocalFrame* local_root) override {
    layer_tree_.layer_tree_host()->SetRootLayer(std::move(layer));
  }

 private:
  LayerTreeHostEmbedder layer_tree_;
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_STUB_CHROME_CLIENT_FOR_CAP_H_