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 from collections import Mapping | 5 from collections import Mapping |
| 6 import posixpath | 6 import posixpath |
| 7 | 7 |
| 8 from api_schema_graph import APISchemaGraph | 8 from api_schema_graph import APISchemaGraph |
| 9 from branch_utility import BranchUtility | 9 from branch_utility import BranchUtility |
| 10 from extensions_paths import API_PATHS, JSON_TEMPLATES | 10 from extensions_paths import API_PATHS, JSON_TEMPLATES |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 determined to be 'stable' at the given version. | 201 determined to be 'stable' at the given version. |
| 202 ''' | 202 ''' |
| 203 if channel_info.channel == 'stable': | 203 if channel_info.channel == 'stable': |
| 204 return self._CheckStableAvailability(api_name, | 204 return self._CheckStableAvailability(api_name, |
| 205 file_system, | 205 file_system, |
| 206 channel_info.version) | 206 channel_info.version) |
| 207 return self._CheckChannelAvailability(api_name, | 207 return self._CheckChannelAvailability(api_name, |
| 208 file_system, | 208 file_system, |
| 209 channel_info) | 209 channel_info) |
| 210 | 210 |
| 211 def _FindScheduled(self, api_name): | |
| 212 '''Determines the earliest version of Chrome where the API is stable. | |
| 213 Unlike the code in GetApiAvailability, this checks if the API is stable | |
| 214 even when Chrome is in dev or beta, which shows that the API is scheduled | |
| 215 to be stable in that verison of Chrome. | |
| 216 ''' | |
| 217 def check_scheduled(file_system, channel_info): | |
| 218 return self._CheckStableAvailability(api_name, | |
|
jshumway
2014/04/25 21:34:43
When arguments go past the end of the line but are
danielj41
2014/04/25 22:24:49
Done.
| |
| 219 file_system, | |
| 220 channel_info.version) | |
| 221 stable_availability = self._file_system_iterator.Descending( | |
| 222 self._branch_utility.GetChannelInfo('dev'), | |
| 223 check_scheduled) | |
|
jshumway
2014/04/25 21:34:43
These two arguments can be on the same line under
danielj41
2014/04/25 22:24:49
Done.
| |
| 224 if stable_availability: | |
| 225 return stable_availability.version | |
| 226 else: | |
| 227 return None | |
|
jshumway
2014/04/25 21:34:43
The above if else can be
return stable_availabili
danielj41
2014/04/25 22:24:49
Done.
| |
| 228 | |
| 211 def GetApiAvailability(self, api_name): | 229 def GetApiAvailability(self, api_name): |
| 212 '''Performs a search for an API's top-level availability by using a | 230 '''Performs a search for an API's top-level availability by using a |
| 213 HostFileSystemIterator instance to traverse multiple version of the | 231 HostFileSystemIterator instance to traverse multiple version of the |
| 214 SVN filesystem. | 232 SVN filesystem. |
| 215 ''' | 233 ''' |
| 216 availability = self._top_level_object_store.Get(api_name).Get() | 234 availability = self._top_level_object_store.Get(api_name).Get() |
| 217 if availability is not None: | 235 if availability is not None: |
| 218 return availability | 236 return availability |
| 219 | 237 |
| 220 # Check for predetermined availability and cache this information if found. | 238 # Check for predetermined availability and cache this information if found. |
| 221 availability = self._GetPredeterminedAvailability(api_name) | 239 availability = self._GetPredeterminedAvailability(api_name) |
| 222 if availability is not None: | 240 if availability is not None: |
| 223 self._top_level_object_store.Set(api_name, availability) | 241 self._top_level_object_store.Set(api_name, availability) |
| 224 return availability | 242 return availability |
| 225 | 243 |
| 226 def check_api_availability(file_system, channel_info): | 244 def check_api_availability(file_system, channel_info): |
| 227 return self._CheckApiAvailability(api_name, file_system, channel_info) | 245 return self._CheckApiAvailability(api_name, file_system, channel_info) |
| 228 | 246 |
| 229 availability = self._file_system_iterator.Descending( | 247 availability = self._file_system_iterator.Descending( |
| 230 self._branch_utility.GetChannelInfo('dev'), | 248 self._branch_utility.GetChannelInfo('dev'), |
| 231 check_api_availability) | 249 check_api_availability) |
| 232 if availability is None: | 250 if availability is None: |
| 233 # The API wasn't available on 'dev', so it must be a 'trunk'-only API. | 251 # The API wasn't available on 'dev', so it must be a 'trunk'-only API. |
| 234 availability = self._branch_utility.GetChannelInfo('trunk') | 252 availability = self._branch_utility.GetChannelInfo('trunk') |
| 253 | |
| 254 # If the API is not stable, check if it is stable in the dev or beta | |
| 255 # versions of Chrome. This means that the API is scheduled to be stable. | |
| 256 if availability.channel != 'stable': | |
| 257 availability.scheduled = self._FindScheduled(api_name) | |
| 258 | |
| 235 self._top_level_object_store.Set(api_name, availability) | 259 self._top_level_object_store.Set(api_name, availability) |
| 236 return availability | 260 return availability |
| 237 | 261 |
| 238 def GetApiNodeAvailability(self, api_name): | 262 def GetApiNodeAvailability(self, api_name): |
| 239 '''Returns an APISchemaGraph annotated with each node's availability (the | 263 '''Returns an APISchemaGraph annotated with each node's availability (the |
| 240 ChannelInfo at the oldest channel it's available in). | 264 ChannelInfo at the oldest channel it's available in). |
| 241 ''' | 265 ''' |
| 242 availability_graph = self._node_level_object_store.Get(api_name).Get() | 266 availability_graph = self._node_level_object_store.Get(api_name).Get() |
| 243 if availability_graph is not None: | 267 if availability_graph is not None: |
| 244 return availability_graph | 268 return availability_graph |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 | 306 |
| 283 # Continue looping until there are no longer differences between this | 307 # Continue looping until there are no longer differences between this |
| 284 # version and trunk. | 308 # version and trunk. |
| 285 return version_stat != trunk_stat | 309 return version_stat != trunk_stat |
| 286 | 310 |
| 287 self._file_system_iterator.Ascending(self.GetApiAvailability(api_name), | 311 self._file_system_iterator.Ascending(self.GetApiAvailability(api_name), |
| 288 update_availability_graph) | 312 update_availability_graph) |
| 289 | 313 |
| 290 self._node_level_object_store.Set(api_name, availability_graph) | 314 self._node_level_object_store.Set(api_name, availability_graph) |
| 291 return availability_graph | 315 return availability_graph |
| OLD | NEW |