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

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: address comments 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
« no previous file with comments | « gpu/command_buffer/client/cmd_buffer_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a99201e4b36164ef01ef218d7651f6fe55e851b9 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"
#include "gpu/command_buffer/common/command_buffer.h"
#include "gpu/command_buffer/common/trace_event.h"
@@ -28,7 +29,6 @@ CommandBufferHelper::CommandBufferHelper(CommandBuffer* command_buffer)
usable_(true),
context_lost_(false),
flush_automatically_(true),
- last_flush_time_(0),
flush_generation_(0) {
}
@@ -151,7 +151,7 @@ void CommandBufferHelper::Flush() {
put_ = 0;
if (usable() && last_put_sent_ != put_) {
- last_flush_time_ = clock();
+ last_flush_time_ = base::TimeTicks::Now();
last_put_sent_ = put_;
command_buffer_->Flush(put_);
++flush_generation_;
@@ -161,9 +161,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 - last_flush_time_ >
+ base::TimeDelta::FromMicroseconds(kPeriodicFlushDelayInMicroseconds)) {
Flush();
+ }
}
#endif
« no previous file with comments | « gpu/command_buffer/client/cmd_buffer_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698