Skip to content

Commit

Permalink
Make GLImage interface pure virtual
Browse files Browse the repository at this point in the history
Review URL: https://codereview.chromium.org/199783002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257260 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
sievers@chromium.org committed Mar 15, 2014
1 parent 1e6c91d commit 463c12b
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 27 deletions.
9 changes: 9 additions & 0 deletions content/common/gpu/stream_texture_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,13 @@ void StreamTexture::OnEstablishPeer(int32 primary_id, int32 secondary_id) {
process, surface_texture_, primary_id, secondary_id);
}

bool StreamTexture::BindTexImage(unsigned target) {
NOTREACHED();
return false;
}

void StreamTexture::ReleaseTexImage(unsigned target) {
NOTREACHED();
}

} // namespace content
4 changes: 4 additions & 0 deletions content/common/gpu/stream_texture_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ class StreamTexture : public gfx::GLImage,
// gfx::GLImage implementation:
virtual void Destroy() OVERRIDE;
virtual gfx::Size GetSize() OVERRIDE;
virtual bool BindTexImage(unsigned target) OVERRIDE;
virtual void ReleaseTexImage(unsigned target) OVERRIDE;
virtual void WillUseTexImage() OVERRIDE;
virtual void DidUseTexImage() OVERRIDE {}
virtual void WillModifyTexImage() OVERRIDE {}
virtual void DidModifyTexImage() OVERRIDE {}

// GpuCommandBufferStub::DestructionObserver implementation.
virtual void OnWillDestroyStub() OVERRIDE;
Expand Down
2 changes: 2 additions & 0 deletions gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7953,6 +7953,8 @@ class MockGLImage : public gfx::GLImage {
MOCK_METHOD1(ReleaseTexImage, void(unsigned));
MOCK_METHOD0(WillUseTexImage, void());
MOCK_METHOD0(DidUseTexImage, void());
MOCK_METHOD0(WillModifyTexImage, void());
MOCK_METHOD0(DidModifyTexImage, void());

protected:
virtual ~MockGLImage() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ class GLImageImpl : public gfx::GLImage {
// implement gfx::GLImage
virtual void Destroy() OVERRIDE;
virtual gfx::Size GetSize() OVERRIDE;
virtual bool BindTexImage(unsigned target) OVERRIDE;
virtual void ReleaseTexImage(unsigned target) OVERRIDE;
virtual void WillUseTexImage() OVERRIDE;
virtual void DidUseTexImage() OVERRIDE {}
virtual void WillModifyTexImage() OVERRIDE {}
virtual void DidModifyTexImage() OVERRIDE {}

private:
virtual ~GLImageImpl();
Expand Down Expand Up @@ -54,6 +58,15 @@ void GLImageImpl::WillUseTexImage() {
surface_texture_->UpdateTexImage();
}

bool GLImageImpl::BindTexImage(unsigned target) {
NOTREACHED();
return false;
}

void GLImageImpl::ReleaseTexImage(unsigned target) {
NOTREACHED();
}

gfx::Size GLImageImpl::GetSize() {
return gfx::Size();
}
Expand Down
21 changes: 0 additions & 21 deletions ui/gl/gl_image.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,6 @@ namespace gfx {

GLImage::GLImage() {}

bool GLImage::BindTexImage(unsigned target) {
NOTIMPLEMENTED();
return false;
}

void GLImage::ReleaseTexImage(unsigned target) {
NOTIMPLEMENTED();
}

void GLImage::WillUseTexImage() {
NOTIMPLEMENTED();
}

void GLImage::DidUseTexImage() {
NOTIMPLEMENTED();
}

void GLImage::WillModifyTexImage() {}

void GLImage::DidModifyTexImage() {}

void GLImage::SetReleaseAfterUse() {
// Default no-op implementation for workaround.
}
Expand Down
12 changes: 6 additions & 6 deletions ui/gl/gl_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ class GL_EXPORT GLImage : public base::RefCounted<GLImage> {
virtual gfx::Size GetSize() = 0;

// Bind image to texture currently bound to |target|.
virtual bool BindTexImage(unsigned target);
virtual bool BindTexImage(unsigned target) = 0;

// Release image from texture currently bound to |target|.
virtual void ReleaseTexImage(unsigned target);
virtual void ReleaseTexImage(unsigned target) = 0;

// Called before the texture is used for drawing.
virtual void WillUseTexImage();
virtual void WillUseTexImage() = 0;

// Called after the texture has been used for drawing.
virtual void DidUseTexImage();
virtual void DidUseTexImage() = 0;

// Called before the texture image data will be modified.
virtual void WillModifyTexImage();
virtual void WillModifyTexImage() = 0;

// Called after the texture image data has been modified.
virtual void DidModifyTexImage();
virtual void DidModifyTexImage() = 0;

// Indicate that image should be released after use.
// (For an Android work-around only).
Expand Down
6 changes: 6 additions & 0 deletions ui/gl/gl_image_egl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ void GLImageEGL::DidUseTexImage() {
&zero);
}

void GLImageEGL::WillModifyTexImage() {
}

void GLImageEGL::DidModifyTexImage() {
}

void GLImageEGL::SetReleaseAfterUse() {
release_after_use_ = true;
}
Expand Down
2 changes: 2 additions & 0 deletions ui/gl/gl_image_egl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class GL_EXPORT GLImageEGL : public GLImage {
virtual void ReleaseTexImage(unsigned target) OVERRIDE;
virtual void WillUseTexImage() OVERRIDE;
virtual void DidUseTexImage() OVERRIDE;
virtual void WillModifyTexImage() OVERRIDE;
virtual void DidModifyTexImage() OVERRIDE;
virtual void SetReleaseAfterUse() OVERRIDE;

protected:
Expand Down
6 changes: 6 additions & 0 deletions ui/gl/gl_image_glx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,10 @@ void GLImageGLX::WillUseTexImage() {
void GLImageGLX::DidUseTexImage() {
}

void GLImageGLX::WillModifyTexImage() {
}

void GLImageGLX::DidModifyTexImage() {
}

} // namespace gfx
2 changes: 2 additions & 0 deletions ui/gl/gl_image_glx.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class GL_EXPORT GLImageGLX : public GLImage {
virtual void ReleaseTexImage(unsigned target) OVERRIDE;
virtual void WillUseTexImage() OVERRIDE;
virtual void DidUseTexImage() OVERRIDE;
virtual void WillModifyTexImage() OVERRIDE;
virtual void DidModifyTexImage() OVERRIDE;

protected:
virtual ~GLImageGLX();
Expand Down
6 changes: 6 additions & 0 deletions ui/gl/gl_image_io_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,10 @@ void GLImageIOSurface::WillUseTexImage() {
void GLImageIOSurface::DidUseTexImage() {
}

void GLImageIOSurface::WillModifyTexImage() {
}

void GLImageIOSurface::DidModifyTexImage() {
}

} // namespace gfx
2 changes: 2 additions & 0 deletions ui/gl/gl_image_io_surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class GL_EXPORT GLImageIOSurface : public GLImage {
virtual void ReleaseTexImage(unsigned target) OVERRIDE;
virtual void WillUseTexImage() OVERRIDE;
virtual void DidUseTexImage() OVERRIDE;
virtual void WillModifyTexImage() OVERRIDE;
virtual void DidModifyTexImage() OVERRIDE;

protected:
virtual ~GLImageIOSurface();
Expand Down
6 changes: 6 additions & 0 deletions ui/gl/gl_image_shm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,10 @@ void GLImageShm::WillUseTexImage() {
void GLImageShm::DidUseTexImage() {
}

void GLImageShm::WillModifyTexImage() {
}

void GLImageShm::DidModifyTexImage() {
}

} // namespace gfx
2 changes: 2 additions & 0 deletions ui/gl/gl_image_shm.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class GL_EXPORT GLImageShm : public GLImage {
virtual void ReleaseTexImage(unsigned target) OVERRIDE;
virtual void WillUseTexImage() OVERRIDE;
virtual void DidUseTexImage() OVERRIDE;
virtual void WillModifyTexImage() OVERRIDE;
virtual void DidModifyTexImage() OVERRIDE;

protected:
virtual ~GLImageShm();
Expand Down
6 changes: 6 additions & 0 deletions ui/gl/gl_image_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ void GLImageStub::WillUseTexImage() {
void GLImageStub::DidUseTexImage() {
}

void GLImageStub::WillModifyTexImage() {
}

void GLImageStub::DidModifyTexImage() {
}

} // namespace gfx
2 changes: 2 additions & 0 deletions ui/gl/gl_image_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class GL_EXPORT GLImageStub : public GLImage {
virtual void ReleaseTexImage(unsigned target) OVERRIDE;
virtual void WillUseTexImage() OVERRIDE;
virtual void DidUseTexImage() OVERRIDE;
virtual void WillModifyTexImage() OVERRIDE;
virtual void DidModifyTexImage() OVERRIDE;

protected:
virtual ~GLImageStub();
Expand Down

0 comments on commit 463c12b

Please sign in to comment.