| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_TASK_MANAGEMENT_PROVIDERS_TASK_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_PROVIDER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/task_management/providers/task_provider_observer.h" | 9 #include "chrome/browser/task_management/providers/task_provider_observer.h" |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // Set the sole observer of this provider. It's an error to set an observer | 38 // Set the sole observer of this provider. It's an error to set an observer |
| 39 // if there's already one there. | 39 // if there's already one there. |
| 40 void SetObserver(TaskProviderObserver* observer); | 40 void SetObserver(TaskProviderObserver* observer); |
| 41 | 41 |
| 42 // Clears the currently set observer for this provider. It's an error to clear | 42 // Clears the currently set observer for this provider. It's an error to clear |
| 43 // the observer if there's no one set. | 43 // the observer if there's no one set. |
| 44 void ClearObserver(); | 44 void ClearObserver(); |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 // Used by concrete task providers to notify the observer of tasks addition/ | 47 // Used by concrete task providers to notify the observer of tasks addition/ |
| 48 // removal. These methods should only be called after StartUpdating() has been | 48 // removal/renderer unresponsive. These methods should only be called after |
| 49 // called and before StopUpdating() is called. | 49 // StartUpdating() has been called and before StopUpdating() is called. |
| 50 void NotifyObserverTaskAdded(Task* task) const; | 50 void NotifyObserverTaskAdded(Task* task) const; |
| 51 void NotifyObserverTaskRemoved(Task* task) const; | 51 void NotifyObserverTaskRemoved(Task* task) const; |
| 52 void NotifyObserverTaskUnresponsive(Task* task) const; |
| 52 | 53 |
| 53 private: | 54 private: |
| 54 // This will be called once an observer is set for this provider. When it is | 55 // This will be called once an observer is set for this provider. When it is |
| 55 // called, the concrete provider must notify the observer of all pre-existing | 56 // called, the concrete provider must notify the observer of all pre-existing |
| 56 // tasks as well as track new addition and terminations and notify the | 57 // tasks as well as track new addition and terminations and notify the |
| 57 // observer of these changes. | 58 // observer of these changes. |
| 58 virtual void StartUpdating() = 0; | 59 virtual void StartUpdating() = 0; |
| 59 | 60 |
| 60 // This will be called once the observer is cleared, at which point the | 61 // This will be called once the observer is cleared, at which point the |
| 61 // provider can stop tracking tasks addition / removal and can clear its own | 62 // provider can stop tracking tasks addition / removal and can clear its own |
| 62 // resources. | 63 // resources. |
| 63 virtual void StopUpdating() = 0; | 64 virtual void StopUpdating() = 0; |
| 64 | 65 |
| 65 // We support only one single obsever which will be the sampler in this case. | 66 // We support only one single obsever which will be the sampler in this case. |
| 66 TaskProviderObserver* observer_; | 67 TaskProviderObserver* observer_; |
| 67 | 68 |
| 68 DISALLOW_COPY_AND_ASSIGN(TaskProvider); | 69 DISALLOW_COPY_AND_ASSIGN(TaskProvider); |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 } // namespace task_management | 72 } // namespace task_management |
| 72 | 73 |
| 73 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_PROVIDER_H_ | 74 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_PROVIDER_H_ |
| OLD | NEW |