| 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 "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" | 5 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // The set of blocked profiles. | 34 // The set of blocked profiles. |
| 35 class ProfileSet : public base::NonThreadSafe, public std::set<Profile*> { | 35 class ProfileSet : public base::NonThreadSafe, public std::set<Profile*> { |
| 36 public: | 36 public: |
| 37 ProfileSet() {} | 37 ProfileSet() {} |
| 38 | 38 |
| 39 virtual ~ProfileSet() {} | 39 virtual ~ProfileSet() {} |
| 40 | 40 |
| 41 static ProfileSet* Get(); | 41 static ProfileSet* Get(); |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 friend struct ::base::DefaultLazyInstanceTraits<ProfileSet>; | 44 friend struct ::base::LazyInstanceTraitsBase<ProfileSet>; |
| 45 | 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(ProfileSet); | 46 DISALLOW_COPY_AND_ASSIGN(ProfileSet); |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 // Set of all of profiles for which restore session is in progress. | 49 // Set of all of profiles for which restore session is in progress. |
| 50 // This static member is accessible only form UI thread. | 50 // This static member is accessible only form UI thread. |
| 51 base::LazyInstance<ProfileSet> g_blocked_profiles = LAZY_INSTANCE_INITIALIZER; | 51 base::LazyInstance<ProfileSet>::DestructorAtExit g_blocked_profiles = |
| 52 LAZY_INSTANCE_INITIALIZER; |
| 52 | 53 |
| 53 ProfileSet* ProfileSet::Get() { | 54 ProfileSet* ProfileSet::Get() { |
| 54 return g_blocked_profiles.Pointer(); | 55 return g_blocked_profiles.Pointer(); |
| 55 } | 56 } |
| 56 | 57 |
| 57 // Global counter that keeps the track of session merge status for all | 58 // Global counter that keeps the track of session merge status for all |
| 58 // encountered profiles. This is used to determine if a throttle should | 59 // encountered profiles. This is used to determine if a throttle should |
| 59 // even be even added to new requests. Value of 0 (initial) means that we | 60 // even be even added to new requests. Value of 0 (initial) means that we |
| 60 // probably have some profiles to restore, while 1 means that all known | 61 // probably have some profiles to restore, while 1 means that all known |
| 61 // profiles are restored. | 62 // profiles are restored. |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 202 |
| 202 default: | 203 default: |
| 203 break; | 204 break; |
| 204 } | 205 } |
| 205 } | 206 } |
| 206 | 207 |
| 207 return pending_session_restore; | 208 return pending_session_restore; |
| 208 } | 209 } |
| 209 | 210 |
| 210 } // namespace merge_session_throttling_utils | 211 } // namespace merge_session_throttling_utils |
| OLD | NEW |