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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 uint32_t sync_point, |
| 193 const gpu::SyncToken& sync_token, |
193 bool is_lost) { | 194 bool is_lost) { |
194 bitmap.reset(); | 195 bitmap.reset(); |
195 shared_memory.reset(); | 196 shared_memory.reset(); |
196 ResourceReleased(id, sync_point, is_lost); | 197 ResourceReleased(id, sync_point, sync_token, is_lost); |
197 } | 198 } |
198 | 199 |
199 void PepperCompositorHost::ResourceReleased(int32_t id, | 200 void PepperCompositorHost::ResourceReleased(int32_t id, |
200 uint32_t sync_point, | 201 uint32_t sync_point, |
| 202 const gpu::SyncToken& sync_token, |
201 bool is_lost) { | 203 bool is_lost) { |
202 host()->SendUnsolicitedReply( | 204 host()->SendUnsolicitedReply(pp_resource(), |
203 pp_resource(), | 205 PpapiPluginMsg_Compositor_ReleaseResource( |
204 PpapiPluginMsg_Compositor_ReleaseResource(id, sync_point, is_lost)); | 206 id, sync_point, sync_token, is_lost)); |
205 } | 207 } |
206 | 208 |
207 void PepperCompositorHost::SendCommitLayersReplyIfNecessary() { | 209 void PepperCompositorHost::SendCommitLayersReplyIfNecessary() { |
208 if (!commit_layers_reply_context_.is_valid()) | 210 if (!commit_layers_reply_context_.is_valid()) |
209 return; | 211 return; |
210 host()->SendReply(commit_layers_reply_context_, | 212 host()->SendReply(commit_layers_reply_context_, |
211 PpapiPluginMsg_Compositor_CommitLayersReply()); | 213 PpapiPluginMsg_Compositor_CommitLayersReply()); |
212 commit_layers_reply_context_ = ppapi::host::ReplyMessageContext(); | 214 commit_layers_reply_context_ = ppapi::host::ReplyMessageContext(); |
213 } | 215 } |
214 | 216 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 new_layer->color->green * 255, | 265 new_layer->color->green * 255, |
264 new_layer->color->blue * 255)); | 266 new_layer->color->blue * 255)); |
265 return; | 267 return; |
266 } | 268 } |
267 | 269 |
268 if (new_layer->texture) { | 270 if (new_layer->texture) { |
269 scoped_refptr<cc::TextureLayer> texture_layer( | 271 scoped_refptr<cc::TextureLayer> texture_layer( |
270 static_cast<cc::TextureLayer*>(layer.get())); | 272 static_cast<cc::TextureLayer*>(layer.get())); |
271 if (!old_layer || | 273 if (!old_layer || |
272 new_layer->common.resource_id != old_layer->common.resource_id) { | 274 new_layer->common.resource_id != old_layer->common.resource_id) { |
273 cc::TextureMailbox mailbox(new_layer->texture->mailbox, | 275 cc::TextureMailbox mailbox( |
274 new_layer->texture->target, | 276 new_layer->texture->mailbox, new_layer->texture->target, |
275 new_layer->texture->sync_point); | 277 new_layer->texture->sync_point, new_layer->texture->sync_token); |
276 texture_layer->SetTextureMailbox(mailbox, | 278 texture_layer->SetTextureMailbox(mailbox, |
277 cc::SingleReleaseCallback::Create( | 279 cc::SingleReleaseCallback::Create( |
278 base::Bind(&PepperCompositorHost::ResourceReleased, | 280 base::Bind(&PepperCompositorHost::ResourceReleased, |
279 weak_factory_.GetWeakPtr(), | 281 weak_factory_.GetWeakPtr(), |
280 new_layer->common.resource_id))); | 282 new_layer->common.resource_id))); |
281 // TODO(penghuang): get a damage region from the application and | 283 // TODO(penghuang): get a damage region from the application and |
282 // pass it to SetNeedsDisplayRect(). | 284 // pass it to SetNeedsDisplayRect(). |
283 texture_layer->SetNeedsDisplay(); | 285 texture_layer->SetNeedsDisplay(); |
284 } | 286 } |
285 texture_layer->SetPremultipliedAlpha(new_layer->texture->premult_alpha); | 287 texture_layer->SetPremultipliedAlpha(new_layer->texture->premult_alpha); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 | 408 |
407 // If the host is not bound to the instance, return PP_OK immediately. | 409 // If the host is not bound to the instance, return PP_OK immediately. |
408 if (!bound_instance_) | 410 if (!bound_instance_) |
409 return PP_OK; | 411 return PP_OK; |
410 | 412 |
411 commit_layers_reply_context_ = context->MakeReplyMessageContext(); | 413 commit_layers_reply_context_ = context->MakeReplyMessageContext(); |
412 return PP_OK_COMPLETIONPENDING; | 414 return PP_OK_COMPLETIONPENDING; |
413 } | 415 } |
414 | 416 |
415 } // namespace content | 417 } // namespace content |
OLD | NEW |