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 #include "athena/activity/public/activity_manager.h" | 5 #include "athena/activity/public/activity_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "athena/activity/public/activity.h" | 10 #include "athena/activity/public/activity.h" |
11 #include "athena/activity/public/activity_view_manager.h" | 11 #include "athena/activity/public/activity_view_manager.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 | 13 |
14 namespace athena { | 14 namespace athena { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 ActivityManager* instance = NULL; | 18 ActivityManager* instance = NULL; |
19 | 19 |
20 class ActivityManagerImpl : public ActivityManager { | 20 class ActivityManagerImpl : public ActivityManager { |
21 public: | 21 public: |
22 ActivityManagerImpl() { | 22 ActivityManagerImpl() { |
23 CHECK(!instance); | 23 CHECK(!instance); |
24 instance = this; | 24 instance = this; |
25 } | 25 } |
26 virtual ~ActivityManagerImpl() { | 26 virtual ~ActivityManagerImpl() { |
27 while (activities_.empty()) | 27 while (!activities_.empty()) |
Jun Mukai
2014/06/06 20:17:29
I think this has been fixed by another CL (sorry f
oshima
2014/06/06 20:55:51
I needed this in order for the test to pass. rebas
| |
28 delete activities_.front(); | 28 delete activities_.front(); |
29 | 29 |
30 CHECK_EQ(this, instance); | 30 CHECK_EQ(this, instance); |
31 instance = NULL; | 31 instance = NULL; |
32 } | 32 } |
33 | 33 |
34 // ActivityManager: | 34 // ActivityManager: |
35 virtual void AddActivity(Activity* activity) OVERRIDE { | 35 virtual void AddActivity(Activity* activity) OVERRIDE { |
36 CHECK(activities_.end() == std::find(activities_.begin(), | 36 CHECK(activities_.end() == std::find(activities_.begin(), |
37 activities_.end(), | 37 activities_.end(), |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 return instance; | 79 return instance; |
80 } | 80 } |
81 | 81 |
82 void ActivityManager::Shutdown() { | 82 void ActivityManager::Shutdown() { |
83 CHECK(instance); | 83 CHECK(instance); |
84 delete instance; | 84 delete instance; |
85 ActivityViewManager::Shutdown(); | 85 ActivityViewManager::Shutdown(); |
86 } | 86 } |
87 | 87 |
88 } // namespace athena | 88 } // namespace athena |
OLD | NEW |