summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-22 10:58:46 +0000
committermiletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-22 10:58:46 +0000
commit68c433d4a41cf305a59233cfe8b98b1175ff8ecd (patch)
tree4695751a144271097943482d59f6a1f2421bd253
parent3ad2fccb20c62103110c70aded5e019a84c4aeb5 (diff)
downloadchromium_src-68c433d4a41cf305a59233cfe8b98b1175ff8ecd.zip
chromium_src-68c433d4a41cf305a59233cfe8b98b1175ff8ecd.tar.gz
chromium_src-68c433d4a41cf305a59233cfe8b98b1175ff8ecd.tar.bz2
Remove LatencyInfo::MergeWith()
Now that we have removed LatencyInfo merging throughout chrome, we can remove the function LatencyInfo::MergeWith(). Also remove |dump_to_trace| from LatencyInfo::AddLatencyNumberWithTimestamp(). Previously |dump_to_trace| exists because when we merge two LatencyInfo by calling A.MergeWith(B), we would add B's begin/terminal component into A, which would accidentally cause TRACE_EVENT_ASYNC_BEGIN/END to be triggered on A. So that we have |dump_to_trace| to guard against this. Now that we removed MergeWith, we can also remove |dump_to_trace|. BUG=246034 TEST=code still compiles. Review URL: https://codereview.chromium.org/141473002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246288 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/renderer_host/render_widget_host_impl.cc3
-rw-r--r--content/browser/renderer_host/render_widget_host_view_android.cc3
-rw-r--r--ui/events/event.cc3
-rw-r--r--ui/events/latency_info.cc25
-rw-r--r--ui/events/latency_info.h7
-rw-r--r--ui/events/latency_info_unittest.cc80
6 files changed, 14 insertions, 107 deletions
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 9de773b..c58abf0 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -1020,8 +1020,7 @@ void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo(
GetLatencyComponentId(),
original_component.sequence_number,
original_component.event_time,
- original_component.event_count,
- true);
+ original_component.event_count);
}
}
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index c1dbae2..ba6522e 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -122,8 +122,7 @@ ui::LatencyInfo CreateLatencyInfo(const blink::WebInputEvent event) {
0,
0,
base::TimeTicks() + base::TimeDelta::FromMicroseconds(time_micros),
- 1,
- false);
+ 1);
}
return latency_info;
}
diff --git a/ui/events/event.cc b/ui/events/event.cc
index 936139f..f99fe2ce 100644
--- a/ui/events/event.cc
+++ b/ui/events/event.cc
@@ -445,8 +445,7 @@ TouchEvent::TouchEvent(const base::NativeEvent& native_event)
0,
0,
base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()),
- 1,
- true);
+ 1);
#if defined(USE_X11)
XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(native_event->xcookie.data);
diff --git a/ui/events/latency_info.cc b/ui/events/latency_info.cc
index dd5e11c..5c9f8c8 100644
--- a/ui/events/latency_info.cc
+++ b/ui/events/latency_info.cc
@@ -132,19 +132,6 @@ bool LatencyInfo::Verify(const std::vector<LatencyInfo>& latency_info,
return true;
}
-void LatencyInfo::MergeWith(const LatencyInfo& other) {
- for (LatencyMap::const_iterator it = other.latency_components.begin();
- it != other.latency_components.end();
- ++it) {
- AddLatencyNumberWithTimestamp(it->first.first,
- it->first.second,
- it->second.sequence_number,
- it->second.event_time,
- it->second.event_count,
- false);
- }
-}
-
void LatencyInfo::AddNewLatencyFrom(const LatencyInfo& other) {
for (LatencyMap::const_iterator it = other.latency_components.begin();
it != other.latency_components.end();
@@ -154,8 +141,7 @@ void LatencyInfo::AddNewLatencyFrom(const LatencyInfo& other) {
it->first.second,
it->second.sequence_number,
it->second.event_time,
- it->second.event_count,
- false);
+ it->second.event_count);
}
}
}
@@ -164,16 +150,15 @@ void LatencyInfo::AddLatencyNumber(LatencyComponentType component,
int64 id,
int64 component_sequence_number) {
AddLatencyNumberWithTimestamp(component, id, component_sequence_number,
- base::TimeTicks::HighResNow(), 1, true);
+ base::TimeTicks::HighResNow(), 1);
}
void LatencyInfo::AddLatencyNumberWithTimestamp(LatencyComponentType component,
int64 id,
int64 component_sequence_number,
base::TimeTicks time,
- uint32 event_count,
- bool dump_to_trace) {
- if (dump_to_trace && IsBeginComponent(component)) {
+ uint32 event_count) {
+ if (IsBeginComponent(component)) {
// Should only ever add begin component once.
CHECK_EQ(-1, trace_id);
trace_id = component_sequence_number;
@@ -201,7 +186,7 @@ void LatencyInfo::AddLatencyNumberWithTimestamp(LatencyComponentType component,
}
}
- if (dump_to_trace && IsTerminalComponent(component) && trace_id != -1) {
+ if (IsTerminalComponent(component) && trace_id != -1) {
// Should only ever add terminal component once.
CHECK(!terminated);
terminated = true;
diff --git a/ui/events/latency_info.h b/ui/events/latency_info.h
index 96f76fb..86ce7ec 100644
--- a/ui/events/latency_info.h
+++ b/ui/events/latency_info.h
@@ -98,9 +98,6 @@ struct EVENTS_BASE_EXPORT LatencyInfo {
static bool Verify(const std::vector<LatencyInfo>& latency_info,
const char* referring_msg);
- // Merges the contents of another LatencyInfo into this one.
- void MergeWith(const LatencyInfo& other);
-
// Add LatencyComponents that are in |other| but not in |this|.
void AddNewLatencyFrom(const LatencyInfo& other);
@@ -112,13 +109,11 @@ struct EVENTS_BASE_EXPORT LatencyInfo {
// Modifies the current sequence number and adds a certain number of events
// for a specific component.
- // TODO(miletus): Remove the |dump_to_trace| once we remove MergeWith().
void AddLatencyNumberWithTimestamp(LatencyComponentType component,
int64 id,
int64 component_sequence_number,
base::TimeTicks time,
- uint32 event_count,
- bool dump_to_trace);
+ uint32 event_count);
// Returns true if the a component with |type| and |id| is found in
// the latency_components and the component is stored to |output| if
diff --git a/ui/events/latency_info_unittest.cc b/ui/events/latency_info_unittest.cc
index ec39a0d..2f9ad05 100644
--- a/ui/events/latency_info_unittest.cc
+++ b/ui/events/latency_info_unittest.cc
@@ -14,14 +14,12 @@ TEST(LatencyInfoTest, AddTwoSeparateEvent) {
0,
1,
base::TimeTicks::FromInternalValue(100),
- 1,
- true);
+ 1);
info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
1,
5,
base::TimeTicks::FromInternalValue(1000),
- 2,
- true);
+ 2);
EXPECT_EQ(info.latency_components.size(), 2u);
LatencyInfo::LatencyComponent component;
@@ -47,14 +45,12 @@ TEST(LatencyInfoTest, AddTwoSameEvent) {
0,
30,
base::TimeTicks::FromInternalValue(100),
- 2,
- true);
+ 2);
info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
0,
13,
base::TimeTicks::FromInternalValue(200),
- 3,
- true);
+ 3);
EXPECT_EQ(info.latency_components.size(), 1u);
LatencyInfo::LatencyComponent component;
@@ -69,79 +65,13 @@ TEST(LatencyInfoTest, AddTwoSameEvent) {
EXPECT_EQ(component.event_time.ToInternalValue(), (100 * 2 + 200 * 3) / 5);
}
-TEST(LatencyInfoTest, MergeTwoSeparateEvent) {
- LatencyInfo info1;
- LatencyInfo info2;
- info1.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
- 0,
- 1,
- base::TimeTicks::FromInternalValue(100),
- 1,
- true);
- info2.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
- 1,
- 5,
- base::TimeTicks::FromInternalValue(1000),
- 2,
- true);
- info1.MergeWith(info2);
-
- EXPECT_EQ(info1.latency_components.size(), 2u);
- LatencyInfo::LatencyComponent component;
- EXPECT_FALSE(
- info1.FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &component));
- EXPECT_FALSE(info1.FindLatency(
- INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 1, &component));
- EXPECT_TRUE(info1.FindLatency(
- INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, &component));
- EXPECT_EQ(component.sequence_number, 1);
- EXPECT_EQ(component.event_count, 1u);
- EXPECT_EQ(component.event_time.ToInternalValue(), 100);
- EXPECT_TRUE(
- info1.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1, &component));
- EXPECT_EQ(component.sequence_number, 5);
- EXPECT_EQ(component.event_count, 2u);
- EXPECT_EQ(component.event_time.ToInternalValue(), 1000);
-}
-
-TEST(LatencyInfoTest, MergeTwoSameEvent) {
- LatencyInfo info1;
- LatencyInfo info2;
- info1.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
- 0,
- 30,
- base::TimeTicks::FromInternalValue(100),
- 2,
- true);
- info2.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
- 0,
- 13,
- base::TimeTicks::FromInternalValue(200),
- 3,
- true);
- info1.MergeWith(info2);
-
- EXPECT_EQ(info1.latency_components.size(), 1u);
- LatencyInfo::LatencyComponent component;
- EXPECT_FALSE(
- info1.FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &component));
- EXPECT_FALSE(
- info1.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1, &component));
- EXPECT_TRUE(
- info1.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, &component));
- EXPECT_EQ(component.sequence_number, 30);
- EXPECT_EQ(component.event_count, 5u);
- EXPECT_EQ(component.event_time.ToInternalValue(), (100 * 2 + 200 * 3) / 5);
-}
-
TEST(LatencyInfoTest, ClearEvents) {
LatencyInfo info;
info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
0,
30,
base::TimeTicks::FromInternalValue(100),
- 2,
- true);
+ 2);
EXPECT_EQ(info.latency_components.size(), 1u);
info.Clear();