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

Side by Side Diff: content/browser/renderer_host/p2p/socket_host.cc

Issue 864943002: Replaces instances of the deprecated TimeTicks::HighResNow() with TimeTicks::Now(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More changes based on review comments. Created 5 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/p2p/socket_host.h" 5 #include "content/browser/renderer_host/p2p/socket_host.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/sys_byteorder.h" 8 #include "base/sys_byteorder.h"
9 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" 9 #include "content/browser/renderer_host/p2p/socket_host_tcp.h"
10 #include "content/browser/renderer_host/p2p/socket_host_tcp_server.h" 10 #include "content/browser/renderer_host/p2p/socket_host_tcp_server.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // 0 1 2 3 134 // 0 1 2 3
135 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 135 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
136 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 136 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
137 // | ID | len=2 | absolute send time | 137 // | ID | len=2 | absolute send time |
138 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 138 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
139 if (length != kAbsSendTimeExtensionLength) { 139 if (length != kAbsSendTimeExtensionLength) {
140 NOTREACHED(); 140 NOTREACHED();
141 return; 141 return;
142 } 142 }
143 143
144 // Now() has resolution ~1-15ms, using HighResNow(). But it is warned not to 144 // Now() has resolution ~1-15ms
145 // use it unless necessary, as it is expensive than Now().
146 uint32 now_second = abs_send_time; 145 uint32 now_second = abs_send_time;
147 if (!now_second) { 146 if (!now_second) {
148 uint64 now_us = 147 uint64 now_us =
149 (base::TimeTicks::HighResNow() - base::TimeTicks()).InMicroseconds(); 148 (base::TimeTicks::Now() - base::TimeTicks()).InMicroseconds();
150 // Convert second to 24-bit unsigned with 18 bit fractional part 149 // Convert second to 24-bit unsigned with 18 bit fractional part
151 now_second = 150 now_second =
152 ((now_us << 18) / base::Time::kMicrosecondsPerSecond) & 0x00FFFFFF; 151 ((now_us << 18) / base::Time::kMicrosecondsPerSecond) & 0x00FFFFFF;
153 } 152 }
154 // TODO(mallinath) - Add SetBE24 to byteorder.h in libjingle. 153 // TODO(mallinath) - Add SetBE24 to byteorder.h in libjingle.
155 extension_data[0] = static_cast<uint8>(now_second >> 16); 154 extension_data[0] = static_cast<uint8>(now_second >> 16);
156 extension_data[1] = static_cast<uint8>(now_second >> 8); 155 extension_data[1] = static_cast<uint8>(now_second >> 8);
157 extension_data[2] = static_cast<uint8>(now_second); 156 extension_data[2] = static_cast<uint8>(now_second);
158 } 157 }
159 158
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 send_bytes_delayed_max_ = send_bytes_delayed_cur_; 684 send_bytes_delayed_max_ = send_bytes_delayed_cur_;
686 } 685 }
687 } 686 }
688 687
689 void P2PSocketHost::DecrementDelayedBytes(uint32 size) { 688 void P2PSocketHost::DecrementDelayedBytes(uint32 size) {
690 send_bytes_delayed_cur_ -= size; 689 send_bytes_delayed_cur_ -= size;
691 DCHECK_GE(send_bytes_delayed_cur_, 0); 690 DCHECK_GE(send_bytes_delayed_cur_, 0);
692 } 691 }
693 692
694 } // namespace content 693 } // namespace content
OLDNEW
« no previous file with comments | « chrome/renderer/benchmarking_extension.cc ('k') | content/browser/renderer_host/render_widget_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698