Flutter Engine
performance_overlay_layer.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 #ifndef FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_
6 #define FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_
7 
8 #include <string>
9 
10 #include "flutter/flow/instrumentation.h"
11 #include "flutter/flow/layers/layer.h"
12 #include "flutter/fml/macros.h"
13 
14 class SkTextBlob;
15 
16 namespace flutter {
17 
18 const int kDisplayRasterizerStatistics = 1 << 0;
19 const int kVisualizeRasterizerStatistics = 1 << 1;
20 const int kDisplayEngineStatistics = 1 << 2;
21 const int kVisualizeEngineStatistics = 1 << 3;
22 
24  public:
25  static sk_sp<SkTextBlob> MakeStatisticsText(const Stopwatch& stopwatch,
26  const std::string& label_prefix,
27  const std::string& font_path);
28 
29 #ifdef FLUTTER_ENABLE_DIFF_CONTEXT
30 
31  bool IsReplacing(DiffContext* context, const Layer* layer) const override {
32  return layer->as_performance_overlay_layer() != nullptr;
33  }
34 
35  void Diff(DiffContext* context, const Layer* old_layer) override;
36 
37  const PerformanceOverlayLayer* as_performance_overlay_layer() const override {
38  return this;
39  }
40 
41 #endif // FLUTTER_ENABLE_DIFF_CONTEXT
42 
43  explicit PerformanceOverlayLayer(uint64_t options,
44  const char* font_path = nullptr);
45 
46  void Paint(PaintContext& context) const override;
47 
48  private:
49  int options_;
50  std::string font_path_;
51 
52  FML_DISALLOW_COPY_AND_ASSIGN(PerformanceOverlayLayer);
53 };
54 
55 } // namespace flutter
56 
57 #endif // FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_
const int kDisplayRasterizerStatistics
const int kVisualizeEngineStatistics
const int kVisualizeRasterizerStatistics
void Paint(PaintContext &context) const override
PerformanceOverlayLayer(uint64_t options, const char *font_path=nullptr)
const int kDisplayEngineStatistics
static sk_sp< SkTextBlob > MakeStatisticsText(const Stopwatch &stopwatch, const std::string &label_prefix, const std::string &font_path)