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

Unified Diff: content/renderer/pepper/pepper_compositor_host.cc

Issue 324983005: [PPAPI] Add browser tests for compositor API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compositor_api_impl_new
Patch Set: Disable the test on MACOSX Created 6 years, 6 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/renderer/pepper/pepper_compositor_host.cc
diff --git a/content/renderer/pepper/pepper_compositor_host.cc b/content/renderer/pepper/pepper_compositor_host.cc
index baba5b89b16ee0d272f15ec4002b0d9be4860e49..f7e32b65f48de819fd60bb8961091c2eb7382b58 100644
--- a/content/renderer/pepper/pepper_compositor_host.cc
+++ b/content/renderer/pepper/pepper_compositor_host.cc
@@ -158,10 +158,35 @@ 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_,
@@ -169,8 +194,6 @@ void PepperCompositorHost::ViewInitiatedPaint() {
commit_layers_reply_context_ = ppapi::host::ReplyMessageContext();
}
-void PepperCompositorHost::ViewFlushedPaint() {}
-
void PepperCompositorHost::UpdateLayer(
const scoped_refptr<cc::Layer>& layer,
const ppapi::CompositorLayerData* old_layer,
@@ -277,22 +300,6 @@ 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) {
@@ -311,15 +318,9 @@ 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()]);
@@ -373,6 +374,11 @@ 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;
}
« no previous file with comments | « content/renderer/pepper/pepper_compositor_host.h ('k') | content/renderer/pepper/pepper_plugin_instance_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698