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

Unified Diff: cc/resources/resource_provider_unittest.cc

Issue 105103004: Convert cc resource system over to GLES2Interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | « cc/resources/resource_provider.cc ('k') | cc/resources/resource_update_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_provider_unittest.cc
diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc
index a34aee6304bf8cb5d74493085a769500c5fcf893..e40c9a7e6fe8fe8fe276e549e5e4170831b27dea 100644
--- a/cc/resources/resource_provider_unittest.cc
+++ b/cc/resources/resource_provider_unittest.cc
@@ -23,7 +23,6 @@
#include "gpu/GLES2/gl2extchromium.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
#include "ui/gfx/rect.h"
@@ -34,12 +33,6 @@ using testing::Return;
using testing::SetArgPointee;
using testing::StrictMock;
using testing::_;
-using blink::WGC3Dbyte;
-using blink::WGC3Denum;
-using blink::WGC3Dint;
-using blink::WGC3Dsizei;
-using blink::WGC3Duint;
-using blink::WebGLId;
namespace cc {
namespace {
@@ -83,24 +76,22 @@ static scoped_ptr<base::SharedMemory> CreateAndFillSharedMemory(
class TextureStateTrackingContext : public TestWebGraphicsContext3D {
public:
- MOCK_METHOD2(bindTexture, void(WGC3Denum target, WebGLId texture));
- MOCK_METHOD3(texParameteri,
- void(WGC3Denum target, WGC3Denum pname, WGC3Dint param));
+ MOCK_METHOD2(bindTexture, void(GLenum target, GLuint texture));
+ MOCK_METHOD3(texParameteri, void(GLenum target, GLenum pname, GLint param));
MOCK_METHOD1(waitSyncPoint, void(unsigned sync_point));
MOCK_METHOD0(insertSyncPoint, unsigned(void));
- MOCK_METHOD2(produceTextureCHROMIUM, void(WGC3Denum target,
- const WGC3Dbyte* mailbox));
- MOCK_METHOD2(consumeTextureCHROMIUM, void(WGC3Denum target,
- const WGC3Dbyte* mailbox));
+ MOCK_METHOD2(produceTextureCHROMIUM,
+ void(GLenum target, const GLbyte* mailbox));
+ MOCK_METHOD2(consumeTextureCHROMIUM,
+ void(GLenum target, const GLbyte* mailbox));
// Force all textures to be consecutive numbers starting at "1",
// so we easily can test for them.
- virtual blink::WebGLId NextTextureId() OVERRIDE {
+ virtual GLuint NextTextureId() OVERRIDE {
base::AutoLock lock(namespace_->lock);
return namespace_->next_texture_id++;
}
- virtual void RetireTextureId(blink::WebGLId) OVERRIDE {
- }
+ virtual void RetireTextureId(GLuint) OVERRIDE {}
};
// Shared data between multiple ResourceProviderContext. This contains mailbox
@@ -113,13 +104,13 @@ class ContextSharedData {
unsigned InsertSyncPoint() { return next_sync_point_++; }
- void GenMailbox(WGC3Dbyte* mailbox) {
- memset(mailbox, 0, sizeof(WGC3Dbyte[64]));
+ void GenMailbox(GLbyte* mailbox) {
+ memset(mailbox, 0, sizeof(GLbyte[64]));
memcpy(mailbox, &next_mailbox_, sizeof(next_mailbox_));
++next_mailbox_;
}
- void ProduceTexture(const WGC3Dbyte* mailbox_name,
+ void ProduceTexture(const GLbyte* mailbox_name,
unsigned sync_point,
scoped_refptr<TestTexture> texture) {
unsigned mailbox = 0;
@@ -130,7 +121,7 @@ class ContextSharedData {
sync_point_for_mailbox_[mailbox] = sync_point;
}
- scoped_refptr<TestTexture> ConsumeTexture(const WGC3Dbyte* mailbox_name,
+ scoped_refptr<TestTexture> ConsumeTexture(const GLbyte* mailbox_name,
unsigned sync_point) {
unsigned mailbox = 0;
memcpy(&mailbox, mailbox_name, sizeof(mailbox));
@@ -182,15 +173,15 @@ class ResourceProviderContext : public TestWebGraphicsContext3D {
last_waited_sync_point_ = std::max(sync_point, last_waited_sync_point_);
}
- virtual void texStorage2DEXT(WGC3Denum target,
- WGC3Dint levels,
- WGC3Duint internalformat,
- WGC3Dint width,
- WGC3Dint height) OVERRIDE {
+ virtual void texStorage2DEXT(GLenum target,
+ GLint levels,
+ GLuint internalformat,
+ GLint width,
+ GLint height) OVERRIDE {
CheckTextureIsBound(target);
ASSERT_EQ(static_cast<unsigned>(GL_TEXTURE_2D), target);
ASSERT_EQ(1, levels);
- WGC3Denum format = GL_RGBA;
+ GLenum format = GL_RGBA;
switch (internalformat) {
case GL_RGBA8_OES:
break;
@@ -203,14 +194,14 @@ class ResourceProviderContext : public TestWebGraphicsContext3D {
AllocateTexture(gfx::Size(width, height), format);
}
- virtual void texImage2D(WGC3Denum target,
- WGC3Dint level,
- WGC3Denum internalformat,
- WGC3Dsizei width,
- WGC3Dsizei height,
- WGC3Dint border,
- WGC3Denum format,
- WGC3Denum type,
+ virtual void texImage2D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
const void* pixels) OVERRIDE {
CheckTextureIsBound(target);
ASSERT_EQ(static_cast<unsigned>(GL_TEXTURE_2D), target);
@@ -223,14 +214,14 @@ class ResourceProviderContext : public TestWebGraphicsContext3D {
SetPixels(0, 0, width, height, pixels);
}
- virtual void texSubImage2D(WGC3Denum target,
- WGC3Dint level,
- WGC3Dint xoffset,
- WGC3Dint yoffset,
- WGC3Dsizei width,
- WGC3Dsizei height,
- WGC3Denum format,
- WGC3Denum type,
+ virtual void texSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
const void* pixels) OVERRIDE {
CheckTextureIsBound(target);
ASSERT_EQ(static_cast<unsigned>(GL_TEXTURE_2D), target);
@@ -244,12 +235,12 @@ class ResourceProviderContext : public TestWebGraphicsContext3D {
SetPixels(xoffset, yoffset, width, height, pixels);
}
- virtual void genMailboxCHROMIUM(WGC3Dbyte* mailbox) OVERRIDE {
+ virtual void genMailboxCHROMIUM(GLbyte* mailbox) OVERRIDE {
return shared_data_->GenMailbox(mailbox);
}
- virtual void produceTextureCHROMIUM(WGC3Denum target,
- const WGC3Dbyte* mailbox) OVERRIDE {
+ virtual void produceTextureCHROMIUM(GLenum target,
+ const GLbyte* mailbox) OVERRIDE {
CheckTextureIsBound(target);
// Delay moving the texture into the mailbox until the next
@@ -262,8 +253,8 @@ class ResourceProviderContext : public TestWebGraphicsContext3D {
pending_produce_textures_.push_back(pending.Pass());
}
- virtual void consumeTextureCHROMIUM(WGC3Denum target,
- const WGC3Dbyte* mailbox) OVERRIDE {
+ virtual void consumeTextureCHROMIUM(GLenum target,
+ const GLbyte* mailbox) OVERRIDE {
CheckTextureIsBound(target);
base::AutoLock lock_for_texture_access(namespace_->lock);
scoped_refptr<TestTexture> texture =
@@ -286,7 +277,7 @@ class ResourceProviderContext : public TestWebGraphicsContext3D {
last_waited_sync_point_(0) {}
private:
- void AllocateTexture(gfx::Size size, WGC3Denum format) {
+ void AllocateTexture(gfx::Size size, GLenum format) {
CheckTextureIsBound(GL_TEXTURE_2D);
ResourceFormat texture_format = RGBA_8888;
switch (format) {
@@ -327,7 +318,7 @@ class ResourceProviderContext : public TestWebGraphicsContext3D {
}
struct PendingProduceTexture {
- WGC3Dbyte mailbox[64];
+ GLbyte mailbox[64];
scoped_refptr<TestTexture> texture;
};
typedef ScopedPtrDeque<PendingProduceTexture> PendingProduceTextureList;
@@ -475,7 +466,7 @@ class ResourceProviderTest
static void SetResourceFilter(ResourceProvider* resource_provider,
ResourceProvider::ResourceId id,
- WGC3Denum filter) {
+ GLenum filter) {
ResourceProvider::ScopedSamplerGL sampler(
resource_provider, id, GL_TEXTURE_2D, filter);
}
@@ -656,7 +647,7 @@ TEST_P(ResourceProviderTest, TransferGLResources) {
uint8_t data2[4] = { 5, 5, 5, 5 };
child_resource_provider_->SetPixels(id2, data2, rect, rect, gfx::Vector2d());
- WebGLId external_texture_id = child_context_->createExternalTexture();
+ GLuint external_texture_id = child_context_->createExternalTexture();
child_context_->bindTexture(GL_TEXTURE_EXTERNAL_OES, external_texture_id);
gpu::Mailbox external_mailbox;
@@ -2377,81 +2368,77 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) {
class AllocationTrackingContext3D : public TestWebGraphicsContext3D {
public:
- MOCK_METHOD0(NextTextureId, WebGLId());
- MOCK_METHOD1(RetireTextureId, void(WebGLId id));
- MOCK_METHOD2(bindTexture, void(WGC3Denum target, WebGLId texture));
+ MOCK_METHOD0(NextTextureId, GLuint());
+ MOCK_METHOD1(RetireTextureId, void(GLuint id));
+ MOCK_METHOD2(bindTexture, void(GLenum target, GLuint texture));
MOCK_METHOD5(texStorage2DEXT,
- void(WGC3Denum target,
- WGC3Dint levels,
- WGC3Duint internalformat,
- WGC3Dint width,
- WGC3Dint height));
+ void(GLenum target,
+ GLint levels,
+ GLuint internalformat,
+ GLint width,
+ GLint height));
MOCK_METHOD9(texImage2D,
- void(WGC3Denum target,
- WGC3Dint level,
- WGC3Denum internalformat,
- WGC3Dsizei width,
- WGC3Dsizei height,
- WGC3Dint border,
- WGC3Denum format,
- WGC3Denum type,
+ void(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
const void* pixels));
MOCK_METHOD9(texSubImage2D,
- void(WGC3Denum target,
- WGC3Dint level,
- WGC3Dint xoffset,
- WGC3Dint yoffset,
- WGC3Dsizei width,
- WGC3Dsizei height,
- WGC3Denum format,
- WGC3Denum type,
+ void(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
const void* pixels));
MOCK_METHOD9(asyncTexImage2DCHROMIUM,
- void(WGC3Denum target,
- WGC3Dint level,
- WGC3Denum internalformat,
- WGC3Dsizei width,
- WGC3Dsizei height,
- WGC3Dint border,
- WGC3Denum format,
- WGC3Denum type,
+ void(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
const void* pixels));
MOCK_METHOD9(asyncTexSubImage2DCHROMIUM,
- void(WGC3Denum target,
- WGC3Dint level,
- WGC3Dint xoffset,
- WGC3Dint yoffset,
- WGC3Dsizei width,
- WGC3Dsizei height,
- WGC3Denum format,
- WGC3Denum type,
+ void(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
const void* pixels));
MOCK_METHOD8(compressedTexImage2D,
- void(WGC3Denum target,
- WGC3Dint level,
- WGC3Denum internalformat,
- WGC3Dsizei width,
- WGC3Dsizei height,
- WGC3Dint border,
- WGC3Dsizei image_size,
+ void(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei image_size,
const void* data));
- MOCK_METHOD1(waitAsyncTexImage2DCHROMIUM, void(WGC3Denum));
- MOCK_METHOD3(createImageCHROMIUM, WGC3Duint(WGC3Dsizei, WGC3Dsizei,
- WGC3Denum));
- MOCK_METHOD1(destroyImageCHROMIUM, void(WGC3Duint));
- MOCK_METHOD2(mapImageCHROMIUM, void*(WGC3Duint, WGC3Denum));
- MOCK_METHOD3(getImageParameterivCHROMIUM, void(WGC3Duint, WGC3Denum,
- GLint*));
- MOCK_METHOD1(unmapImageCHROMIUM, void(WGC3Duint));
- MOCK_METHOD2(bindTexImage2DCHROMIUM, void(WGC3Denum, WGC3Dint));
- MOCK_METHOD2(releaseTexImage2DCHROMIUM, void(WGC3Denum, WGC3Dint));
+ MOCK_METHOD1(waitAsyncTexImage2DCHROMIUM, void(GLenum));
+ MOCK_METHOD3(createImageCHROMIUM, GLuint(GLsizei, GLsizei, GLenum));
+ MOCK_METHOD1(destroyImageCHROMIUM, void(GLuint));
+ MOCK_METHOD2(mapImageCHROMIUM, void*(GLuint, GLenum));
+ MOCK_METHOD3(getImageParameterivCHROMIUM, void(GLuint, GLenum, GLint*));
+ MOCK_METHOD1(unmapImageCHROMIUM, void(GLuint));
+ MOCK_METHOD2(bindTexImage2DCHROMIUM, void(GLenum, GLint));
+ MOCK_METHOD2(releaseTexImage2DCHROMIUM, void(GLenum, GLint));
// We're mocking bindTexture, so we override
// TestWebGraphicsContext3D::texParameteri to avoid assertions related to the
// currently bound texture.
- virtual void texParameteri(blink::WGC3Denum target,
- blink::WGC3Denum pname,
- blink::WGC3Dint param) {}
+ virtual void texParameteri(GLenum target, GLenum pname, GLint param) {}
};
TEST_P(ResourceProviderTest, TextureAllocation) {
@@ -3023,13 +3010,12 @@ INSTANTIATE_TEST_CASE_P(
class TextureIdAllocationTrackingContext : public TestWebGraphicsContext3D {
public:
- virtual blink::WebGLId NextTextureId() OVERRIDE {
+ virtual GLuint NextTextureId() OVERRIDE {
base::AutoLock lock(namespace_->lock);
return namespace_->next_texture_id++;
}
- virtual void RetireTextureId(blink::WebGLId) OVERRIDE {
- }
- blink::WebGLId PeekTextureId() {
+ virtual void RetireTextureId(GLuint) OVERRIDE {}
+ GLuint PeekTextureId() {
base::AutoLock lock(namespace_->lock);
return namespace_->next_texture_id;
}
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/resource_update_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698