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

Side by Side Diff: gpu/command_buffer/service/query_manager.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 "gpu/command_buffer/service/query_manager.h" 5 #include "gpu/command_buffer/service/query_manager.h"
6 6
7 #include "base/atomicops.h" 7 #include "base/atomicops.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 private: 209 private:
210 base::TimeTicks begin_time_; 210 base::TimeTicks begin_time_;
211 }; 211 };
212 212
213 CommandsIssuedQuery::CommandsIssuedQuery( 213 CommandsIssuedQuery::CommandsIssuedQuery(
214 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset) 214 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset)
215 : Query(manager, target, shm_id, shm_offset) { 215 : Query(manager, target, shm_id, shm_offset) {
216 } 216 }
217 217
218 bool CommandsIssuedQuery::Begin() { 218 bool CommandsIssuedQuery::Begin() {
219 begin_time_ = base::TimeTicks::HighResNow(); 219 begin_time_ = base::TimeTicks::Now();
220 return true; 220 return true;
221 } 221 }
222 222
223 bool CommandsIssuedQuery::End(base::subtle::Atomic32 submit_count) { 223 bool CommandsIssuedQuery::End(base::subtle::Atomic32 submit_count) {
224 base::TimeDelta elapsed = base::TimeTicks::HighResNow() - begin_time_; 224 base::TimeDelta elapsed = base::TimeTicks::Now() - begin_time_;
225 MarkAsPending(submit_count); 225 MarkAsPending(submit_count);
226 return MarkAsCompleted(elapsed.InMicroseconds()); 226 return MarkAsCompleted(elapsed.InMicroseconds());
227 } 227 }
228 228
229 bool CommandsIssuedQuery::Process(bool did_finish) { 229 bool CommandsIssuedQuery::Process(bool did_finish) {
230 NOTREACHED(); 230 NOTREACHED();
231 return true; 231 return true;
232 } 232 }
233 233
234 void CommandsIssuedQuery::Destroy(bool /* have_context */) { 234 void CommandsIssuedQuery::Destroy(bool /* have_context */) {
(...skipping 22 matching lines...) Expand all
257 CommandLatencyQuery::CommandLatencyQuery( 257 CommandLatencyQuery::CommandLatencyQuery(
258 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset) 258 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset)
259 : Query(manager, target, shm_id, shm_offset) { 259 : Query(manager, target, shm_id, shm_offset) {
260 } 260 }
261 261
262 bool CommandLatencyQuery::Begin() { 262 bool CommandLatencyQuery::Begin() {
263 return true; 263 return true;
264 } 264 }
265 265
266 bool CommandLatencyQuery::End(base::subtle::Atomic32 submit_count) { 266 bool CommandLatencyQuery::End(base::subtle::Atomic32 submit_count) {
267 base::TimeDelta now = base::TimeTicks::HighResNow() - base::TimeTicks(); 267 base::TimeDelta now = base::TimeTicks::Now() - base::TimeTicks();
268 MarkAsPending(submit_count); 268 MarkAsPending(submit_count);
269 return MarkAsCompleted(now.InMicroseconds()); 269 return MarkAsCompleted(now.InMicroseconds());
270 } 270 }
271 271
272 bool CommandLatencyQuery::Process(bool did_finish) { 272 bool CommandLatencyQuery::Process(bool did_finish) {
273 NOTREACHED(); 273 NOTREACHED();
274 return true; 274 return true;
275 } 275 }
276 276
277 void CommandLatencyQuery::Destroy(bool /* have_context */) { 277 void CommandLatencyQuery::Destroy(bool /* have_context */) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 base::TimeTicks begin_time_; 411 base::TimeTicks begin_time_;
412 }; 412 };
413 413
414 CommandsCompletedQuery::CommandsCompletedQuery(QueryManager* manager, 414 CommandsCompletedQuery::CommandsCompletedQuery(QueryManager* manager,
415 GLenum target, 415 GLenum target,
416 int32 shm_id, 416 int32 shm_id,
417 uint32 shm_offset) 417 uint32 shm_offset)
418 : Query(manager, target, shm_id, shm_offset) {} 418 : Query(manager, target, shm_id, shm_offset) {}
419 419
420 bool CommandsCompletedQuery::Begin() { 420 bool CommandsCompletedQuery::Begin() {
421 begin_time_ = base::TimeTicks::HighResNow(); 421 begin_time_ = base::TimeTicks::Now();
422 return true; 422 return true;
423 } 423 }
424 424
425 bool CommandsCompletedQuery::End(base::subtle::Atomic32 submit_count) { 425 bool CommandsCompletedQuery::End(base::subtle::Atomic32 submit_count) {
426 fence_.reset(gfx::GLFence::Create()); 426 fence_.reset(gfx::GLFence::Create());
427 DCHECK(fence_); 427 DCHECK(fence_);
428 return AddToPendingQueue(submit_count); 428 return AddToPendingQueue(submit_count);
429 } 429 }
430 430
431 bool CommandsCompletedQuery::Process(bool did_finish) { 431 bool CommandsCompletedQuery::Process(bool did_finish) {
432 // Note: |did_finish| guarantees that the GPU has passed the fence but 432 // Note: |did_finish| guarantees that the GPU has passed the fence but
433 // we cannot assume that GLFence::HasCompleted() will return true yet as 433 // we cannot assume that GLFence::HasCompleted() will return true yet as
434 // that's not guaranteed by all GLFence implementations. 434 // that's not guaranteed by all GLFence implementations.
435 if (!did_finish && fence_ && !fence_->HasCompleted()) 435 if (!did_finish && fence_ && !fence_->HasCompleted())
436 return true; 436 return true;
437 437
438 base::TimeDelta elapsed = base::TimeTicks::HighResNow() - begin_time_; 438 base::TimeDelta elapsed = base::TimeTicks::Now() - begin_time_;
439 return MarkAsCompleted(elapsed.InMicroseconds()); 439 return MarkAsCompleted(elapsed.InMicroseconds());
440 } 440 }
441 441
442 void CommandsCompletedQuery::Destroy(bool have_context) { 442 void CommandsCompletedQuery::Destroy(bool have_context) {
443 if (have_context && !IsDeleted()) { 443 if (have_context && !IsDeleted()) {
444 fence_.reset(); 444 fence_.reset();
445 MarkAsDeleted(); 445 MarkAsDeleted();
446 } 446 }
447 } 447 }
448 448
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 bool QueryManager::EndQuery(Query* query, base::subtle::Atomic32 submit_count) { 747 bool QueryManager::EndQuery(Query* query, base::subtle::Atomic32 submit_count) {
748 DCHECK(query); 748 DCHECK(query);
749 if (!RemovePendingQuery(query)) { 749 if (!RemovePendingQuery(query)) {
750 return false; 750 return false;
751 } 751 }
752 return query->End(submit_count); 752 return query->End(submit_count);
753 } 753 }
754 754
755 } // namespace gles2 755 } // namespace gles2
756 } // namespace gpu 756 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/program_manager.cc ('k') | gpu/command_buffer/service/texture_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698