Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: tools/json_schema_compiler/model.py

Issue 12375006: Added UMA stats for extensions events on addListener. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 import copy 5 import copy
6 import os.path 6 import os.path
7 import re 7 import re
8 8
9 from json_parse import OrderedDict 9 from json_parse import OrderedDict
10 10
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 def _GetEvents(parent, json, namespace): 424 def _GetEvents(parent, json, namespace):
425 """Creates Function objects generated from the events in |json|. 425 """Creates Function objects generated from the events in |json|.
426 """ 426 """
427 events = OrderedDict() 427 events = OrderedDict()
428 for event_json in json.get('events', []): 428 for event_json in json.get('events', []):
429 event = Function(parent, 429 event = Function(parent,
430 event_json['name'], 430 event_json['name'],
431 event_json, 431 event_json,
432 namespace, 432 namespace,
433 Origin(from_client=True)) 433 Origin(from_client=True))
434 event.histogram_name = event_json.get('histogram_name')
434 events[event.name] = event 435 events[event.name] = event
435 return events 436 return events
436 437
437 def _GetProperties(parent, json, namespace, origin): 438 def _GetProperties(parent, json, namespace, origin):
438 """Generates Property objects extracted from |json|. 439 """Generates Property objects extracted from |json|.
439 """ 440 """
440 properties = OrderedDict() 441 properties = OrderedDict()
441 for name, property_json in json.get('properties', {}).items(): 442 for name, property_json in json.get('properties', {}).items():
442 properties[name] = Property(parent, name, property_json, namespace, origin) 443 properties[name] = Property(parent, name, property_json, namespace, origin)
443 return properties 444 return properties
(...skipping 14 matching lines...) Expand all
458 def _GetPlatforms(json): 459 def _GetPlatforms(json):
459 if 'platforms' not in json: 460 if 'platforms' not in json:
460 return None 461 return None
461 platforms = [] 462 platforms = []
462 for platform_name in json['platforms']: 463 for platform_name in json['platforms']:
463 for platform_enum in _Enum.GetAll(Platforms): 464 for platform_enum in _Enum.GetAll(Platforms):
464 if platform_name == platform_enum.name: 465 if platform_name == platform_enum.name:
465 platforms.append(platform_enum) 466 platforms.append(platform_enum)
466 break 467 break
467 return platforms 468 return platforms
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698