Roll src/third_party/WebKit f007c95:0171005 (svn 185074:185088)
[chromium-blink-merge.git] / athena / test / base / activity_lifetime_tracker.h
blobd217893ce7be9623c756583e9813ba64f60c1a0a
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.
5 #ifndef ATHENA_TEST_BASE_ACTIVITY_LIFETIME_TRACKER_H_
6 #define ATHENA_TEST_BASE_ACTIVITY_LIFETIME_TRACKER_H_
8 #include "athena/activity/public/activity_manager_observer.h"
9 #include "base/macros.h"
11 namespace athena {
12 class Activity;
14 // Listens for activities to be started / ended and will return them.
15 class ActivityLifetimeTracker : public ActivityManagerObserver {
16 public:
17 ActivityLifetimeTracker();
18 ~ActivityLifetimeTracker() override;
20 // ActivityManagerObserver:
21 void OnActivityStarted(Activity* activity) override;
22 void OnActivityEnding(Activity* activity) override;
23 void OnActivityOrderChanged() override;
25 // Returns the newly created activity (if any) and resets its reference.
26 Activity* GetNewActivityAndReset();
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();
33 private:
34 // The activity which got created if not nullptr.
35 Activity* new_activity_;
37 // An old activity which got unloaded if not nullptr.
38 void* deleted_activity_;
40 DISALLOW_COPY_AND_ASSIGN(ActivityLifetimeTracker);
43 } // namespace athena
45 #endif // ATHENA_TEST_BASE_ACTIVITY_LIFETIME_TRACKER_H_