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

Unified Diff: gpu/command_buffer/client/cmd_buffer_helper.cc

Issue 381473004: Use TimeTicks instead of clock() in gpu::CommandBufferHelper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/client/cmd_buffer_helper.cc
diff --git a/gpu/command_buffer/client/cmd_buffer_helper.cc b/gpu/command_buffer/client/cmd_buffer_helper.cc
index b50527a8dce98fab69c79185b892d9953e90bb4e..1f9b1117805149b7ac48be3a3037a9a7a1f1264f 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper.cc
+++ b/gpu/command_buffer/client/cmd_buffer_helper.cc
@@ -7,6 +7,7 @@
#include "gpu/command_buffer/client/cmd_buffer_helper.h"
#include "base/logging.h"
+#include "base/time/time.h"
hamaji 2014/07/09 06:03:15 I guessed using TimeTicks in this file is fine bec
#include "gpu/command_buffer/common/command_buffer.h"
#include "gpu/command_buffer/common/trace_event.h"
@@ -151,7 +152,7 @@ void CommandBufferHelper::Flush() {
put_ = 0;
if (usable() && last_put_sent_ != put_) {
- last_flush_time_ = clock();
+ last_flush_time_ = base::TimeTicks::Now().ToInternalValue();
last_put_sent_ = put_;
command_buffer_->Flush(put_);
++flush_generation_;
@@ -161,9 +162,11 @@ void CommandBufferHelper::Flush() {
#if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK)
void CommandBufferHelper::PeriodicFlushCheck() {
- clock_t current_time = clock();
- if (current_time - last_flush_time_ > kPeriodicFlushDelay * CLOCKS_PER_SEC)
+ base::TimeTicks current_time = base::TimeTicks::Now();
+ if (current_time - base::TimeTicks::FromInternalValue(last_flush_time_) >
+ base::TimeDelta::FromSecondsD(kPeriodicFlushDelay)) {
vmiura 2014/07/09 20:18:58 Could we change this to FromMicroseconds to avoid
hamaji 2014/07/10 07:00:16 Did you worry about that 1.0/300 will be converted
vmiura 2014/07/10 22:21:25 Ok, it was just a performance question. In some t
Flush();
+ }
}
#endif

Powered by Google App Engine
This is Rietveld 408576698