summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-28 19:04:57 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-28 19:04:57 +0000
commitaf65aab8b8d1bca1027036a44250a926b4dd3ba1 (patch)
treebffcefe5956a12d310408485e6f2a88d01cb5ffa
parent86c82fe1cc918fde83efe4a8e91455d075ae9ee5 (diff)
downloadchromium_src-af65aab8b8d1bca1027036a44250a926b4dd3ba1.zip
chromium_src-af65aab8b8d1bca1027036a44250a926b4dd3ba1.tar.gz
chromium_src-af65aab8b8d1bca1027036a44250a926b4dd3ba1.tar.bz2
Add ShareGroup stub
TEST=unit test BUG=120297 Review URL: http://codereview.chromium.org/9836126 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129456 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--gpu/command_buffer/client/ref_counted.h24
-rw-r--r--gpu/command_buffer/client/share_group.cc20
-rw-r--r--gpu/command_buffer/client/share_group.h32
-rw-r--r--gpu/command_buffer/client/share_group_unittest.cc35
-rw-r--r--gpu/gpu.gyp2
-rw-r--r--gpu/gpu_common.gypi1
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/nacl.scons1
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp1
8 files changed, 116 insertions, 0 deletions
diff --git a/gpu/command_buffer/client/ref_counted.h b/gpu/command_buffer/client/ref_counted.h
new file mode 100644
index 0000000..ed73a73
--- /dev/null
+++ b/gpu/command_buffer/client/ref_counted.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_REF_COUNTED_H_
+#define GPU_COMMAND_BUFFER_CLIENT_REF_COUNTED_H_
+
+#if defined(__native_client__)
+#include "native_client/src/include/ref_counted.h"
+namespace gpu {
+template <class T>
+struct RefCountedThreadSafe : public nacl::RefCounted<T> {
+};
+}
+#else
+#include "base/memory/ref_counted.h"
+namespace gpu {
+template <class T>
+struct RefCountedThreadSafe : public base::RefCountedThreadSafe<T> {
+};
+}
+#endif
+
+#endif // GPU_COMMAND_BUFFER_CLIENT_REF_COUNTED_H_
diff --git a/gpu/command_buffer/client/share_group.cc b/gpu/command_buffer/client/share_group.cc
new file mode 100644
index 0000000..3e3b7e6
--- /dev/null
+++ b/gpu/command_buffer/client/share_group.cc
@@ -0,0 +1,20 @@
+// 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/share_group.h"
+#include "../common/logging.h"
+
+namespace gpu {
+namespace gles2 {
+
+ShareGroup::ShareGroup() {
+ GPU_CHECK(ShareGroup::ImplementsThreadSafeReferenceCounting());
+}
+
+ShareGroup::~ShareGroup() {
+}
+
+} // namespace gles2
+} // namespace gpu
+
diff --git a/gpu/command_buffer/client/share_group.h b/gpu/command_buffer/client/share_group.h
new file mode 100644
index 0000000..8ce940a
--- /dev/null
+++ b/gpu/command_buffer/client/share_group.h
@@ -0,0 +1,32 @@
+// 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_SHARE_GROUP_H_
+#define GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_
+
+#include "../client/ref_counted.h"
+#include "gles2_impl_export.h"
+
+namespace gpu {
+namespace gles2 {
+
+// ShareGroup manages shared resources for contexts that are sharing resources.
+class GLES2_IMPL_EXPORT ShareGroup
+ : public gpu::RefCountedThreadSafe<ShareGroup> {
+ public:
+ typedef scoped_refptr<ShareGroup> Ref;
+
+ ShareGroup();
+ ~ShareGroup();
+
+ bool Initialize();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ShareGroup);
+};
+
+} // namespace gles2
+} // namespace gpu
+
+#endif // GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_
diff --git a/gpu/command_buffer/client/share_group_unittest.cc b/gpu/command_buffer/client/share_group_unittest.cc
new file mode 100644
index 0000000..e0e643e
--- /dev/null
+++ b/gpu/command_buffer/client/share_group_unittest.cc
@@ -0,0 +1,35 @@
+// 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.
+
+// Tests for the ShareGroup.
+
+#include "gpu/command_buffer/client/share_group.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace gpu {
+namespace gles2 {
+
+class ShareGroupTest : public testing::Test {
+ protected:
+
+ virtual void SetUp() {
+ share_group_ = ShareGroup::Ref(new ShareGroup());
+ }
+
+ virtual void TearDown() {
+ }
+
+ scoped_refptr<ShareGroup> share_group_;
+};
+
+TEST_F(ShareGroupTest, Basic) {
+ EXPECT_TRUE(ShareGroup::ImplementsThreadSafeReferenceCounting());
+}
+
+} // namespace gles2
+} // namespace gpu
+
+
diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp
index 7fa6297..e87daae 100644
--- a/gpu/gpu.gyp
+++ b/gpu/gpu.gyp
@@ -25,6 +25,8 @@
'command_buffer/client/gles2_implementation.h',
'command_buffer/client/program_info_manager.cc',
'command_buffer/client/program_info_manager.h',
+ 'command_buffer/client/share_group.cc',
+ 'command_buffer/client/share_group.h',
]
},
'includes': [
diff --git a/gpu/gpu_common.gypi b/gpu/gpu_common.gypi
index 0c9fb4f..104b29d 100644
--- a/gpu/gpu_common.gypi
+++ b/gpu/gpu_common.gypi
@@ -149,6 +149,7 @@
'command_buffer/client/query_tracker_unittest.cc',
'command_buffer/client/program_info_manager_unittest.cc',
'command_buffer/client/ring_buffer_test.cc',
+ 'command_buffer/client/share_group_unittest.cc',
'command_buffer/client/transfer_buffer_unittest.cc',
'command_buffer/common/bitfield_helpers_test.cc',
'command_buffer/common/command_buffer_mock.cc',
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/nacl.scons b/ppapi/native_client/src/shared/ppapi_proxy/nacl.scons
index 24252e0..911a00c 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/nacl.scons
+++ b/ppapi/native_client/src/shared/ppapi_proxy/nacl.scons
@@ -37,6 +37,7 @@ command_buffer_client_srcs = [
'command_buffer/client/mapped_memory.cc',
'command_buffer/client/query_tracker.cc',
'command_buffer/client/ring_buffer.cc',
+ 'command_buffer/client/share_group.cc',
'command_buffer/client/transfer_buffer.cc',
'command_buffer/common/id_allocator.cc',
]
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp
index c957426..d2dff3d 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp
+++ b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp
@@ -39,6 +39,7 @@
'<(DEPTH)/gpu/command_buffer/client/gles2_lib.cc',
'<(DEPTH)/gpu/command_buffer/client/mapped_memory.cc',
'<(DEPTH)/gpu/command_buffer/client/query_tracker.cc',
+ '<(DEPTH)/gpu/command_buffer/client/share_group.cc',
'<(DEPTH)/gpu/command_buffer/client/ring_buffer.cc',
'<(DEPTH)/gpu/command_buffer/common/id_allocator.cc',