Changed default value for swipe-to-close feature flag.
[chromium-blink-merge.git] / ppapi / tools / pepper_hash_for_uma.cc
blob6e38cfdd4b6483c7fe879cc50e17f4dd401a3037
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // This is a utility executable used for generating hashes for pepper
6 // interfaces for inclusion in tools/metrics/histograms/histograms.xml. Every
7 // interface-version pair must have a corresponding entry in the enum there.
8 //
9 // The hashing logic here must match the hashing logic at
10 // ppapi/proxy/interface_list.cc.
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <string.h>
16 #include "base/hash.h"
17 #include "base/macros.h"
19 int main(int argc, char **argv) {
20 if (argc < 2) {
21 fprintf(stderr, "Usage: %s <interface1> <interface2> <...>\n", argv[0]);
22 fprintf(stderr, "\n");
23 fprintf(stderr, "Prints hashes for interface names.\n");
24 fprintf(stderr, "Example: %s \"PPB_Var;1.1\" \"PPB_FileIO;1.2\"\n",
25 argv[0]);
26 return 1;
28 for (int i = 1; i < argc; i++) {
29 uint32 data = base::Hash(argv[i], strlen(argv[i]));
31 // Strip off the signed bit because UMA doesn't support negative values,
32 // but takes a signed int as input.
33 int hash = static_cast<int>(data & 0x7fffffff);
34 printf("<int value=\"%d\" label=\"%s\"/>\n", hash, argv[i]);
36 return 0;