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

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

Issue 273823002: Adding gtest helpers for BeginFrameArgs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change EXPECT_EQ(true/false to EXPECT_TRUE/FALSE(. 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/begin_frame_args_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 "base/json/json_writer.h" 5 #include "base/json/json_writer.h"
6 #include "cc/output/begin_frame_args.h" 6 #include "cc/output/begin_frame_args.h"
7 #include "ui/gfx/frame_time.h" 7 #include "ui/gfx/frame_time.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
(...skipping 19 matching lines...) Expand all
30 30
31 scoped_ptr<base::Value> BeginFrameArgs::AsValue() const { 31 scoped_ptr<base::Value> BeginFrameArgs::AsValue() const {
32 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue); 32 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue);
33 state->SetString("type", "BeginFrameArgs"); 33 state->SetString("type", "BeginFrameArgs");
34 state->SetDouble("frame_time_us", frame_time.ToInternalValue()); 34 state->SetDouble("frame_time_us", frame_time.ToInternalValue());
35 state->SetDouble("deadline_us", deadline.ToInternalValue()); 35 state->SetDouble("deadline_us", deadline.ToInternalValue());
36 state->SetDouble("interval_us", interval.InMicroseconds()); 36 state->SetDouble("interval_us", interval.InMicroseconds());
37 return state.PassAs<base::Value>(); 37 return state.PassAs<base::Value>();
38 } 38 }
39 39
40 BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor() { 40 BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor(
41 base::TimeTicks now) {
41 // For WebView/SynchronousCompositor, we always want to draw immediately, 42 // For WebView/SynchronousCompositor, we always want to draw immediately,
42 // so we set the deadline to 0 and guess that the interval is 16 milliseconds. 43 // so we set the deadline to 0 and guess that the interval is 16 milliseconds.
43 return BeginFrameArgs(gfx::FrameTime::Now(), 44 if (now.is_null())
44 base::TimeTicks(), 45 now = gfx::FrameTime::Now();
45 DefaultInterval()); 46 return BeginFrameArgs(now, base::TimeTicks(), DefaultInterval());
46 } 47 }
47 48
48 // This is a hard-coded deadline adjustment that assumes 60Hz, to be used in 49 // This is a hard-coded deadline adjustment that assumes 60Hz, to be used in
49 // cases where a good estimated draw time is not known. Using 1/3 of the vsync 50 // cases where a good estimated draw time is not known. Using 1/3 of the vsync
50 // as the default adjustment gives the Browser the last 1/3 of a frame to 51 // as the default adjustment gives the Browser the last 1/3 of a frame to
51 // produce output, the Renderer Impl thread the middle 1/3 of a frame to produce 52 // produce output, the Renderer Impl thread the middle 1/3 of a frame to produce
52 // ouput, and the Renderer Main thread the first 1/3 of a frame to produce 53 // ouput, and the Renderer Main thread the first 1/3 of a frame to produce
53 // output. 54 // output.
54 base::TimeDelta BeginFrameArgs::DefaultDeadlineAdjustment() { 55 base::TimeDelta BeginFrameArgs::DefaultDeadlineAdjustment() {
55 return base::TimeDelta::FromMicroseconds(-16666 / 3); 56 return base::TimeDelta::FromMicroseconds(-16666 / 3);
56 } 57 }
57 58
58 base::TimeDelta BeginFrameArgs::DefaultInterval() { 59 base::TimeDelta BeginFrameArgs::DefaultInterval() {
59 return base::TimeDelta::FromMicroseconds(16666); 60 return base::TimeDelta::FromMicroseconds(16666);
60 } 61 }
61 62
62 base::TimeDelta BeginFrameArgs::DefaultRetroactiveBeginFramePeriod() { 63 base::TimeDelta BeginFrameArgs::DefaultRetroactiveBeginFramePeriod() {
63 return base::TimeDelta::FromMicroseconds(4444); 64 return base::TimeDelta::FromMicroseconds(4444);
64 } 65 }
65 66
66 } // namespace cc 67 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/begin_frame_args.h ('k') | cc/output/begin_frame_args_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698