| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ATHENA_TEST_BASE_ACTIVITY_LIFETIME_TRACKER_H_ | 5 #ifndef ATHENA_TEST_BASE_ACTIVITY_LIFETIME_TRACKER_H_ |
| 6 #define ATHENA_TEST_BASE_ACTIVITY_LIFETIME_TRACKER_H_ | 6 #define ATHENA_TEST_BASE_ACTIVITY_LIFETIME_TRACKER_H_ |
| 7 | 7 |
| 8 #include "athena/activity/public/activity_manager_observer.h" | 8 #include "athena/activity/public/activity_manager_observer.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 | 10 |
| 11 namespace athena { | 11 namespace athena { |
| 12 class Activity; | 12 class Activity; |
| 13 | 13 |
| 14 // Listens for activities to be started / ended and will return them. | 14 // Listens for activities to be started / ended and will return them. |
| 15 class ActivityLifetimeTracker : public ActivityManagerObserver { | 15 class ActivityLifetimeTracker : public ActivityManagerObserver { |
| 16 public: | 16 public: |
| 17 ActivityLifetimeTracker(); | 17 ActivityLifetimeTracker(); |
| 18 virtual ~ActivityLifetimeTracker(); | 18 virtual ~ActivityLifetimeTracker(); |
| 19 | 19 |
| 20 // Called after an |activity| got created. | 20 // Called after an |activity| got created. |
| 21 virtual void OnActivityStarted(Activity* activity) OVERRIDE; | 21 virtual void OnActivityStarted(Activity* activity) override; |
| 22 | 22 |
| 23 // Called before an |activity| gets destroyed. | 23 // Called before an |activity| gets destroyed. |
| 24 virtual void OnActivityEnding(Activity* activity) OVERRIDE; | 24 virtual void OnActivityEnding(Activity* activity) override; |
| 25 | 25 |
| 26 // Returns the newly created activity (if any) and resets its reference. | 26 // Returns the newly created activity (if any) and resets its reference. |
| 27 Activity* GetNewActivityAndReset(); | 27 Activity* GetNewActivityAndReset(); |
| 28 | 28 |
| 29 // Returns a deleted activity (if any) and resets its reference. | 29 // Returns a deleted activity (if any) and resets its reference. |
| 30 // Note that the pointer is void* since the Activity was deleted when | 30 // Note that the pointer is void* since the Activity was deleted when |
| 31 // requested. | 31 // requested. |
| 32 void* GetDeletedActivityAndReset(); | 32 void* GetDeletedActivityAndReset(); |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 // The activity which got created if not NULL. | 35 // The activity which got created if not NULL. |
| 36 Activity* new_activity_; | 36 Activity* new_activity_; |
| 37 | 37 |
| 38 // An old activity which got unloaded if not NULL. | 38 // An old activity which got unloaded if not NULL. |
| 39 void* deleted_activity_; | 39 void* deleted_activity_; |
| 40 | 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(ActivityLifetimeTracker); | 41 DISALLOW_COPY_AND_ASSIGN(ActivityLifetimeTracker); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 } // namespace athena | 44 } // namespace athena |
| 45 | 45 |
| 46 #endif // ATHENA_TEST_BASE_ACTIVITY_LIFETIME_TRACKER_H_ | 46 #endif // ATHENA_TEST_BASE_ACTIVITY_LIFETIME_TRACKER_H_ |
| 47 | 47 |
| OLD | NEW |