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