summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/webui/profiler_ui.h
blob: 350fe7ebc05402a95920278a997ed01940d8a94f (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
// Copyright (c) 2012 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 CHROME_BROWSER_UI_WEBUI_PROFILER_UI_H_
#define CHROME_BROWSER_UI_WEBUI_PROFILER_UI_H_

#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "components/metrics/profiler/tracking_synchronizer_observer.h"
#include "content/public/browser/web_ui_controller.h"

// The C++ back-end for the chrome://profiler webui page.
class ProfilerUI : public content::WebUIController,
                   public metrics::TrackingSynchronizerObserver {
 public:
  explicit ProfilerUI(content::WebUI* web_ui);
  ~ProfilerUI() override;

  // Get the tracking data from TrackingSynchronizer.
  void GetData();

 private:
  // TrackingSynchronizerObserver:
  void ReceivedProfilerData(
      const metrics::ProfilerDataAttributes& attributes,
      const tracked_objects::ProcessDataPhaseSnapshot& process_data_phase,
      const metrics::ProfilerEvents& past_events) override;

  // Used to get |weak_ptr_| to self on the UI thread.
  base::WeakPtrFactory<ProfilerUI> weak_ptr_factory_;

  DISALLOW_COPY_AND_ASSIGN(ProfilerUI);
};

#endif  // CHROME_BROWSER_UI_WEBUI_PROFILER_UI_H_