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

Unified Diff: content/common/gpu/texture_image_transport_surface.cc

Issue 12440005: Use gpu::Mailbox in IPCs instead of std::string (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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: content/common/gpu/texture_image_transport_surface.cc
diff --git a/content/common/gpu/texture_image_transport_surface.cc b/content/common/gpu/texture_image_transport_surface.cc
index a40b60df36e7bc9c505f4483869a54e395342d41..186cc37b22d823bf31c57be30d112bdaaa1545fa 100644
--- a/content/common/gpu/texture_image_transport_surface.cc
+++ b/content/common/gpu/texture_image_transport_surface.cc
@@ -214,9 +214,7 @@ bool TextureImageTransportSurface::SwapBuffers() {
DCHECK(backbuffer_.size == current_size_);
GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
params.size = backbuffer_.size;
- const MailboxName& name = backbuffer_.mailbox_name;
- params.mailbox_name.assign(
- reinterpret_cast<const char*>(&name), sizeof(name));
+ params.mailbox_name = backbuffer_.mailbox_name;
glFlush();
ProduceTexture(&backbuffer_);
@@ -256,9 +254,7 @@ bool TextureImageTransportSurface::PostSubBuffer(
params.y = y;
params.width = width;
params.height = height;
- const MailboxName& name = backbuffer_.mailbox_name;
- params.mailbox_name.assign(
- reinterpret_cast<const char*>(&name), sizeof(name));
+ params.mailbox_name = backbuffer_.mailbox_name;
glFlush();
ProduceTexture(&backbuffer_);
@@ -316,12 +312,10 @@ void TextureImageTransportSurface::OnBufferPresented(
}
void TextureImageTransportSurface::BufferPresentedImpl(
- const std::string& mailbox_name) {
+ const gpu::Mailbox& mailbox_name) {
DCHECK(!backbuffer_.service_id);
- if (!mailbox_name.empty()) {
- DCHECK(mailbox_name.length() == GL_MAILBOX_SIZE_CHROMIUM);
- mailbox_name.copy(reinterpret_cast<char *>(&backbuffer_.mailbox_name),
- sizeof(MailboxName));
+ if (!mailbox_name.IsZero()) {
+ backbuffer_.mailbox_name = mailbox_name;
ConsumeTexture(&backbuffer_);
}
@@ -370,7 +364,7 @@ void TextureImageTransportSurface::ReleaseBackTexture() {
glDeleteTextures(1, &backbuffer_.service_id);
backbuffer_.service_id = 0;
- backbuffer_.mailbox_name = MailboxName();
+ backbuffer_.mailbox_name = gpu::Mailbox();
glFlush();
CHECK_GL_ERROR();
}
@@ -401,12 +395,13 @@ void TextureImageTransportSurface::CreateBackTexture() {
}
if (!backbuffer_.service_id) {
- MailboxName new_mailbox_name;
- MailboxName& name = backbuffer_.mailbox_name;
+ gpu::Mailbox& name = backbuffer_.mailbox_name;
// This slot should be uninitialized.
- DCHECK(!memcmp(&name, &new_mailbox_name, sizeof(MailboxName)));
+ DCHECK(name.IsZero());
+
+ MailboxName new_mailbox_name;
mailbox_manager_->GenerateMailboxName(&new_mailbox_name);
- name = new_mailbox_name;
+ name.SetName(new_mailbox_name.key);
glGenTextures(1, &backbuffer_.service_id);
}
@@ -449,13 +444,13 @@ void TextureImageTransportSurface::ConsumeTexture(Texture* texture) {
DCHECK(!texture->service_id);
scoped_ptr<TextureDefinition> definition(mailbox_manager_->ConsumeTexture(
- GL_TEXTURE_2D, texture->mailbox_name));
+ GL_TEXTURE_2D, MailboxName(texture->mailbox_name)));
if (definition.get()) {
texture->service_id = definition->ReleaseServiceId();
texture->size = gfx::Size(definition->level_infos()[0][0].width,
definition->level_infos()[0][0].height);
} else {
- texture->mailbox_name = MailboxName();
+ texture->mailbox_name = gpu::Mailbox();
}
}
@@ -489,12 +484,12 @@ void TextureImageTransportSurface::ProduceTexture(Texture* texture) {
// at which point we consume the correct texture back.
bool success = mailbox_manager_->ProduceTexture(
GL_TEXTURE_2D,
- texture->mailbox_name,
+ MailboxName(texture->mailbox_name),
definition.release(),
NULL);
DCHECK(success);
texture->service_id = 0;
- texture->mailbox_name = MailboxName();
+ texture->mailbox_name = gpu::Mailbox();
}
} // namespace content
« no previous file with comments | « content/common/gpu/texture_image_transport_surface.h ('k') | content/renderer/browser_plugin/browser_plugin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698