OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef StubChromeClientForSPv2_h | 5 #ifndef StubChromeClientForSPv2_h |
6 #define StubChromeClientForSPv2_h | 6 #define StubChromeClientForSPv2_h |
7 | 7 |
8 #include "core/loader/EmptyClients.h" | 8 #include "core/loader/EmptyClients.h" |
9 #include "platform/graphics/compositing/PaintArtifactCompositor.h" | |
10 #include "platform/testing/WebLayerTreeViewImplForTesting.h" | 9 #include "platform/testing/WebLayerTreeViewImplForTesting.h" |
11 | 10 |
12 namespace blink { | 11 namespace blink { |
13 | 12 |
14 // A simple ChromeClient implementation which forwards painted artifacts to a | 13 // A simple ChromeClient implementation which forwards painted artifacts to a |
15 // PaintArtifactCompositor attached to a testing WebLayerTreeView, and permits | 14 // PaintArtifactCompositor attached to a testing WebLayerTreeView, and permits |
16 // simple analysis of the results. | 15 // simple analysis of the results. |
17 class StubChromeClientForSPv2 : public EmptyChromeClient { | 16 class StubChromeClientForSPv2 : public EmptyChromeClient { |
18 public: | 17 public: |
19 StubChromeClientForSPv2() : m_layerTreeView() | 18 StubChromeClientForSPv2() : m_layerTreeView() { } |
20 { | |
21 m_layerTreeView.setRootLayer(*m_paintArtifactCompositor.getWebLayer()); | |
22 } | |
23 | 19 |
24 bool hasLayer(const WebLayer& layer) { return m_layerTreeView.hasLayer(layer
); } | 20 bool hasLayer(const WebLayer& layer) { return m_layerTreeView.hasLayer(layer
); } |
25 | 21 |
26 // ChromeClient | 22 void attachRootLayer(WebLayer* layer, LocalFrame* localRoot) override |
27 void didPaint(const PaintArtifact& artifact) override | |
28 { | 23 { |
29 m_paintArtifactCompositor.update(artifact); | 24 m_layerTreeView.setRootLayer(*layer); |
30 } | 25 } |
31 | 26 |
32 private: | 27 private: |
33 WebLayerTreeViewImplForTesting m_layerTreeView; | 28 WebLayerTreeViewImplForTesting m_layerTreeView; |
34 PaintArtifactCompositor m_paintArtifactCompositor; | |
35 }; | 29 }; |
36 | 30 |
37 } // namespace blink | 31 } // namespace blink |
38 | 32 |
39 #endif // StubChromeClientForSPv2_h | 33 #endif // StubChromeClientForSPv2_h |
OLD | NEW |