1 // Copyright (c) 2012 The Chromium 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 CHROME_BROWSER_UI_WEBUI_PROFILER_UI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_PROFILER_UI_H_ 7 8 #include "base/memory/weak_ptr.h" 9 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" 10 #include "content/public/browser/web_ui_controller.h" 11 12 // The C++ back-end for the chrome://profiler webui page. 13 class ProfilerUI : public content::WebUIController, 14 public chrome_browser_metrics::TrackingSynchronizerObserver { 15 public: 16 explicit ProfilerUI(content::WebUI* web_ui); 17 virtual ~ProfilerUI(); 18 19 // Get the tracking data from TrackingSynchronizer. 20 void GetData(); 21 22 private: 23 // TrackingSynchronizerObserver: 24 virtual void ReceivedProfilerData( 25 const tracked_objects::ProcessDataSnapshot& profiler_data, 26 int process_type) OVERRIDE; 27 28 // Used to get |weak_ptr_| to self on the UI thread. 29 base::WeakPtrFactory<ProfilerUI> weak_ptr_factory_; 30 31 DISALLOW_COPY_AND_ASSIGN(ProfilerUI); 32 }; 33 34 #endif // CHROME_BROWSER_UI_WEBUI_PROFILER_UI_H_ 35