OLD | NEW |
(Empty) | |
| 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 CONTENT_BROWSER_HISTOGRAM_CONTROLLER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_HISTOGRAM_CONTROLLER_IMPL_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/memory/singleton.h" |
| 12 #include "base/process.h" |
| 13 #include "content/common/content_export.h" |
| 14 #include "content/public/browser/histogram_controller.h" |
| 15 #include "content/public/common/process_type.h" |
| 16 |
| 17 namespace content { |
| 18 |
| 19 // HistogramController's implementation. |
| 20 class HistogramControllerImpl : public HistogramController { |
| 21 public: |
| 22 static HistogramControllerImpl* GetInstance(); |
| 23 |
| 24 // Normally instantiated when the child process is launched. Only one instance |
| 25 // should be created per process. |
| 26 HistogramControllerImpl(); |
| 27 virtual ~HistogramControllerImpl(); |
| 28 |
| 29 // Notify the |subscriber_| that it should expect at least |pending_processes| |
| 30 // additional calls to OnHistogramDataCollected(). OnPendingProcess() may be |
| 31 // called repeatedly; the last call will have |end| set to true, indicating |
| 32 // that there is no longer a possibility for the count of pending processes to |
| 33 // increase. This is called on the UI thread. |
| 34 void OnPendingProcesses(int sequence_number, int pending_processes, bool end); |
| 35 |
| 36 // Send the |histogram| back to the |subscriber_|. |
| 37 // This can be called from any thread. |
| 38 void OnHistogramDataCollected( |
| 39 int sequence_number, |
| 40 const std::vector<std::string>& pickled_histograms, |
| 41 content::ProcessType process_type); |
| 42 |
| 43 // HistogramController implementation: |
| 44 virtual void Register(HistogramSubscriber* subscriber) OVERRIDE; |
| 45 virtual void Unregister(const HistogramSubscriber* subscriber) OVERRIDE; |
| 46 virtual void GetHistogramData(int sequence_number) OVERRIDE; |
| 47 |
| 48 private: |
| 49 friend struct DefaultSingletonTraits<HistogramControllerImpl>; |
| 50 |
| 51 // Contact child processes and get their histogram data. |
| 52 void GetHistogramDataFromChildProcesses(int sequence_number); |
| 53 |
| 54 HistogramSubscriber* subscriber_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(HistogramControllerImpl); |
| 57 }; |
| 58 |
| 59 } // namespace content |
| 60 |
| 61 #endif // CONTENT_BROWSER_HISTOGRAM_CONTROLLER_IMPL_H_ |
OLD | NEW |