| Index: cc/output/latency_info_swap_promise.cc
|
| diff --git a/cc/output/latency_info_swap_promise.cc b/cc/output/latency_info_swap_promise.cc
|
| index 3b267454076e574b01a510403395d2f3b08aec3c..ee15e10856e9b6cda4f2921bec15cb98b1e8fce3 100644
|
| --- a/cc/output/latency_info_swap_promise.cc
|
| +++ b/cc/output/latency_info_swap_promise.cc
|
| @@ -4,8 +4,12 @@
|
|
|
| #include "cc/output/latency_info_swap_promise.h"
|
|
|
| +#include <iostream>
|
| +
|
| #include "base/logging.h"
|
| +#include "base/threading/platform_thread.h"
|
| #include "base/trace_event/trace_event.h"
|
| +#include "content/renderer/greenweb_latency_tracking.h"
|
|
|
| namespace {
|
| ui::LatencyComponentType DidNotSwapReasonToLatencyComponentType(
|
| @@ -57,6 +61,34 @@ void LatencyInfoSwapPromise::OnCommit() {
|
| TRACE_ID_DONT_MANGLE(TraceId()),
|
| TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT,
|
| "step", "HandleInputEventMainCommit");
|
| +
|
| + int64 trace_id = TraceId();
|
| + if (InputLatencyMap.find(trace_id) != InputLatencyMap.end()) {
|
| + int64 dom_node = InputLatencyMap[trace_id].dom_node;
|
| + if (dom_node) {
|
| + base::TimeTicks layout_end_ts = base::TimeTicks::Now();
|
| + base::TimeDelta latency = layout_end_ts - InputLatencyMap[trace_id].callback_start;
|
| + InputLatencyMap[trace_id].latency = latency.InMilliseconds();
|
| +
|
| + DOMLatencyMap[dom_node].latency = InputLatencyMap[trace_id].latency;
|
| +
|
| + content::process_freq_stat(&(InputLatencyMap[trace_id].FreqStatStartMap), &(DOMLatencyMap[dom_node].FreqStatMap));
|
| +
|
| +#ifdef EBS_DEBUG_TRACE_EVENT
|
| + TRACE_EVENT2("devtools.timeline", "GreenWeb:StyleLayout",
|
| + "trace_id", TraceId(),
|
| + "latency", DOMLatencyMap[dom_node].latency);
|
| + std::cout << "Thd: " << base::PlatformThread::CurrentId() <<
|
| + " (" << base::PlatformThread::GetName() << ")" <<
|
| + " StyleLayout "
|
| + " trace_id " << trace_id <<
|
| + " dom_node " << dom_node <<
|
| + " latency " << DOMLatencyMap[dom_node].latency << std::endl;
|
| +#endif
|
| + }
|
| + // Erase this trace_id because it will not used in the future
|
| + InputLatencyMap.erase(trace_id);
|
| + }
|
| }
|
|
|
| } // namespace cc
|
|
|