OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SimCompositor_h | 5 #ifndef SimCompositor_h |
6 #define SimCompositor_h | 6 #define SimCompositor_h |
7 | 7 |
8 #include "public/platform/WebLayerTreeView.h" | 8 #include "public/platform/WebLayerTreeView.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 class SimDisplayItemList; | 12 class SimDisplayItemList; |
13 class WebViewImpl; | 13 class WebViewBase; |
14 | 14 |
15 // Simulated very basic compositor that's capable of running the BeginMainFrame | 15 // Simulated very basic compositor that's capable of running the BeginMainFrame |
16 // processing steps on WebView: beginFrame, layout, paint. | 16 // processing steps on WebView: beginFrame, layout, paint. |
17 // | 17 // |
18 // The painting capabilities are very limited in that only the main layer of | 18 // The painting capabilities are very limited in that only the main layer of |
19 // every CompositedLayerMapping will be painted, squashed layers | 19 // every CompositedLayerMapping will be painted, squashed layers |
20 // are not supported and the entirety of every layer is always repainted even if | 20 // are not supported and the entirety of every layer is always repainted even if |
21 // only part of the layer was invalid. | 21 // only part of the layer was invalid. |
22 // | 22 // |
23 // Note: This also does not support compositor driven animations. | 23 // Note: This also does not support compositor driven animations. |
24 class SimCompositor final : public WebLayerTreeView { | 24 class SimCompositor final : public WebLayerTreeView { |
25 public: | 25 public: |
26 explicit SimCompositor(); | 26 explicit SimCompositor(); |
27 ~SimCompositor(); | 27 ~SimCompositor(); |
28 | 28 |
29 void SetWebViewImpl(WebViewImpl&); | 29 void SetWebView(WebViewBase&); |
30 | 30 |
31 // Execute the BeginMainFrame processing steps, an approximation of what | 31 // Execute the BeginMainFrame processing steps, an approximation of what |
32 // cc::ThreadProxy::BeginMainFrame would do. | 32 // cc::ThreadProxy::BeginMainFrame would do. |
33 // If time is not specified a 60Hz frame rate time progression is used. | 33 // If time is not specified a 60Hz frame rate time progression is used. |
34 SimDisplayItemList BeginFrame(double time_delta_in_seconds = 0.016); | 34 SimDisplayItemList BeginFrame(double time_delta_in_seconds = 0.016); |
35 | 35 |
36 bool NeedsBeginFrame() const { return needs_begin_frame_; } | 36 bool NeedsBeginFrame() const { return needs_begin_frame_; } |
37 bool DeferCommits() const { return defer_commits_; } | 37 bool DeferCommits() const { return defer_commits_; } |
38 | 38 |
39 bool HasSelection() const { return has_selection_; } | 39 bool HasSelection() const { return has_selection_; } |
40 | 40 |
41 private: | 41 private: |
42 void SetNeedsBeginFrame() override; | 42 void SetNeedsBeginFrame() override; |
43 void SetDeferCommits(bool) override; | 43 void SetDeferCommits(bool) override; |
44 void RegisterSelection(const WebSelection&) override; | 44 void RegisterSelection(const WebSelection&) override; |
45 void ClearSelection() override; | 45 void ClearSelection() override; |
46 | 46 |
47 bool needs_begin_frame_; | 47 bool needs_begin_frame_; |
48 bool defer_commits_; | 48 bool defer_commits_; |
49 bool has_selection_; | 49 bool has_selection_; |
50 WebViewImpl* web_view_impl_; | 50 WebViewBase* web_view_; |
51 double last_frame_time_monotonic_; | 51 double last_frame_time_monotonic_; |
52 }; | 52 }; |
53 | 53 |
54 } // namespace blink | 54 } // namespace blink |
55 | 55 |
56 #endif | 56 #endif |
OLD | NEW |