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 #include "ios/web/active_state_manager_impl.h" | 5 #include "ios/web/active_state_manager_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ios/web/public/browser_state.h" | 8 #include "ios/web/public/browser_state.h" |
9 #include "ios/web/public/web_thread.h" | 9 #include "ios/web/public/web_thread.h" |
10 | 10 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." |
| 13 #endif |
| 14 |
11 namespace web { | 15 namespace web { |
12 | 16 |
13 namespace { | 17 namespace { |
14 // The number of ActiveStateManagers that are currently in active state. | 18 // The number of ActiveStateManagers that are currently in active state. |
15 // At most one ActiveStateManager can be active at any given time. | 19 // At most one ActiveStateManager can be active at any given time. |
16 int g_active_state_manager_active_count = 0; | 20 int g_active_state_manager_active_count = 0; |
17 } // namespace | 21 } // namespace |
18 | 22 |
19 ActiveStateManagerImpl::ActiveStateManagerImpl(BrowserState* browser_state) | 23 ActiveStateManagerImpl::ActiveStateManagerImpl(BrowserState* browser_state) |
20 : browser_state_(browser_state), active_(false) { | 24 : browser_state_(browser_state), active_(false) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 DCHECK_CURRENTLY_ON(WebThread::UI); | 61 DCHECK_CURRENTLY_ON(WebThread::UI); |
58 observer_list_.AddObserver(obs); | 62 observer_list_.AddObserver(obs); |
59 } | 63 } |
60 | 64 |
61 void ActiveStateManagerImpl::RemoveObserver(ActiveStateManager::Observer* obs) { | 65 void ActiveStateManagerImpl::RemoveObserver(ActiveStateManager::Observer* obs) { |
62 DCHECK_CURRENTLY_ON(WebThread::UI); | 66 DCHECK_CURRENTLY_ON(WebThread::UI); |
63 observer_list_.RemoveObserver(obs); | 67 observer_list_.RemoveObserver(obs); |
64 } | 68 } |
65 | 69 |
66 } // namespace web | 70 } // namespace web |
OLD | NEW |