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

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

Issue 660093004: Type conversion fixes, gpu/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 6 years, 2 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 | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/query_tracker.cc
diff --git a/gpu/command_buffer/client/query_tracker.cc b/gpu/command_buffer/client/query_tracker.cc
index c12d9753075d022f24a66e3469f147134413fafb..e215c16061bec6e160c1409e38a8d080068f4782 100644
--- a/gpu/command_buffer/client/query_tracker.cc
+++ b/gpu/command_buffer/client/query_tracker.cc
@@ -9,6 +9,7 @@
#include <GLES2/gl2extchromium.h>
#include "base/atomicops.h"
+#include "base/numerics/safe_conversions.h"
#include "gpu/command_buffer/client/gles2_cmd_helper.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/client/mapped_memory.h"
@@ -153,19 +154,18 @@ bool QueryTracker::Query::CheckResultsAvailable(
helper->IsContextLost()) {
switch (target()) {
case GL_COMMANDS_ISSUED_CHROMIUM:
- result_ = std::min(info_.sync->result,
- static_cast<uint64>(0xFFFFFFFFL));
+ result_ = base::saturated_cast<uint32>(info_.sync->result);
break;
case GL_LATENCY_QUERY_CHROMIUM:
// Disabled DCHECK because of http://crbug.com/419236.
//DCHECK(info_.sync->result >= client_begin_time_us_);
- result_ = std::min(info_.sync->result - client_begin_time_us_,
- static_cast<uint64>(0xFFFFFFFFL));
+ result_ = base::saturated_cast<uint32>(
+ info_.sync->result - client_begin_time_us_);
break;
case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM:
case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM:
default:
- result_ = info_.sync->result;
+ result_ = static_cast<uint32>(info_.sync->result);
break;
}
state_ = kComplete;
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698