| Index: cc/resources/resource_provider.cc
|
| diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
|
| index 4579126c541734298bceec2cfe92c353c5da0e43..a86a1d7f8d5c422d9d0830003cfed273c21e9085 100644
|
| --- a/cc/resources/resource_provider.cc
|
| +++ b/cc/resources/resource_provider.cc
|
| @@ -544,7 +544,7 @@ void ResourceProvider::DeleteResourceInternal(ResourceMap::iterator it,
|
| GLC(gl, gl->DeleteBuffers(1, &resource->gl_pixel_buffer_id));
|
| }
|
| if (resource->mailbox.IsValid() && resource->external) {
|
| - GLuint sync_point = resource->mailbox.sync_point();
|
| + uint32 sync_point = resource->mailbox.sync_point();
|
| if (resource->mailbox.IsTexture()) {
|
| lost_resource |= lost_output_surface_;
|
| GLES2Interface* gl = ContextGL();
|
| @@ -739,13 +739,13 @@ const ResourceProvider::Resource* ResourceProvider::LockForRead(ResourceId id) {
|
| DCHECK(gl);
|
| if (resource->mailbox.sync_point()) {
|
| GLC(gl, gl->WaitSyncPointCHROMIUM(resource->mailbox.sync_point()));
|
| - resource->mailbox.ResetSyncPoint();
|
| + resource->mailbox.set_sync_point(0);
|
| }
|
| resource->gl_id = texture_id_allocator_->NextId();
|
| GLC(gl, gl->BindTexture(resource->target, resource->gl_id));
|
| GLC(gl,
|
| gl->ConsumeTextureCHROMIUM(resource->target,
|
| - resource->mailbox.data()));
|
| + resource->mailbox.name()));
|
| }
|
| }
|
|
|
| @@ -1021,7 +1021,7 @@ void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources,
|
| ++it) {
|
| TransferableResource resource;
|
| TransferResource(gl, *it, &resource);
|
| - if (!resource.sync_point && !resource.is_software)
|
| + if (!resource.mailbox_holder.sync_point && !resource.is_software)
|
| need_sync_point = true;
|
| ++resources_.find(*it)->second.exported_count;
|
| list->push_back(resource);
|
| @@ -1031,8 +1031,8 @@ void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources,
|
| for (TransferableResourceArray::iterator it = list->begin();
|
| it != list->end();
|
| ++it) {
|
| - if (!it->sync_point)
|
| - it->sync_point = sync_point;
|
| + if (!it->mailbox_holder.sync_point)
|
| + it->mailbox_holder.sync_point = sync_point;
|
| }
|
| }
|
| }
|
| @@ -1056,9 +1056,10 @@ void ResourceProvider::ReceiveFromChild(
|
| scoped_ptr<SharedBitmap> bitmap;
|
| uint8_t* pixels = NULL;
|
| if (it->is_software) {
|
| - if (shared_bitmap_manager_)
|
| - bitmap = shared_bitmap_manager_->GetSharedBitmapFromId(it->size,
|
| - it->mailbox);
|
| + if (shared_bitmap_manager_) {
|
| + bitmap = shared_bitmap_manager_->GetSharedBitmapFromId(
|
| + it->size, it->mailbox_holder.mailbox);
|
| + }
|
| if (bitmap)
|
| pixels = bitmap->pixels();
|
| }
|
| @@ -1084,20 +1085,23 @@ void ResourceProvider::ReceiveFromChild(
|
| // waiting asynchronously, and resetting sync_point before calling this.
|
| // However if the parent is a renderer (e.g. browser tag), it may be ok
|
| // (and is simpler) to wait.
|
| - if (it->sync_point)
|
| - GLC(gl, gl->WaitSyncPointCHROMIUM(it->sync_point));
|
| + if (it->mailbox_holder.sync_point)
|
| + GLC(gl, gl->WaitSyncPointCHROMIUM(it->mailbox_holder.sync_point));
|
| texture_id = texture_id_allocator_->NextId();
|
| - GLC(gl, gl->BindTexture(it->target, texture_id));
|
| - GLC(gl, gl->ConsumeTextureCHROMIUM(it->target, it->mailbox.name));
|
| + GLC(gl, gl->BindTexture(it->mailbox_holder.texture_target, texture_id));
|
| + GLC(gl,
|
| + gl->ConsumeTextureCHROMIUM(it->mailbox_holder.texture_target,
|
| + it->mailbox_holder.mailbox.name));
|
| resource = Resource(texture_id,
|
| it->size,
|
| - it->target,
|
| + it->mailbox_holder.texture_target,
|
| it->filter,
|
| 0,
|
| GL_CLAMP_TO_EDGE,
|
| TextureUsageAny,
|
| it->format);
|
| - resource.mailbox.SetName(it->mailbox);
|
| + resource.mailbox = TextureMailbox(
|
| + it->mailbox_holder.mailbox, it->mailbox_holder.texture_target, 0);
|
| }
|
| resource.child_id = child;
|
| // Don't allocate a texture for a child.
|
| @@ -1203,8 +1207,7 @@ void ResourceProvider::ReceiveReturnsFromParent(
|
| if (returned.sync_point)
|
| GLC(gl, gl->WaitSyncPointCHROMIUM(returned.sync_point));
|
| } else if (!resource->shared_bitmap) {
|
| - resource->mailbox =
|
| - TextureMailbox(resource->mailbox.name(), returned.sync_point);
|
| + resource->mailbox.set_sync_point(returned.sync_point);
|
| }
|
|
|
| if (!resource->marked_for_deletion)
|
| @@ -1252,39 +1255,45 @@ void ResourceProvider::TransferResource(GLES2Interface* gl,
|
| DCHECK_EQ(source->wrap_mode, GL_CLAMP_TO_EDGE);
|
| resource->id = id;
|
| resource->format = source->format;
|
| - resource->target = source->target;
|
| + resource->mailbox_holder.texture_target = source->target;
|
| resource->filter = source->filter;
|
| resource->size = source->size;
|
|
|
| if (source->shared_bitmap) {
|
| - resource->mailbox = source->shared_bitmap->id();
|
| + resource->mailbox_holder.mailbox = source->shared_bitmap->id();
|
| resource->is_software = true;
|
| } else if (!source->mailbox.IsValid()) {
|
| LazyCreate(source);
|
| DCHECK(source->gl_id);
|
| - GLC(gl, gl->BindTexture(resource->target, source->gl_id));
|
| + GLC(gl,
|
| + gl->BindTexture(resource->mailbox_holder.texture_target,
|
| + source->gl_id));
|
| if (source->image_id) {
|
| DCHECK(source->dirty_image);
|
| BindImageForSampling(source);
|
| }
|
| // This is a resource allocated by the compositor, we need to produce it.
|
| // Don't set a sync point, the caller will do it.
|
| - GLC(gl, gl->GenMailboxCHROMIUM(resource->mailbox.name));
|
| + GLC(gl, gl->GenMailboxCHROMIUM(resource->mailbox_holder.mailbox.name));
|
| GLC(gl,
|
| - gl->ProduceTextureCHROMIUM(resource->target, resource->mailbox.name));
|
| - source->mailbox.SetName(resource->mailbox);
|
| + gl->ProduceTextureCHROMIUM(resource->mailbox_holder.texture_target,
|
| + resource->mailbox_holder.mailbox.name));
|
| + source->mailbox = TextureMailbox(resource->mailbox_holder);
|
| } else {
|
| DCHECK(source->mailbox.IsTexture());
|
| if (source->image_id && source->dirty_image) {
|
| DCHECK(source->gl_id);
|
| - GLC(gl, gl->BindTexture(resource->target, source->gl_id));
|
| + GLC(gl,
|
| + gl->BindTexture(resource->mailbox_holder.texture_target,
|
| + source->gl_id));
|
| BindImageForSampling(source);
|
| }
|
| // This is either an external resource, or a compositor resource that we
|
| // already exported. Make sure to forward the sync point that we were given.
|
| - resource->mailbox = source->mailbox.name();
|
| - resource->sync_point = source->mailbox.sync_point();
|
| - source->mailbox.ResetSyncPoint();
|
| + resource->mailbox_holder.mailbox = source->mailbox.mailbox();
|
| + resource->mailbox_holder.texture_target = source->mailbox.target();
|
| + resource->mailbox_holder.sync_point = source->mailbox.sync_point();
|
| + source->mailbox.set_sync_point(0);
|
| }
|
| }
|
|
|
|
|