Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 posixpath | 5 import posixpath |
| 6 | 6 |
| 7 from api_data_source import _NODE_CATEGORIES | |
| 7 from api_schema_graph import APISchemaGraph | 8 from api_schema_graph import APISchemaGraph |
| 8 from branch_utility import BranchUtility, ChannelInfo | 9 from branch_utility import BranchUtility, ChannelInfo |
| 9 from compiled_file_system import CompiledFileSystem, SingleFile, Unicode | 10 from compiled_file_system import CompiledFileSystem, SingleFile, Unicode |
| 10 from extensions_paths import API_PATHS, JSON_TEMPLATES | 11 from extensions_paths import API_PATHS, JSON_TEMPLATES |
| 11 from features_bundle import FeaturesBundle | 12 from features_bundle import FeaturesBundle |
| 12 from file_system import FileNotFoundError | 13 from file_system import FileNotFoundError |
| 13 from schema_util import ProcessSchema | 14 from schema_util import ProcessSchema |
| 14 from third_party.json_schema_compiler.memoize import memoize | 15 from third_party.json_schema_compiler.memoize import memoize |
| 15 from third_party.json_schema_compiler.model import UnixName | 16 from third_party.json_schema_compiler.model import UnixName |
| 16 | 17 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 ''' | 196 ''' |
| 196 if version < _SVN_MIN_VERSION: | 197 if version < _SVN_MIN_VERSION: |
| 197 # SVN data isn't available below this version. | 198 # SVN data isn't available below this version. |
| 198 return False | 199 return False |
| 199 features_bundle = self._CreateFeaturesBundle(file_system) | 200 features_bundle = self._CreateFeaturesBundle(file_system) |
| 200 available_channel = None | 201 available_channel = None |
| 201 if version >= _API_FEATURES_MIN_VERSION: | 202 if version >= _API_FEATURES_MIN_VERSION: |
| 202 # The _api_features.json file first appears in version 28 and should be | 203 # The _api_features.json file first appears in version 28 and should be |
| 203 # the most reliable for finding API availability. | 204 # the most reliable for finding API availability. |
| 204 available_channel = _GetChannelFromAPIFeatures(api_name, | 205 available_channel = _GetChannelFromAPIFeatures(api_name, |
| 205 features_bundle) | 206 features_bundle) |
| 206 if version >= _ORIGINAL_FEATURES_MIN_VERSION: | 207 if version >= _ORIGINAL_FEATURES_MIN_VERSION: |
| 207 # The _permission_features.json and _manifest_features.json files are | 208 # The _permission_features.json and _manifest_features.json files are |
| 208 # present in Chrome 20 and onwards. Use these if no information could be | 209 # present in Chrome 20 and onwards. Use these if no information could be |
| 209 # found using _api_features.json. | 210 # found using _api_features.json. |
| 210 available_channel = ( | 211 available_channel = ( |
| 211 available_channel or | 212 available_channel or |
| 212 _GetChannelFromPermissionFeatures(api_name, features_bundle) or | 213 _GetChannelFromPermissionFeatures(api_name, features_bundle) or |
| 213 _GetChannelFromManifestFeatures(api_name, features_bundle)) | 214 _GetChannelFromManifestFeatures(api_name, features_bundle)) |
| 214 if available_channel is not None: | 215 if available_channel is not None: |
| 215 return available_channel == 'stable' | 216 return available_channel == 'stable' |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 else: | 359 else: |
| 359 # Keep track of any new schema elements from this version by adding | 360 # Keep track of any new schema elements from this version by adding |
| 360 # them to |availability_graph|. | 361 # them to |availability_graph|. |
| 361 # | 362 # |
| 362 # Calling |availability_graph|.Lookup() on the nodes being updated | 363 # Calling |availability_graph|.Lookup() on the nodes being updated |
| 363 # will return the |annotation| object -- the current |channel_info|. | 364 # will return the |annotation| object -- the current |channel_info|. |
| 364 version_graph = APISchemaGraph(self._GetAPISchema(api_name, | 365 version_graph = APISchemaGraph(self._GetAPISchema(api_name, |
| 365 file_system, | 366 file_system, |
| 366 channel_info.version)) | 367 channel_info.version)) |
| 367 availability_graph.Update(version_graph.Subtract(availability_graph), | 368 availability_graph.Update(version_graph.Subtract(availability_graph), |
| 368 annotation=channel_info) | 369 annotation=AvailabilityInfo(channel_info)) |
| 369 | 370 |
| 370 previous.stat = version_stat | 371 previous.stat = version_stat |
| 371 previous.graph = version_graph | 372 previous.graph = version_graph |
| 372 | 373 |
| 373 # Continue looping until there are no longer differences between this | 374 # Continue looping until there are no longer differences between this |
| 374 # version and trunk. | 375 # version and trunk. |
| 375 return version_stat != trunk_stat | 376 return version_stat != trunk_stat |
| 376 | 377 |
| 377 self._file_system_iterator.Ascending( | 378 self._file_system_iterator.Ascending( |
| 378 self.GetAPIAvailability(api_name).channel_info, | 379 self.GetAPIAvailability(api_name).channel_info, |
| 379 update_availability_graph) | 380 update_availability_graph) |
| 380 | 381 |
| 382 # Check if any top-level nodes are scheduled. | |
|
not at google - send to devlin
2014/07/17 20:30:06
wait when does this logic kick in?
ahernandez
2014/07/17 20:35:24
This happens right after the graph is constructed.
not at google - send to devlin
2014/07/17 20:47:21
I guess i mean why do you need to add this now
ahernandez
2014/07/17 20:50:01
Oh, did you want that in a separate patch? That pr
not at google - send to devlin
2014/07/17 20:57:31
If you don't need it for this patch then yeah.
| |
| 383 graph = availability_graph._graph | |
| 384 for category in _NODE_CATEGORIES: | |
| 385 if category in graph[api_name]: | |
| 386 for node in graph[api_name][category].iterkeys(): | |
| 387 annotation = graph[api_name][category][node]._annotation | |
| 388 if annotation.channel_info.channel != 'stable': | |
| 389 scheduled = self._FindScheduled('%s.%s' % (api_name, node)) | |
| 390 if scheduled is not None: | |
| 391 # Do not change the existing annotation object, but create | |
| 392 # a new one because multiple nodes may share the same old | |
| 393 # annotation object. | |
| 394 graph[api_name][category][node]._annotation = AvailabilityInfo( | |
| 395 annotation.channel_info, scheduled = scheduled) | |
| 396 | |
| 381 self._node_level_object_store.Set(api_name, availability_graph) | 397 self._node_level_object_store.Set(api_name, availability_graph) |
| 382 return availability_graph | 398 return availability_graph |
| OLD | NEW |