diff options
author | mithro@mithis.com <mithro@mithis.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-10 02:16:02 +0000 |
---|---|---|
committer | mithro@mithis.com <mithro@mithis.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-10 02:16:02 +0000 |
commit | fc441c6d790e1b8e7bf890cebe6c7577317a158c (patch) | |
tree | a1749683debd74a55c42b92f8685db43ef9407b7 /cc/output | |
parent | 9d70de1a6c9c22c1ea9baa2ea02233dcc0cf5479 (diff) | |
download | chromium_src-fc441c6d790e1b8e7bf890cebe6c7577317a158c.zip chromium_src-fc441c6d790e1b8e7bf890cebe6c7577317a158c.tar.gz chromium_src-fc441c6d790e1b8e7bf890cebe6c7577317a158c.tar.bz2 |
Making BeginFrameArgs work with TRACE_EVENT system.
* Added ToValue() method on BeginFrameArgs.
* Added a ToTrace method inside cc/traced_value.h for easy conversion, just do a ToTrace(XXX) of anything which has a ToValue() method.
* Rename Scheduler::StateAsValue to AsValue so it works with above.
BUG=371223
Review URL: https://codereview.chromium.org/270703004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269487 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/output')
-rw-r--r-- | cc/output/begin_frame_args.cc | 10 | ||||
-rw-r--r-- | cc/output/begin_frame_args.h | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/cc/output/begin_frame_args.cc b/cc/output/begin_frame_args.cc index 9766b626..2d7cd96 100644 --- a/cc/output/begin_frame_args.cc +++ b/cc/output/begin_frame_args.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/json/json_writer.h" #include "cc/output/begin_frame_args.h" #include "ui/gfx/frame_time.h" @@ -27,6 +28,15 @@ BeginFrameArgs BeginFrameArgs::Create(base::TimeTicks frame_time, return BeginFrameArgs(frame_time, deadline, interval); } +scoped_ptr<base::Value> BeginFrameArgs::AsValue() const { + scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue); + state->SetString("type", "BeginFrameArgs"); + state->SetDouble("frame_time_us", frame_time.ToInternalValue()); + state->SetDouble("deadline_us", deadline.ToInternalValue()); + state->SetDouble("interval_us", interval.InMicroseconds()); + return state.PassAs<base::Value>(); +} + BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor() { // For WebView/SynchronousCompositor, we always want to draw immediately, // so we set the deadline to 0 and guess that the interval is 16 milliseconds. diff --git a/cc/output/begin_frame_args.h b/cc/output/begin_frame_args.h index 2332fd4..4bc352b 100644 --- a/cc/output/begin_frame_args.h +++ b/cc/output/begin_frame_args.h @@ -6,6 +6,7 @@ #define CC_OUTPUT_BEGIN_FRAME_ARGS_H_ #include "base/time/time.h" +#include "base/values.h" #include "cc/base/cc_export.h" namespace cc { @@ -37,6 +38,8 @@ struct CC_EXPORT BeginFrameArgs { bool IsValid() const { return interval >= base::TimeDelta(); } + scoped_ptr<base::Value> AsValue() const; + base::TimeTicks frame_time; base::TimeTicks deadline; base::TimeDelta interval; |