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

Side by Side Diff: cc/output/begin_frame_args.cc

Issue 275543004: Refactoring the debug creation of BeginFrameArgs objects to be in unittest code only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing onto upstream master. Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « cc/output/begin_frame_args.h ('k') | cc/output/output_surface_unittest.cc » ('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 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 #include "cc/output/begin_frame_args.h" 5 #include "cc/output/begin_frame_args.h"
6 #include "ui/gfx/frame_time.h" 6 #include "ui/gfx/frame_time.h"
7 7
8 namespace cc { 8 namespace cc {
9 9
10 BeginFrameArgs::BeginFrameArgs() 10 BeginFrameArgs::BeginFrameArgs()
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor() { 30 BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor() {
31 // For WebView/SynchronousCompositor, we always want to draw immediately, 31 // For WebView/SynchronousCompositor, we always want to draw immediately,
32 // so we set the deadline to 0 and guess that the interval is 16 milliseconds. 32 // so we set the deadline to 0 and guess that the interval is 16 milliseconds.
33 return BeginFrameArgs(gfx::FrameTime::Now(), 33 return BeginFrameArgs(gfx::FrameTime::Now(),
34 base::TimeTicks(), 34 base::TimeTicks(),
35 DefaultInterval()); 35 DefaultInterval());
36 } 36 }
37 37
38 BeginFrameArgs BeginFrameArgs::CreateForTesting() {
39 base::TimeTicks now = gfx::FrameTime::Now();
40 return BeginFrameArgs(now,
41 now + (DefaultInterval() / 2),
42 DefaultInterval());
43 }
44
45 BeginFrameArgs BeginFrameArgs::CreateExpiredForTesting() {
46 base::TimeTicks now = gfx::FrameTime::Now();
47 return BeginFrameArgs(now,
48 now - DefaultInterval(),
49 DefaultInterval());
50 }
51
52 // This is a hard-coded deadline adjustment that assumes 60Hz, to be used in 38 // This is a hard-coded deadline adjustment that assumes 60Hz, to be used in
53 // cases where a good estimated draw time is not known. Using 1/3 of the vsync 39 // cases where a good estimated draw time is not known. Using 1/3 of the vsync
54 // as the default adjustment gives the Browser the last 1/3 of a frame to 40 // as the default adjustment gives the Browser the last 1/3 of a frame to
55 // produce output, the Renderer Impl thread the middle 1/3 of a frame to produce 41 // produce output, the Renderer Impl thread the middle 1/3 of a frame to produce
56 // ouput, and the Renderer Main thread the first 1/3 of a frame to produce 42 // ouput, and the Renderer Main thread the first 1/3 of a frame to produce
57 // output. 43 // output.
58 base::TimeDelta BeginFrameArgs::DefaultDeadlineAdjustment() { 44 base::TimeDelta BeginFrameArgs::DefaultDeadlineAdjustment() {
59 return base::TimeDelta::FromMicroseconds(-16666 / 3); 45 return base::TimeDelta::FromMicroseconds(-16666 / 3);
60 } 46 }
61 47
62 base::TimeDelta BeginFrameArgs::DefaultInterval() { 48 base::TimeDelta BeginFrameArgs::DefaultInterval() {
63 return base::TimeDelta::FromMicroseconds(16666); 49 return base::TimeDelta::FromMicroseconds(16666);
64 } 50 }
65 51
66 base::TimeDelta BeginFrameArgs::DefaultRetroactiveBeginFramePeriod() { 52 base::TimeDelta BeginFrameArgs::DefaultRetroactiveBeginFramePeriod() {
67 return base::TimeDelta::FromMicroseconds(4444); 53 return base::TimeDelta::FromMicroseconds(4444);
68 } 54 }
69 55
70 } // namespace cc 56 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/begin_frame_args.h ('k') | cc/output/output_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698