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

Side by Side Diff: cc/trees/latency_info_swap_promise_monitor.cc

Issue 1089643002: Make ScrollUpdate LatencyInfo's sequence number less likely to have conflicts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cast to uint64 Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/latency_info_swap_promise_monitor.h" 5 #include "cc/trees/latency_info_swap_promise_monitor.h"
6 6
7 #include "base/threading/platform_thread.h" 7 #include "base/threading/platform_thread.h"
8 #include "cc/output/latency_info_swap_promise.h" 8 #include "cc/output/latency_info_swap_promise.h"
9 #include "cc/trees/layer_tree_host.h" 9 #include "cc/trees/layer_tree_host.h"
10 #include "cc/trees/layer_tree_host_impl.h" 10 #include "cc/trees/layer_tree_host_impl.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 void LatencyInfoSwapPromiseMonitor::OnForwardScrollUpdateToMainThreadOnImpl() { 66 void LatencyInfoSwapPromiseMonitor::OnForwardScrollUpdateToMainThreadOnImpl() {
67 if (AddForwardingScrollUpdateToMainComponent(latency_)) { 67 if (AddForwardingScrollUpdateToMainComponent(latency_)) {
68 int64 new_sequence_number = 0; 68 int64 new_sequence_number = 0;
69 for (ui::LatencyInfo::LatencyMap::const_iterator it = 69 for (ui::LatencyInfo::LatencyMap::const_iterator it =
70 latency_->latency_components.begin(); 70 latency_->latency_components.begin();
71 it != latency_->latency_components.end(); ++it) { 71 it != latency_->latency_components.end(); ++it) {
72 if (it->first.first == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT) { 72 if (it->first.first == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT) {
73 new_sequence_number = 73 new_sequence_number =
74 (static_cast<int64>(base::PlatformThread::CurrentId()) << 32) | 74 ((static_cast<int64>(base::PlatformThread::CurrentId()) << 32) ^
75 (reinterpret_cast<uint64>(this) << 32)) |
75 (it->second.sequence_number & 0xffffffff); 76 (it->second.sequence_number & 0xffffffff);
76 DCHECK(new_sequence_number != it->second.sequence_number); 77 if (new_sequence_number == it->second.sequence_number)
78 return;
77 break; 79 break;
78 } 80 }
79 } 81 }
80 if (!new_sequence_number) 82 if (!new_sequence_number)
81 return; 83 return;
82 ui::LatencyInfo new_latency; 84 ui::LatencyInfo new_latency;
83 new_latency.AddLatencyNumberWithTraceName( 85 new_latency.AddLatencyNumberWithTraceName(
84 ui::INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT, 0, 86 ui::INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT, 0,
85 new_sequence_number, "ScrollUpdate"); 87 new_sequence_number, "ScrollUpdate");
86 new_latency.CopyLatencyFrom( 88 new_latency.CopyLatencyFrom(
87 *latency_, 89 *latency_,
88 ui::INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT); 90 ui::INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT);
89 scoped_ptr<SwapPromise> swap_promise( 91 scoped_ptr<SwapPromise> swap_promise(
90 new LatencyInfoSwapPromise(new_latency)); 92 new LatencyInfoSwapPromise(new_latency));
91 layer_tree_host_impl_->QueueSwapPromiseForMainThreadScrollUpdate( 93 layer_tree_host_impl_->QueueSwapPromiseForMainThreadScrollUpdate(
92 swap_promise.Pass()); 94 swap_promise.Pass());
93 } 95 }
94 } 96 }
95 97
96 } // namespace cc 98 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698