summaryrefslogtreecommitdiffstats
path: root/content/renderer/pepper/pepper_compositor_host.cc
diff options
context:
space:
mode:
Diffstat (limited to 'content/renderer/pepper/pepper_compositor_host.cc')
-rw-r--r--content/renderer/pepper/pepper_compositor_host.cc54
1 files changed, 24 insertions, 30 deletions
diff --git a/content/renderer/pepper/pepper_compositor_host.cc b/content/renderer/pepper/pepper_compositor_host.cc
index f7e32b6..baba5b8 100644
--- a/content/renderer/pepper/pepper_compositor_host.cc
+++ b/content/renderer/pepper/pepper_compositor_host.cc
@@ -158,35 +158,10 @@ bool PepperCompositorHost::BindToInstance(
if (bound_instance_ && new_instance)
return false; // Can't change a bound device.
bound_instance_ = new_instance;
- if (!bound_instance_)
- SendCommitLayersReplyIfNecessary();
-
return true;
}
void PepperCompositorHost::ViewInitiatedPaint() {
- SendCommitLayersReplyIfNecessary();
-}
-
-void PepperCompositorHost::ViewFlushedPaint() {}
-
-void PepperCompositorHost::ImageReleased(
- int32_t id,
- const scoped_ptr<base::SharedMemory>& shared_memory,
- uint32_t sync_point,
- bool is_lost) {
- ResourceReleased(id, sync_point, is_lost);
-}
-
-void PepperCompositorHost::ResourceReleased(int32_t id,
- uint32_t sync_point,
- bool is_lost) {
- host()->SendUnsolicitedReply(
- pp_resource(),
- PpapiPluginMsg_Compositor_ReleaseResource(id, sync_point, is_lost));
-}
-
-void PepperCompositorHost::SendCommitLayersReplyIfNecessary() {
if (!commit_layers_reply_context_.is_valid())
return;
host()->SendReply(commit_layers_reply_context_,
@@ -194,6 +169,8 @@ void PepperCompositorHost::SendCommitLayersReplyIfNecessary() {
commit_layers_reply_context_ = ppapi::host::ReplyMessageContext();
}
+void PepperCompositorHost::ViewFlushedPaint() {}
+
void PepperCompositorHost::UpdateLayer(
const scoped_refptr<cc::Layer>& layer,
const ppapi::CompositorLayerData* old_layer,
@@ -300,6 +277,22 @@ void PepperCompositorHost::UpdateLayer(
NOTREACHED();
}
+void PepperCompositorHost::ResourceReleased(int32_t id,
+ uint32_t sync_point,
+ bool is_lost) {
+ host()->SendUnsolicitedReply(
+ pp_resource(),
+ PpapiPluginMsg_Compositor_ReleaseResource(id, sync_point, is_lost));
+}
+
+void PepperCompositorHost::ImageReleased(
+ int32_t id,
+ const scoped_ptr<base::SharedMemory>& shared_memory,
+ uint32_t sync_point,
+ bool is_lost) {
+ ResourceReleased(id, sync_point, is_lost);
+}
+
int32_t PepperCompositorHost::OnResourceMessageReceived(
const IPC::Message& msg,
HostMessageContext* context) {
@@ -318,9 +311,15 @@ int32_t PepperCompositorHost::OnHostMsgCommitLayers(
HostMessageContext* context,
const std::vector<ppapi::CompositorLayerData>& layers,
bool reset) {
+ // Do not support CommitLayers() on an unbounded compositor.
+ if (!bound_instance_)
+ return PP_ERROR_FAILED;
+
if (commit_layers_reply_context_.is_valid())
return PP_ERROR_INPROGRESS;
+ commit_layers_reply_context_ = context->MakeReplyMessageContext();
+
scoped_ptr<scoped_ptr<base::SharedMemory>[]> image_shms;
if (layers.size() > 0) {
image_shms.reset(new scoped_ptr<base::SharedMemory>[layers.size()]);
@@ -374,11 +373,6 @@ int32_t PepperCompositorHost::OnHostMsgCommitLayers(
if (layer_->layer_tree_host())
layer_->layer_tree_host()->SetNeedsCommit();
- // If the host is not bound to the instance, return PP_OK immediately.
- if (!bound_instance_)
- return PP_OK;
-
- commit_layers_reply_context_ = context->MakeReplyMessageContext();
return PP_OK_COMPLETIONPENDING;
}