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_schema_graph import APISchemaGraph | 7 from api_schema_graph import APISchemaGraph |
8 from branch_utility import BranchUtility, ChannelInfo | 8 from branch_utility import BranchUtility, ChannelInfo |
9 from compiled_file_system import CompiledFileSystem, SingleFile, Unicode | 9 from compiled_file_system import CompiledFileSystem, SingleFile, Unicode |
10 from extensions_paths import API_PATHS, JSON_TEMPLATES | 10 from extensions_paths import API_PATHS, JSON_TEMPLATES |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 ''' | 195 ''' |
196 if version < _SVN_MIN_VERSION: | 196 if version < _SVN_MIN_VERSION: |
197 # SVN data isn't available below this version. | 197 # SVN data isn't available below this version. |
198 return False | 198 return False |
199 features_bundle = self._CreateFeaturesBundle(file_system) | 199 features_bundle = self._CreateFeaturesBundle(file_system) |
200 available_channel = None | 200 available_channel = None |
201 if version >= _API_FEATURES_MIN_VERSION: | 201 if version >= _API_FEATURES_MIN_VERSION: |
202 # The _api_features.json file first appears in version 28 and should be | 202 # The _api_features.json file first appears in version 28 and should be |
203 # the most reliable for finding API availability. | 203 # the most reliable for finding API availability. |
204 available_channel = _GetChannelFromAPIFeatures(api_name, | 204 available_channel = _GetChannelFromAPIFeatures(api_name, |
205 features_bundle) | 205 features_bundle) |
206 if version >= _ORIGINAL_FEATURES_MIN_VERSION: | 206 if version >= _ORIGINAL_FEATURES_MIN_VERSION: |
207 # The _permission_features.json and _manifest_features.json files are | 207 # The _permission_features.json and _manifest_features.json files are |
208 # present in Chrome 20 and onwards. Use these if no information could be | 208 # present in Chrome 20 and onwards. Use these if no information could be |
209 # found using _api_features.json. | 209 # found using _api_features.json. |
210 available_channel = ( | 210 available_channel = ( |
211 available_channel or | 211 available_channel or |
212 _GetChannelFromPermissionFeatures(api_name, features_bundle) or | 212 _GetChannelFromPermissionFeatures(api_name, features_bundle) or |
213 _GetChannelFromManifestFeatures(api_name, features_bundle)) | 213 _GetChannelFromManifestFeatures(api_name, features_bundle)) |
214 if available_channel is not None: | 214 if available_channel is not None: |
215 return available_channel == 'stable' | 215 return available_channel == 'stable' |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 else: | 358 else: |
359 # Keep track of any new schema elements from this version by adding | 359 # Keep track of any new schema elements from this version by adding |
360 # them to |availability_graph|. | 360 # them to |availability_graph|. |
361 # | 361 # |
362 # Calling |availability_graph|.Lookup() on the nodes being updated | 362 # Calling |availability_graph|.Lookup() on the nodes being updated |
363 # will return the |annotation| object -- the current |channel_info|. | 363 # will return the |annotation| object -- the current |channel_info|. |
364 version_graph = APISchemaGraph(self._GetAPISchema(api_name, | 364 version_graph = APISchemaGraph(self._GetAPISchema(api_name, |
365 file_system, | 365 file_system, |
366 channel_info.version)) | 366 channel_info.version)) |
367 availability_graph.Update(version_graph.Subtract(availability_graph), | 367 availability_graph.Update(version_graph.Subtract(availability_graph), |
368 annotation=channel_info) | 368 annotation=AvailabilityInfo(channel_info)) |
369 | 369 |
370 previous.stat = version_stat | 370 previous.stat = version_stat |
371 previous.graph = version_graph | 371 previous.graph = version_graph |
372 | 372 |
373 # Continue looping until there are no longer differences between this | 373 # Continue looping until there are no longer differences between this |
374 # version and trunk. | 374 # version and trunk. |
375 return version_stat != trunk_stat | 375 return version_stat != trunk_stat |
376 | 376 |
377 self._file_system_iterator.Ascending( | 377 self._file_system_iterator.Ascending( |
378 self.GetAPIAvailability(api_name).channel_info, | 378 self.GetAPIAvailability(api_name).channel_info, |
379 update_availability_graph) | 379 update_availability_graph) |
380 | 380 |
381 self._node_level_object_store.Set(api_name, availability_graph) | 381 self._node_level_object_store.Set(api_name, availability_graph) |
382 return availability_graph | 382 return availability_graph |
OLD | NEW |