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

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

Issue 184223003: gpu: Use explicit atomics instead of assuming that 32bit read/writes are atomic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-upload Created 6 years, 10 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/query_tracker.cc
diff --git a/gpu/command_buffer/client/query_tracker.cc b/gpu/command_buffer/client/query_tracker.cc
index 285560590b34a403ba5e2abb763d8c9d340ffc8d..2c5052537ff70a5c0875aee3e8ea81a7140e2eaf 100644
--- a/gpu/command_buffer/client/query_tracker.cc
+++ b/gpu/command_buffer/client/query_tracker.cc
@@ -8,6 +8,7 @@
#include <GLES2/gl2ext.h>
#include <GLES2/gl2extchromium.h>
+#include "base/atomicops.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"
@@ -146,11 +147,9 @@ void QueryTracker::Query::End(GLES2Implementation* gl) {
bool QueryTracker::Query::CheckResultsAvailable(
CommandBufferHelper* helper) {
if (Pending()) {
- if (info_.sync->process_count == submit_count_ ||
+ if (base::subtle::Acquire_Load(
+ &info_.sync->process_count) == submit_count_ ||
helper->IsContextLost()) {
- // Need a MemoryBarrier here so that sync->result read after
- // sync->process_count.
- base::subtle::MemoryBarrier();
switch (target()) {
case GL_COMMANDS_ISSUED_CHROMIUM:
result_ = std::min(info_.sync->result,
@@ -249,7 +248,8 @@ void QueryTracker::FreeCompletedQueries() {
while (it != removed_queries_.end()) {
Query* query = *it;
if (query->Pending() &&
- query->info_.sync->process_count != query->submit_count()) {
+ base::subtle::Acquire_Load(
+ &query->info_.sync->process_count) != query->submit_count()) {
++it;
continue;
}

Powered by Google App Engine
This is Rietveld 408576698