diff options
author | erikchen@chromium.org <erikchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-31 19:02:09 +0000 |
---|---|---|
committer | erikchen@chromium.org <erikchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-31 19:02:09 +0000 |
commit | 88bcc14cd89a644f09a0ec660901c1454a5526c0 (patch) | |
tree | 92d22c761b891111bd7ebefb625d027afbd065b7 /cc/base | |
parent | e9b84dd07ea9dc15a4315703bd94a0b0d89052f9 (diff) | |
download | chromium_src-88bcc14cd89a644f09a0ec660901c1454a5526c0.zip chromium_src-88bcc14cd89a644f09a0ec660901c1454a5526c0.tar.gz chromium_src-88bcc14cd89a644f09a0ec660901c1454a5526c0.tar.bz2 |
Revert of Add builders for tracing event's structural arguments (https://codereview.chromium.org/380763002/)
Reason for revert:
linux ASAN errors.
http://build.chromium.org/p/chromium.memory/builders/Linux%20ASan%20LSan%20Tests%20%281%29/builds/4493/steps/base_unittests/logs/stdio
Original issue's description:
> Add builders for tracing event's structural arguments
>
> The new classes allow building JSON-like structural arguments. Current implementation uses base::Value as backing store but that can be replaced in the future with something more efficient without changing client code.
>
> All clients of cc/debug/traced_value.h should eventually switch to use the new builders.
>
> BUG=361045
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=286849
TBR=alph, caseq, dsinclair, nduca, willchan, yurys
NOTREECHECKS=true
NOTRY=true
BUG=361045
Review URL: https://codereview.chromium.org/421183003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286862 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/base')
-rw-r--r-- | cc/base/math_util.cc | 74 | ||||
-rw-r--r-- | cc/base/math_util.h | 39 | ||||
-rw-r--r-- | cc/base/region.cc | 11 | ||||
-rw-r--r-- | cc/base/region.h | 4 |
4 files changed, 41 insertions, 87 deletions
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc index fd8e796..07ad77b 100644 --- a/cc/base/math_util.cc +++ b/cc/base/math_util.cc @@ -8,7 +8,6 @@ #include <cmath> #include <limits> -#include "base/debug/trace_event_argument.h" #include "base/values.h" #include "ui/gfx/quad_f.h" #include "ui/gfx/rect.h" @@ -548,6 +547,13 @@ scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Size& s) { return res.PassAs<base::Value>(); } +scoped_ptr<base::Value> MathUtil::AsValue(const gfx::SizeF& s) { + scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); + res->SetDouble("width", s.width()); + res->SetDouble("height", s.height()); + return res.PassAs<base::Value>(); +} + scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Rect& r) { scoped_ptr<base::ListValue> res(new base::ListValue()); res->AppendInteger(r.x()); @@ -585,47 +591,23 @@ scoped_ptr<base::Value> MathUtil::AsValue(const gfx::PointF& pt) { return res.PassAs<base::Value>(); } -void MathUtil::AddToTracedValue(const gfx::Size& s, - base::debug::TracedValue* res) { - res->SetDouble("width", s.width()); - res->SetDouble("height", s.height()); -} - -void MathUtil::AddToTracedValue(const gfx::SizeF& s, - base::debug::TracedValue* res) { - res->SetDouble("width", s.width()); - res->SetDouble("height", s.height()); -} - -void MathUtil::AddToTracedValue(const gfx::Rect& r, - base::debug::TracedValue* res) { - res->AppendInteger(r.x()); - res->AppendInteger(r.y()); - res->AppendInteger(r.width()); - res->AppendInteger(r.height()); -} - -void MathUtil::AddToTracedValue(const gfx::PointF& pt, - base::debug::TracedValue* res) { - res->AppendDouble(pt.x()); - res->AppendDouble(pt.y()); -} - -void MathUtil::AddToTracedValue(const gfx::Point3F& pt, - base::debug::TracedValue* res) { +scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Point3F& pt) { + scoped_ptr<base::ListValue> res(new base::ListValue()); res->AppendDouble(pt.x()); res->AppendDouble(pt.y()); res->AppendDouble(pt.z()); + return res.PassAs<base::Value>(); } -void MathUtil::AddToTracedValue(const gfx::Vector2d& v, - base::debug::TracedValue* res) { +scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Vector2d& v) { + scoped_ptr<base::ListValue> res(new base::ListValue()); res->AppendInteger(v.x()); res->AppendInteger(v.y()); + return res.PassAs<base::Value>(); } -void MathUtil::AddToTracedValue(const gfx::QuadF& q, - base::debug::TracedValue* res) { +scoped_ptr<base::Value> MathUtil::AsValue(const gfx::QuadF& q) { + scoped_ptr<base::ListValue> res(new base::ListValue()); res->AppendDouble(q.p1().x()); res->AppendDouble(q.p1().y()); res->AppendDouble(q.p2().x()); @@ -634,41 +616,47 @@ void MathUtil::AddToTracedValue(const gfx::QuadF& q, res->AppendDouble(q.p3().y()); res->AppendDouble(q.p4().x()); res->AppendDouble(q.p4().y()); + return res.PassAs<base::Value>(); } -void MathUtil::AddToTracedValue(const gfx::RectF& rect, - base::debug::TracedValue* res) { +scoped_ptr<base::Value> MathUtil::AsValue(const gfx::RectF& rect) { + scoped_ptr<base::ListValue> res(new base::ListValue()); res->AppendDouble(rect.x()); res->AppendDouble(rect.y()); res->AppendDouble(rect.width()); res->AppendDouble(rect.height()); + return res.PassAs<base::Value>(); } -void MathUtil::AddToTracedValue(const gfx::Transform& transform, - base::debug::TracedValue* res) { +scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Transform& transform) { + scoped_ptr<base::ListValue> res(new base::ListValue()); const SkMatrix44& m = transform.matrix(); for (int row = 0; row < 4; ++row) { for (int col = 0; col < 4; ++col) res->AppendDouble(m.getDouble(row, col)); } + return res.PassAs<base::Value>(); } -void MathUtil::AddToTracedValue(const gfx::BoxF& box, - base::debug::TracedValue* res) { +scoped_ptr<base::Value> MathUtil::AsValue(const gfx::BoxF& box) { + scoped_ptr<base::ListValue> res(new base::ListValue()); res->AppendInteger(box.x()); res->AppendInteger(box.y()); res->AppendInteger(box.z()); res->AppendInteger(box.width()); res->AppendInteger(box.height()); res->AppendInteger(box.depth()); + return res.PassAs<base::Value>(); } -double MathUtil::AsDoubleSafely(double value) { - return std::min(value, std::numeric_limits<double>::max()); +scoped_ptr<base::Value> MathUtil::AsValueSafely(double value) { + return scoped_ptr<base::Value>(new base::FundamentalValue( + std::min(value, std::numeric_limits<double>::max()))); } -float MathUtil::AsFloatSafely(float value) { - return std::min(value, std::numeric_limits<float>::max()); +scoped_ptr<base::Value> MathUtil::AsValueSafely(float value) { + return scoped_ptr<base::Value>(new base::FundamentalValue( + std::min(value, std::numeric_limits<float>::max()))); } } // namespace cc diff --git a/cc/base/math_util.h b/cc/base/math_util.h index 4301add..3af2102 100644 --- a/cc/base/math_util.h +++ b/cc/base/math_util.h @@ -17,12 +17,7 @@ #include "ui/gfx/size.h" #include "ui/gfx/transform.h" -namespace base { -class Value; -namespace debug { -class TracedValue; -} -} +namespace base { class Value; } namespace gfx { class QuadF; @@ -179,35 +174,21 @@ class CC_EXPORT MathUtil { // Conversion to value. static scoped_ptr<base::Value> AsValue(const gfx::Size& s); + static scoped_ptr<base::Value> AsValue(const gfx::SizeF& s); static scoped_ptr<base::Value> AsValue(const gfx::Rect& r); static bool FromValue(const base::Value*, gfx::Rect* out_rect); static scoped_ptr<base::Value> AsValue(const gfx::PointF& q); - - static void AddToTracedValue(const gfx::Size& s, - base::debug::TracedValue* res); - static void AddToTracedValue(const gfx::SizeF& s, - base::debug::TracedValue* res); - static void AddToTracedValue(const gfx::Rect& r, - base::debug::TracedValue* res); - static void AddToTracedValue(const gfx::PointF& q, - base::debug::TracedValue* res); - static void AddToTracedValue(const gfx::Point3F&, - base::debug::TracedValue* res); - static void AddToTracedValue(const gfx::Vector2d& v, - base::debug::TracedValue* res); - static void AddToTracedValue(const gfx::QuadF& q, - base::debug::TracedValue* res); - static void AddToTracedValue(const gfx::RectF& rect, - base::debug::TracedValue* res); - static void AddToTracedValue(const gfx::Transform& transform, - base::debug::TracedValue* res); - static void AddToTracedValue(const gfx::BoxF& box, - base::debug::TracedValue* res); + static scoped_ptr<base::Value> AsValue(const gfx::Point3F&); + static scoped_ptr<base::Value> AsValue(const gfx::Vector2d& v); + static scoped_ptr<base::Value> AsValue(const gfx::QuadF& q); + static scoped_ptr<base::Value> AsValue(const gfx::RectF& rect); + static scoped_ptr<base::Value> AsValue(const gfx::Transform& transform); + static scoped_ptr<base::Value> AsValue(const gfx::BoxF& box); // Returns a base::Value representation of the floating point value. // If the value is inf, returns max double/float representation. - static double AsDoubleSafely(double value); - static float AsFloatSafely(float value); + static scoped_ptr<base::Value> AsValueSafely(double value); + static scoped_ptr<base::Value> AsValueSafely(float value); }; } // namespace cc diff --git a/cc/base/region.cc b/cc/base/region.cc index 79c30ec..906bc6e 100644 --- a/cc/base/region.cc +++ b/cc/base/region.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "cc/base/region.h" -#include "base/debug/trace_event_argument.h" #include "base/values.h" namespace cc { @@ -121,16 +120,6 @@ scoped_ptr<base::Value> Region::AsValue() const { return result.PassAs<base::Value>(); } -void Region::AsValueInto(base::debug::TracedValue* result) const { - for (Iterator it(*this); it.has_rect(); it.next()) { - gfx::Rect rect(it.rect()); - result->AppendInteger(rect.x()); - result->AppendInteger(rect.y()); - result->AppendInteger(rect.width()); - result->AppendInteger(rect.height()); - } -} - Region::Iterator::Iterator() { } diff --git a/cc/base/region.h b/cc/base/region.h index 3ef32db..06fe731 100644 --- a/cc/base/region.h +++ b/cc/base/region.h @@ -16,9 +16,6 @@ namespace base { class Value; -namespace debug { -class TracedValue; -} } namespace cc { @@ -62,7 +59,6 @@ class CC_EXPORT Region { std::string ToString() const; scoped_ptr<base::Value> AsValue() const; - void AsValueInto(base::debug::TracedValue* array) const; class CC_EXPORT Iterator { public: |