| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import time | 4 import time |
| 5 | 5 |
| 6 from profile_creators import profile_extender |
| 6 from telemetry.core import browser_finder | 7 from telemetry.core import browser_finder |
| 7 from telemetry.core import browser_finder_exceptions | 8 from telemetry.core import browser_finder_exceptions |
| 8 from telemetry.core import exceptions | 9 from telemetry.core import exceptions |
| 9 from telemetry.core import platform | 10 from telemetry.core import platform |
| 10 | 11 |
| 11 | 12 |
| 12 class FastNavigationProfileExtender(object): | 13 class FastNavigationProfileExtender(profile_extender.ProfileExtender): |
| 13 """Extends a Chrome profile. | 14 """Extends a Chrome profile. |
| 14 | 15 |
| 15 This class creates or extends an existing profile by performing a set of tab | 16 This class creates or extends an existing profile by performing a set of tab |
| 16 navigations in large batches. This is accomplished by opening a large number | 17 navigations in large batches. This is accomplished by opening a large number |
| 17 of tabs, simultaneously navigating all the tabs, and then waiting for all the | 18 of tabs, simultaneously navigating all the tabs, and then waiting for all the |
| 18 tabs to load. This provides two benefits: | 19 tabs to load. This provides two benefits: |
| 19 - Takes advantage of the high number of logical cores on modern CPUs. | 20 - Takes advantage of the high number of logical cores on modern CPUs. |
| 20 - The total time spent waiting for navigations to time out scales linearly | 21 - The total time spent waiting for navigations to time out scales linearly |
| 21 with the number of batches, but does not scale with the size of the | 22 with the number of batches, but does not scale with the size of the |
| 22 batch. | 23 batch. |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 tab = self._navigation_tabs[i] | 272 tab = self._navigation_tabs[i] |
| 272 batch.append((tab, url)) | 273 batch.append((tab, url)) |
| 273 | 274 |
| 274 queued_tabs = self._BatchNavigateTabs(batch) | 275 queued_tabs = self._BatchNavigateTabs(batch) |
| 275 self._WaitForQueuedTabsToLoad(queued_tabs) | 276 self._WaitForQueuedTabsToLoad(queued_tabs) |
| 276 | 277 |
| 277 self.CleanUpAfterBatchNavigation() | 278 self.CleanUpAfterBatchNavigation() |
| 278 | 279 |
| 279 if self.ShouldExitAfterBatchNavigation(): | 280 if self.ShouldExitAfterBatchNavigation(): |
| 280 break | 281 break |
| OLD | NEW |