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

Side by Side Diff: tools/perf/measurements/repaint.py

Issue 1089223003: Move all the page actions from repaint measurements to repaint pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « tools/perf/benchmarks/repaint.py ('k') | tools/perf/measurements/repaint_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 telemetry.page import page_test 5 from telemetry.page import page_test
6 6
7 from measurements import smoothness_controller 7 from measurements import smoothness_controller
8 8
9 9
10 class Repaint(page_test.PageTest): 10 class Repaint(page_test.PageTest):
11 def __init__(self, mode='viewport', width=None, height=None): 11 def __init__(self):
12 super(Repaint, self).__init__() 12 super(Repaint, self).__init__()
13 self._smoothness_controller = None 13 self._smoothness_controller = None
14 self._micro_benchmark_id = None
15 self._mode = mode
16 self._width = width
17 self._height = height
18 14
19 def CustomizeBrowserOptions(self, options): 15 def CustomizeBrowserOptions(self, options):
20 options.AppendExtraBrowserArgs([ 16 options.AppendExtraBrowserArgs([
21 '--enable-impl-side-painting', 17 '--enable-impl-side-painting',
22 '--enable-threaded-compositing', 18 '--enable-threaded-compositing',
23 '--enable-gpu-benchmarking' 19 '--enable-gpu-benchmarking'
24 ]) 20 ])
25 21
26 def WillRunActions(self, page, tab): 22 def WillRunActions(self, page, tab):
27 tab.WaitForDocumentReadyStateToBeComplete() 23 tab.WaitForDocumentReadyStateToBeComplete()
28 self._smoothness_controller = smoothness_controller.SmoothnessController( 24 self._smoothness_controller = smoothness_controller.SmoothnessController(
29 auto_issuing_marker=False) 25 auto_issuing_marker=False)
30 self._smoothness_controller.SetUp(page, tab) 26 self._smoothness_controller.SetUp(page, tab)
31 self._smoothness_controller.Start(tab) 27 self._smoothness_controller.Start(tab)
32 # Rasterize only what's visible.
33 tab.ExecuteJavaScript(
34 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();')
35
36 args = {}
37 args['mode'] = self._mode
38 if self._width:
39 args['width'] = self._width
40 if self._height:
41 args['height'] = self._height
42
43 # Enque benchmark
44 tab.ExecuteJavaScript("""
45 window.benchmark_results = {};
46 window.benchmark_results.id =
47 chrome.gpuBenchmarking.runMicroBenchmark(
48 "invalidation_benchmark",
49 function(value) {},
50 """ + str(args) + """
51 );
52 """)
53
54 self._micro_benchmark_id = tab.EvaluateJavaScript(
55 'window.benchmark_results.id')
56 if (not self._micro_benchmark_id):
57 raise page_test.MeasurementFailure(
58 'Failed to schedule invalidation_benchmark.')
59 28
60 def DidRunActions(self, page, tab): 29 def DidRunActions(self, page, tab):
61 tab.ExecuteJavaScript("""
62 window.benchmark_results.message_handled =
63 chrome.gpuBenchmarking.sendMessageToMicroBenchmark(
64 """ + str(self._micro_benchmark_id) + """, {
65 "notify_done": true
66 });
67 """)
68 self._smoothness_controller.Stop(tab) 30 self._smoothness_controller.Stop(tab)
69 31
70 def ValidateAndMeasurePage(self, page, tab, results): 32 def ValidateAndMeasurePage(self, page, tab, results):
71 self._smoothness_controller.AddResults(tab, results) 33 self._smoothness_controller.AddResults(tab, results)
72 34
73 def CleanUpAfterPage(self, _, tab): 35 def CleanUpAfterPage(self, _, tab):
74 self._smoothness_controller.CleanUp(tab) 36 self._smoothness_controller.CleanUp(tab)
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/repaint.py ('k') | tools/perf/measurements/repaint_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698