forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
graphs_container_view.h
59 lines (43 loc) · 1.71 KB
/
graphs_container_view.h
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2020 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 ASH_HUD_DISPLAY_GRAPHS_CONTAINER_VIEW_H_
#define ASH_HUD_DISPLAY_GRAPHS_CONTAINER_VIEW_H_
#include "ash/hud_display/data_source.h"
#include "ash/hud_display/graph_page_view_base.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/sequence_checker.h"
#include "base/sequenced_task_runner.h"
#include "base/time/time.h"
#include "ui/views/view.h"
namespace ash {
namespace hud_display {
enum class DisplayMode;
// GraphsContainerView class draws a bunch of graphs.
class GraphsContainerView : public views::View {
public:
METADATA_HEADER(GraphsContainerView);
GraphsContainerView();
GraphsContainerView(const GraphsContainerView&) = delete;
GraphsContainerView& operator=(const GraphsContainerView&) = delete;
~GraphsContainerView() override;
// Updates graphs display to match given mode.
void SetMode(DisplayMode mode);
// Schedules new data update on the thread pool.
void RequestDataUpdate();
// Update graphs data from the given snapshot.
void UpdateData(std::unique_ptr<DataSource::Snapshot> snapshot);
private:
// This helps detect missing data intervals.
const base::TimeTicks start_time_;
size_t data_update_count_{0};
// Source of graphs data.
scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
std::unique_ptr<DataSource, base::OnTaskRunnerDeleter> data_source_;
SEQUENCE_CHECKER(ui_sequence_checker_);
base::WeakPtrFactory<GraphsContainerView> weak_factory_{this};
};
} // namespace hud_display
} // namespace ash
#endif // ASH_HUD_DISPLAY_GRAPHS_CONTAINER_VIEW_H_