| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_WEBUI_PROFILER_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PROFILER_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_PROFILER_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PROFILER_UI_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 11 #include "base/values.h" | 10 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" |
| 12 #include "content/public/browser/web_ui_controller.h" | 11 #include "content/public/browser/web_ui_controller.h" |
| 13 | 12 |
| 13 namespace content { |
| 14 struct SerializedProfilerData; |
| 15 } |
| 16 |
| 14 // The C++ back-end for the chrome://profiler webui page. | 17 // The C++ back-end for the chrome://profiler webui page. |
| 15 class ProfilerUI : public content::WebUIController { | 18 class ProfilerUI : public content::WebUIController, |
| 19 public chrome_browser_metrics::TrackingSynchronizerObserver { |
| 16 public: | 20 public: |
| 17 explicit ProfilerUI(content::WebUI* web_ui); | 21 explicit ProfilerUI(content::WebUI* web_ui); |
| 18 virtual ~ProfilerUI(); | 22 virtual ~ProfilerUI(); |
| 19 | 23 |
| 20 // Get the tracking data from TrackingSynchronizer. | 24 // Get the tracking data from TrackingSynchronizer. |
| 21 void GetData(); | 25 void GetData(); |
| 22 | 26 |
| 23 // Send the data to the renderer. | 27 private: |
| 24 void ReceivedData(base::Value* value); | 28 // TrackingSynchronizerObserver: |
| 29 virtual void ReceivedProfilerData( |
| 30 const content::SerializedProfilerData& data) OVERRIDE; |
| 25 | 31 |
| 26 private: | |
| 27 // Used to get |weak_ptr_| to self on the UI thread. | 32 // Used to get |weak_ptr_| to self on the UI thread. |
| 28 scoped_ptr<base::WeakPtrFactory<ProfilerUI> > ui_weak_ptr_factory_; | 33 base::WeakPtrFactory<ProfilerUI> weak_ptr_factory_; |
| 29 base::WeakPtr<ProfilerUI> ui_weak_ptr_; | |
| 30 | 34 |
| 31 DISALLOW_COPY_AND_ASSIGN(ProfilerUI); | 35 DISALLOW_COPY_AND_ASSIGN(ProfilerUI); |
| 32 }; | 36 }; |
| 33 | 37 |
| 34 #endif // CHROME_BROWSER_UI_WEBUI_PROFILER_UI_H_ | 38 #endif // CHROME_BROWSER_UI_WEBUI_PROFILER_UI_H_ |
| OLD | NEW |