| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/pepper/pepper_compositor_host.h" | 5 #include "content/renderer/pepper/pepper_compositor_host.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 182 } |
| 183 | 183 |
| 184 void PepperCompositorHost::ViewInitiatedPaint() { | 184 void PepperCompositorHost::ViewInitiatedPaint() { |
| 185 SendCommitLayersReplyIfNecessary(); | 185 SendCommitLayersReplyIfNecessary(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 void PepperCompositorHost::ImageReleased( | 188 void PepperCompositorHost::ImageReleased( |
| 189 int32_t id, | 189 int32_t id, |
| 190 scoped_ptr<base::SharedMemory> shared_memory, | 190 scoped_ptr<base::SharedMemory> shared_memory, |
| 191 scoped_ptr<cc::SharedBitmap> bitmap, | 191 scoped_ptr<cc::SharedBitmap> bitmap, |
| 192 uint32_t sync_point, | 192 const gpu::SyncToken& sync_token, |
| 193 bool is_lost) { | 193 bool is_lost) { |
| 194 bitmap.reset(); | 194 bitmap.reset(); |
| 195 shared_memory.reset(); | 195 shared_memory.reset(); |
| 196 ResourceReleased(id, sync_point, is_lost); | 196 ResourceReleased(id, sync_token, is_lost); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void PepperCompositorHost::ResourceReleased(int32_t id, | 199 void PepperCompositorHost::ResourceReleased(int32_t id, |
| 200 uint32_t sync_point, | 200 const gpu::SyncToken& sync_token, |
| 201 bool is_lost) { | 201 bool is_lost) { |
| 202 host()->SendUnsolicitedReply( | 202 host()->SendUnsolicitedReply( |
| 203 pp_resource(), | 203 pp_resource(), |
| 204 PpapiPluginMsg_Compositor_ReleaseResource(id, sync_point, is_lost)); | 204 PpapiPluginMsg_Compositor_ReleaseResource(id, sync_token, is_lost)); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void PepperCompositorHost::SendCommitLayersReplyIfNecessary() { | 207 void PepperCompositorHost::SendCommitLayersReplyIfNecessary() { |
| 208 if (!commit_layers_reply_context_.is_valid()) | 208 if (!commit_layers_reply_context_.is_valid()) |
| 209 return; | 209 return; |
| 210 host()->SendReply(commit_layers_reply_context_, | 210 host()->SendReply(commit_layers_reply_context_, |
| 211 PpapiPluginMsg_Compositor_CommitLayersReply()); | 211 PpapiPluginMsg_Compositor_CommitLayersReply()); |
| 212 commit_layers_reply_context_ = ppapi::host::ReplyMessageContext(); | 212 commit_layers_reply_context_ = ppapi::host::ReplyMessageContext(); |
| 213 } | 213 } |
| 214 | 214 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 new_layer->color->blue * 255)); | 264 new_layer->color->blue * 255)); |
| 265 return; | 265 return; |
| 266 } | 266 } |
| 267 | 267 |
| 268 if (new_layer->texture) { | 268 if (new_layer->texture) { |
| 269 scoped_refptr<cc::TextureLayer> texture_layer( | 269 scoped_refptr<cc::TextureLayer> texture_layer( |
| 270 static_cast<cc::TextureLayer*>(layer.get())); | 270 static_cast<cc::TextureLayer*>(layer.get())); |
| 271 if (!old_layer || | 271 if (!old_layer || |
| 272 new_layer->common.resource_id != old_layer->common.resource_id) { | 272 new_layer->common.resource_id != old_layer->common.resource_id) { |
| 273 cc::TextureMailbox mailbox(new_layer->texture->mailbox, | 273 cc::TextureMailbox mailbox(new_layer->texture->mailbox, |
| 274 new_layer->texture->target, | 274 new_layer->texture->sync_token, |
| 275 new_layer->texture->sync_point); | 275 new_layer->texture->target); |
| 276 texture_layer->SetTextureMailbox(mailbox, | 276 texture_layer->SetTextureMailbox(mailbox, |
| 277 cc::SingleReleaseCallback::Create( | 277 cc::SingleReleaseCallback::Create( |
| 278 base::Bind(&PepperCompositorHost::ResourceReleased, | 278 base::Bind(&PepperCompositorHost::ResourceReleased, |
| 279 weak_factory_.GetWeakPtr(), | 279 weak_factory_.GetWeakPtr(), |
| 280 new_layer->common.resource_id))); | 280 new_layer->common.resource_id))); |
| 281 // TODO(penghuang): get a damage region from the application and | 281 // TODO(penghuang): get a damage region from the application and |
| 282 // pass it to SetNeedsDisplayRect(). | 282 // pass it to SetNeedsDisplayRect(). |
| 283 texture_layer->SetNeedsDisplay(); | 283 texture_layer->SetNeedsDisplay(); |
| 284 } | 284 } |
| 285 texture_layer->SetPremultipliedAlpha(new_layer->texture->premult_alpha); | 285 texture_layer->SetPremultipliedAlpha(new_layer->texture->premult_alpha); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 | 406 |
| 407 // If the host is not bound to the instance, return PP_OK immediately. | 407 // If the host is not bound to the instance, return PP_OK immediately. |
| 408 if (!bound_instance_) | 408 if (!bound_instance_) |
| 409 return PP_OK; | 409 return PP_OK; |
| 410 | 410 |
| 411 commit_layers_reply_context_ = context->MakeReplyMessageContext(); | 411 commit_layers_reply_context_ = context->MakeReplyMessageContext(); |
| 412 return PP_OK_COMPLETIONPENDING; | 412 return PP_OK_COMPLETIONPENDING; |
| 413 } | 413 } |
| 414 | 414 |
| 415 } // namespace content | 415 } // namespace content |
| OLD | NEW |