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

Side by Side Diff: ui/gl/gpu_timing.cc

Issue 1121463005: Fixit: Split base::TimeTicks --> TimeTicks + ThreadTicks + TraceTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More Windows compile fixes. Created 5 years, 7 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 | « ui/gl/angle_platform_impl.cc ('k') | 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "ui/gl/gpu_timing.h" 5 #include "ui/gl/gpu_timing.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "ui/gl/gl_bindings.h" 8 #include "ui/gl/gl_bindings.h"
9 #include "ui/gl/gl_context.h" 9 #include "ui/gl/gl_context.h"
10 #include "ui/gl/gl_version_info.h" 10 #include "ui/gl/gl_version_info.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 return false; 202 return false;
203 } 203 }
204 204
205 int64 GPUTimingClient::CalculateTimerOffset() { 205 int64 GPUTimingClient::CalculateTimerOffset() {
206 DCHECK(IsTimerOffsetAvailable()); 206 DCHECK(IsTimerOffsetAvailable());
207 if (!offset_valid_) { 207 if (!offset_valid_) {
208 GLint64 gl_now = 0; 208 GLint64 gl_now = 0;
209 glGetInteger64v(GL_TIMESTAMP, &gl_now); 209 glGetInteger64v(GL_TIMESTAMP, &gl_now);
210 int64 now = 210 int64 now =
211 cpu_time_for_testing_.is_null() 211 cpu_time_for_testing_.is_null()
212 ? base::TimeTicks::NowFromSystemTraceTime().ToInternalValue() 212 ? (base::TraceTicks::Now() - base::TraceTicks()).InMicroseconds()
213 : cpu_time_for_testing_.Run(); 213 : cpu_time_for_testing_.Run();
214 offset_ = now - gl_now / base::Time::kNanosecondsPerMicrosecond; 214 offset_ = now - gl_now / base::Time::kNanosecondsPerMicrosecond;
215 offset_valid_ = timer_type_ == GPUTiming::kTimerTypeARB; 215 offset_valid_ = timer_type_ == GPUTiming::kTimerTypeARB;
216 } 216 }
217 return offset_; 217 return offset_;
218 } 218 }
219 219
220 void GPUTimingClient::InvalidateTimerOffset() { 220 void GPUTimingClient::InvalidateTimerOffset() {
221 offset_valid_ = false; 221 offset_valid_ = false;
222 } 222 }
223 223
224 void GPUTimingClient::SetCpuTimeForTesting( 224 void GPUTimingClient::SetCpuTimeForTesting(
225 const base::Callback<int64(void)>& cpu_time) { 225 const base::Callback<int64(void)>& cpu_time) {
226 cpu_time_for_testing_ = cpu_time; 226 cpu_time_for_testing_ = cpu_time;
227 } 227 }
228 228
229 GPUTimingClient::~GPUTimingClient() { 229 GPUTimingClient::~GPUTimingClient() {
230 } 230 }
231 231
232 } // namespace gfx 232 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/angle_platform_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698