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

Unified Diff: base/test/trace_event_analyzer.h

Issue 7982007: add "did it run on GPU" check to frame_rate_tests.cc using AutomationProxy tracing feature (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added templated TraceEvent::GetArgAsIntType Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: base/test/trace_event_analyzer.h
diff --git a/base/test/trace_event_analyzer.h b/base/test/trace_event_analyzer.h
index 4bf48845eb1dcd027fc0843b780a955b2b510dd2..86982ca2b02a791d206498276faa8b83a5cf4b68 100644
--- a/base/test/trace_event_analyzer.h
+++ b/base/test/trace_event_analyzer.h
@@ -131,6 +131,23 @@ struct TraceEvent {
// Return the argument value if it exists and it is a number.
bool GetArgAsNumber(const std::string& name, double* arg) const;
+ // If you need an argument as a certain integer type, you can use this method
+ // to get it and cast it to your type.
nduca 2011/11/01 19:17:49 Copy the way base-value works? GetArgAsBool/etc. T
jbates 2011/11/03 00:51:07 Done. Actually since queries already verify the ex
+ // For example:
+ // MyEnum my_enum;
+ // bool found = event.GetArgAsIntType("the_enum", &my_enum);
+ template<class INTEGER_TYPE>
+ bool GetArgAsIntType(const std::string& name, INTEGER_TYPE* arg) const {
+ double arg_double;
+ if (GetArgAsNumber(name, &arg_double)) {
+ // Certain compilers don't allow casting directly from double to enums.
+ int64 arg_int = static_cast<int64>(arg_double);
+ *arg = static_cast<INTEGER_TYPE>(arg_int);
+ return true;
+ }
+ return false;
+ }
+
// Process ID and Thread ID.
ProcessThreadID thread;
« no previous file with comments | « no previous file | chrome/test/perf/frame_rate/frame_rate_tests.cc » ('j') | chrome/test/perf/frame_rate/frame_rate_tests.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698