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 "chrome/browser/metrics/extension_metrics.h" | 5 #include "chrome/browser/metrics/extension_metrics.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
14 #include "chrome/common/metrics/proto/system_profile.pb.h" | 14 #include "chrome/common/metrics/proto/system_profile.pb.h" |
15 #include "extensions/browser/extension_registry.h" | 15 #include "extensions/browser/extension_registry.h" |
16 #include "extensions/common/extension_set.h" | 16 #include "extensions/common/extension_set.h" |
17 | 17 #include "third_party/smhasher/src/City.h" |
18 // From third_party/smhasher/src/City.h; that file can't be included here due | |
19 // to macro redefinitions (of UINT8_C, etc.) on Windows. | |
20 // TODO(mvrable): Clean up City.h so it can be included directly. | |
21 uint64 CityHash64(const char *buf, size_t len); | |
22 | 18 |
23 namespace { | 19 namespace { |
24 | 20 |
25 // The number of possible hash keys that a client may use. The UMA client_id | 21 // The number of possible hash keys that a client may use. The UMA client_id |
26 // value is reduced modulo this value to produce the key used by that | 22 // value is reduced modulo this value to produce the key used by that |
27 // particular client. | 23 // particular client. |
28 const size_t kExtensionListClientKeys = 4096; | 24 const size_t kExtensionListClientKeys = 4096; |
29 | 25 |
30 // The number of hash buckets into which extension IDs are mapped. This sets | 26 // The number of hash buckets into which extension IDs are mapped. This sets |
31 // the possible output range of the HashExtension function. | 27 // the possible output range of the HashExtension function. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); | 93 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
98 it != extensions->end(); ++it) { | 94 it != extensions->end(); ++it) { |
99 buckets.insert(HashExtension((*it)->id(), client_key_)); | 95 buckets.insert(HashExtension((*it)->id(), client_key_)); |
100 } | 96 } |
101 | 97 |
102 for (std::set<int>::const_iterator it = buckets.begin(); | 98 for (std::set<int>::const_iterator it = buckets.begin(); |
103 it != buckets.end(); ++it) { | 99 it != buckets.end(); ++it) { |
104 system_profile->add_occupied_extension_bucket(*it); | 100 system_profile->add_occupied_extension_bucket(*it); |
105 } | 101 } |
106 } | 102 } |
OLD | NEW |