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

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

Issue 1122153002: Fixit: Fork base::TimeTicks --> TimeTicks + ThreadTicks + TraceTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FIXIT_timeclasses_1of2
Patch Set: REBASE after it passed CQ but did not commit to tree Created 5 years, 6 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 return disjoint_counter_; 44 return disjoint_counter_;
45 } 45 }
46 46
47 int64 GPUTiming::CalculateTimerOffset(base::Callback<int64(void)> cpu_time) { 47 int64 GPUTiming::CalculateTimerOffset(base::Callback<int64(void)> cpu_time) {
48 if (!offset_valid_) { 48 if (!offset_valid_) {
49 if (timer_type_ == kTimerTypeDisjoint || timer_type_ == kTimerTypeARB) { 49 if (timer_type_ == kTimerTypeDisjoint || timer_type_ == kTimerTypeARB) {
50 GLint64 gl_now = 0; 50 GLint64 gl_now = 0;
51 glGetInteger64v(GL_TIMESTAMP, &gl_now); 51 glGetInteger64v(GL_TIMESTAMP, &gl_now);
52 int64 now = 52 int64 now =
53 cpu_time.is_null() 53 cpu_time.is_null()
54 ? base::TimeTicks::NowFromSystemTraceTime().ToInternalValue() 54 ? (base::TraceTicks::Now() - base::TraceTicks()).InMicroseconds()
55 : cpu_time.Run(); 55 : cpu_time.Run();
56 offset_ = now - gl_now / base::Time::kNanosecondsPerMicrosecond; 56 offset_ = now - gl_now / base::Time::kNanosecondsPerMicrosecond;
57 offset_valid_ = (timer_type_ == kTimerTypeARB); 57 offset_valid_ = (timer_type_ == kTimerTypeARB);
58 } else { 58 } else {
59 // TODO(dyen): figure out how to calculate the offset for EXT_Timer_Query. 59 // TODO(dyen): figure out how to calculate the offset for EXT_Timer_Query.
60 offset_ = 0; 60 offset_ = 0;
61 offset_valid_ = true; 61 offset_valid_ = true;
62 } 62 }
63 } 63 }
64 return offset_; 64 return offset_;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 void GPUTimingClient::SetCpuTimeForTesting( 249 void GPUTimingClient::SetCpuTimeForTesting(
250 const base::Callback<int64(void)>& cpu_time) { 250 const base::Callback<int64(void)>& cpu_time) {
251 cpu_time_for_testing_ = cpu_time; 251 cpu_time_for_testing_ = cpu_time;
252 } 252 }
253 253
254 GPUTimingClient::~GPUTimingClient() { 254 GPUTimingClient::~GPUTimingClient() {
255 } 255 }
256 256
257 } // namespace gfx 257 } // 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