summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-28 02:08:28 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-28 02:08:28 +0000
commit0cfb9abdd8d87cf87878d41f4ff9c64182dbe55c (patch)
tree923fb54e55b3d839bbd55ba83222347b99aca718 /gpu
parent7aa8c0be524d170d5635efd03ba4662e60477b70 (diff)
downloadchromium_src-0cfb9abdd8d87cf87878d41f4ff9c64182dbe55c.zip
chromium_src-0cfb9abdd8d87cf87878d41f4ff9c64182dbe55c.tar.gz
chromium_src-0cfb9abdd8d87cf87878d41f4ff9c64182dbe55c.tar.bz2
Move gpu hash_tables and atomicops stuff
TEST=none BUG=none Review URL: http://codereview.chromium.org/9836098 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129341 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/client/atomicops.cc22
-rw-r--r--gpu/command_buffer/client/atomicops.h14
-rw-r--r--gpu/command_buffer/client/hash_tables.h24
-rw-r--r--gpu/command_buffer/client/query_tracker.cc10
-rw-r--r--gpu/command_buffer/client/query_tracker.h12
-rw-r--r--gpu/command_buffer_client.gypi3
6 files changed, 67 insertions, 18 deletions
diff --git a/gpu/command_buffer/client/atomicops.cc b/gpu/command_buffer/client/atomicops.cc
new file mode 100644
index 0000000..142ab9c
--- /dev/null
+++ b/gpu/command_buffer/client/atomicops.cc
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "../client/atomicops.h"
+
+#if !defined(__native_client__)
+#include "base/atomicops.h"
+#endif
+
+namespace gpu {
+
+void MemoryBarrier() {
+#if defined(__native_client__)
+ __sync_synchronize();
+#else
+ base::subtle::MemoryBarrier();
+#endif
+}
+
+} // namespace gpu
+
diff --git a/gpu/command_buffer/client/atomicops.h b/gpu/command_buffer/client/atomicops.h
new file mode 100644
index 0000000..ffd274c
--- /dev/null
+++ b/gpu/command_buffer/client/atomicops.h
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef GPU_COMMAND_BUFFER_CLIENT_ATOMICOPS_H_
+#define GPU_COMMAND_BUFFER_CLIENT_ATOMICOPS_H_
+
+namespace gpu {
+
+void MemoryBarrier();
+
+} // namespace gpu
+
+#endif // GPU_COMMAND_BUFFER_CLIENT_ATOMICOPS_H_
diff --git a/gpu/command_buffer/client/hash_tables.h b/gpu/command_buffer/client/hash_tables.h
new file mode 100644
index 0000000..33872bd
--- /dev/null
+++ b/gpu/command_buffer/client/hash_tables.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef GPU_COMMAND_BUFFER_CLIENT_HASH_TABLES_H_
+#define GPU_COMMAND_BUFFER_CLIENT_HASH_TABLES_H_
+
+#if defined(__native_client__)
+#include <tr1/unordered_map>
+namespace gpu {
+template <typename key, typename value>
+struct hash_map : public std::tr1::unordered_map<key, value> {
+};
+}
+#else
+#include "base/hash_tables.h"
+namespace gpu {
+template <typename key, typename value>
+struct hash_map : public base::hash_map<key, value> {
+};
+}
+#endif
+
+#endif // GPU_COMMAND_BUFFER_CLIENT_HASH_TABLES_H_
diff --git a/gpu/command_buffer/client/query_tracker.cc b/gpu/command_buffer/client/query_tracker.cc
index 54e8d85..5d08f2e 100644
--- a/gpu/command_buffer/client/query_tracker.cc
+++ b/gpu/command_buffer/client/query_tracker.cc
@@ -4,9 +4,7 @@
#include "../client/query_tracker.h"
-#if !defined(__native_client__)
- #include "base/atomicops.h"
-#endif
+#include "../client/atomicops.h"
#include "../client/cmd_buffer_helper.h"
#include "../client/mapped_memory.h"
@@ -59,11 +57,7 @@ bool QueryTracker::Query::CheckResultsAvailable(
if (info_.sync->process_count == submit_count_) {
// Need a MemoryBarrier here so that sync->result read after
// sync->process_count.
- #if defined(__native_client__)
- __sync_synchronize();
- #else
- base::subtle::MemoryBarrier();
- #endif
+ gpu::MemoryBarrier();
result_ = info_.sync->result;
state_ = kComplete;
} else {
diff --git a/gpu/command_buffer/client/query_tracker.h b/gpu/command_buffer/client/query_tracker.h
index 8bd4059..9746497 100644
--- a/gpu/command_buffer/client/query_tracker.h
+++ b/gpu/command_buffer/client/query_tracker.h
@@ -9,11 +9,7 @@
#include <queue>
#include "../../gpu_export.h"
-#if defined(__native_client__)
- #include <tr1/unordered_map>
-#else
- #include "base/hash_tables.h"
-#endif
+#include "../client/hash_tables.h"
#include "../common/gles2_cmd_format.h"
namespace gpu {
@@ -152,11 +148,7 @@ class GPU_EXPORT QueryTracker {
void RemoveQuery(GLuint id);
private:
- #if defined(__native_client__)
- typedef std::tr1::unordered_map<GLuint, Query*> QueryMap;
- #else
- typedef base::hash_map<GLuint, Query*> QueryMap;
- #endif
+ typedef gpu::hash_map<GLuint, Query*> QueryMap;
QueryMap queries_;
QuerySyncManager query_sync_manager_;
diff --git a/gpu/command_buffer_client.gypi b/gpu/command_buffer_client.gypi
index f49d780..f007f97 100644
--- a/gpu/command_buffer_client.gypi
+++ b/gpu/command_buffer_client.gypi
@@ -14,10 +14,13 @@
],
},
'sources': [
+ 'command_buffer/client/atomicops.cc',
+ 'command_buffer/client/atomicops.h',
'command_buffer/client/cmd_buffer_helper.cc',
'command_buffer/client/cmd_buffer_helper.h',
'command_buffer/client/fenced_allocator.cc',
'command_buffer/client/fenced_allocator.h',
+ 'command_buffer/client/hash_tables.h',
'command_buffer/client/mapped_memory.cc',
'command_buffer/client/mapped_memory.h',
'command_buffer/client/query_tracker.cc',