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

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

Issue 2741093002: Initialize variable in QueryTimestampBits (Closed)
Patch Set: Created 3 years, 9 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 (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/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "ui/gl/gl_bindings.h" 10 #include "ui/gl/gl_bindings.h"
11 #include "ui/gl/gl_context.h" 11 #include "ui/gl/gl_context.h"
12 #include "ui/gl/gl_version_info.h" 12 #include "ui/gl/gl_version_info.h"
13 13
14 namespace gl { 14 namespace gl {
15 15
16 class TimeElapsedTimerQuery; 16 class TimeElapsedTimerQuery;
17 class TimerQuery; 17 class TimerQuery;
18 18
19 int64_t NanoToMicro(uint64_t nano_seconds) { 19 int64_t NanoToMicro(uint64_t nano_seconds) {
20 const uint64_t up = nano_seconds + base::Time::kNanosecondsPerMicrosecond / 2; 20 const uint64_t up = nano_seconds + base::Time::kNanosecondsPerMicrosecond / 2;
21 return static_cast<int64_t>(up / base::Time::kNanosecondsPerMicrosecond); 21 return static_cast<int64_t>(up / base::Time::kNanosecondsPerMicrosecond);
22 } 22 }
23 23
24 int32_t QueryTimestampBits() { 24 int32_t QueryTimestampBits() {
25 GLint timestamp_bits; 25 GLint timestamp_bits = 0;
26 glGetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS, &timestamp_bits); 26 glGetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS, &timestamp_bits);
27 return static_cast<int32_t>(timestamp_bits); 27 return static_cast<int32_t>(timestamp_bits);
28 } 28 }
29 29
30 class GPUTimingImpl : public GPUTiming { 30 class GPUTimingImpl : public GPUTiming {
31 public: 31 public:
32 GPUTimingImpl(GLContextReal* context); 32 GPUTimingImpl(GLContextReal* context);
33 ~GPUTimingImpl() override; 33 ~GPUTimingImpl() override;
34 34
35 void ForceTimeElapsedQuery() { force_time_elapsed_query_ = true; } 35 void ForceTimeElapsedQuery() { force_time_elapsed_query_ = true; }
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 660
661 void GPUTimingClient::ForceTimeElapsedQuery() { 661 void GPUTimingClient::ForceTimeElapsedQuery() {
662 DCHECK(gpu_timing_); 662 DCHECK(gpu_timing_);
663 gpu_timing_->ForceTimeElapsedQuery(); 663 gpu_timing_->ForceTimeElapsedQuery();
664 } 664 }
665 665
666 GPUTimingClient::~GPUTimingClient() { 666 GPUTimingClient::~GPUTimingClient() {
667 } 667 }
668 668
669 } // namespace gl 669 } // namespace gl
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