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 "extensions/browser/error_map.h" | 5 #include "extensions/browser/error_map.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // The maximum number of errors to be stored per extension. | 17 // The maximum number of errors to be stored per extension. |
18 const size_t kMaxErrorsPerExtension = 100; | 18 const size_t kMaxErrorsPerExtension = 100; |
19 | 19 |
20 base::LazyInstance<ErrorList> g_empty_error_list = LAZY_INSTANCE_INITIALIZER; | 20 base::LazyInstance<ErrorList>::DestructorAtExit g_empty_error_list = |
| 21 LAZY_INSTANCE_INITIALIZER; |
21 | 22 |
22 // An incrementing counter for the next error id. Overflowing this is very | 23 // An incrementing counter for the next error id. Overflowing this is very |
23 // unlikely, since the number of errors per extension is capped at 100. | 24 // unlikely, since the number of errors per extension is capped at 100. |
24 int kNextErrorId = 1; | 25 int kNextErrorId = 1; |
25 | 26 |
26 } // namespace | 27 } // namespace |
27 | 28 |
28 //////////////////////////////////////////////////////////////////////////////// | 29 //////////////////////////////////////////////////////////////////////////////// |
29 // ErrorMap::Filter | 30 // ErrorMap::Filter |
30 ErrorMap::Filter::Filter(const std::string& restrict_to_extension_id, | 31 ErrorMap::Filter::Filter(const std::string& restrict_to_extension_id, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 affected_ids->insert(key_val.first); | 201 affected_ids->insert(key_val.first); |
201 } | 202 } |
202 } | 203 } |
203 } | 204 } |
204 | 205 |
205 void ErrorMap::RemoveAllErrors() { | 206 void ErrorMap::RemoveAllErrors() { |
206 map_.clear(); | 207 map_.clear(); |
207 } | 208 } |
208 | 209 |
209 } // namespace extensions | 210 } // namespace extensions |
OLD | NEW |