summaryrefslogtreecommitdiffstats
path: root/content/renderer
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-20 18:08:31 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-20 18:08:31 +0000
commit72fbe9a8fbe731f84ed916ce7a03d237b97d835f (patch)
tree2f740ab28de4f00ddbfa5f6b76249df4d669a536 /content/renderer
parent4e2785c027787bc15023be09206c501d8dc39a45 (diff)
downloadchromium_src-72fbe9a8fbe731f84ed916ce7a03d237b97d835f.zip
chromium_src-72fbe9a8fbe731f84ed916ce7a03d237b97d835f.tar.gz
chromium_src-72fbe9a8fbe731f84ed916ce7a03d237b97d835f.tar.bz2
Revert 278728 "[PPAPI] Add browser tests for compositor API"
> [PPAPI] Add browser tests for compositor API > > And fix a bug found with the tests. > BindGraphics() does not work for a device which is in the same type with the current bound device. > > BUG=374383 > R=piman@chromium.org, raymes@chromium.org > > Review URL: https://codereview.chromium.org/324983005 TBR=penghuang@chromium.org Review URL: https://codereview.chromium.org/342323006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278765 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r--content/renderer/pepper/pepper_compositor_host.cc54
-rw-r--r--content/renderer/pepper/pepper_compositor_host.h15
-rw-r--r--content/renderer/pepper/pepper_plugin_instance_impl.cc17
-rw-r--r--content/renderer/pepper/pepper_plugin_instance_impl.h5
4 files changed, 40 insertions, 51 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;
}
diff --git a/content/renderer/pepper/pepper_compositor_host.h b/content/renderer/pepper/pepper_compositor_host.h
index de2f72b..6d5a3ef 100644
--- a/content/renderer/pepper/pepper_compositor_host.h
+++ b/content/renderer/pepper/pepper_compositor_host.h
@@ -44,18 +44,17 @@ class PepperCompositorHost : public ppapi::host::ResourceHost {
private:
virtual ~PepperCompositorHost();
- void ImageReleased(int32_t id,
- const scoped_ptr<base::SharedMemory>& shared_memory,
- uint32_t sync_point,
- bool is_lost);
- void ResourceReleased(int32_t id,
- uint32_t sync_point,
- bool is_lost);
- void SendCommitLayersReplyIfNecessary();
void UpdateLayer(const scoped_refptr<cc::Layer>& layer,
const ppapi::CompositorLayerData* old_layer,
const ppapi::CompositorLayerData* new_layer,
scoped_ptr<base::SharedMemory> image_shm);
+ void ResourceReleased(int32_t id,
+ uint32_t sync_point,
+ bool is_lost);
+ void ImageReleased(int32_t id,
+ const scoped_ptr<base::SharedMemory>& shared_memory,
+ uint32_t sync_point,
+ bool is_lost);
// ResourceMessageHandler overrides:
virtual int32_t OnResourceMessageReceived(
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc
index 4aaad86..9aa3354 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -1877,7 +1877,7 @@ void PepperPluginInstanceImpl::UpdateFlashFullscreenState(
return;
}
- UpdateLayer(false);
+ UpdateLayer();
bool old_plugin_focus = PluginHasFocus();
flash_fullscreen_ = flash_fullscreen;
@@ -2016,7 +2016,7 @@ bool PepperPluginInstanceImpl::PrintPDFOutput(PP_Resource print_output,
#endif
}
-void PepperPluginInstanceImpl::UpdateLayer(bool device_changed) {
+void PepperPluginInstanceImpl::UpdateLayer() {
if (!container_)
return;
@@ -2031,8 +2031,7 @@ void PepperPluginInstanceImpl::UpdateLayer(bool device_changed) {
bool want_texture_layer = want_3d_layer || want_2d_layer;
bool want_compositor_layer = !!bound_compositor_;
- if (!device_changed &&
- (want_texture_layer == !!texture_layer_.get()) &&
+ if ((want_texture_layer == !!texture_layer_.get()) &&
(want_3d_layer == layer_is_hardware_) &&
(want_compositor_layer == !!compositor_layer_) &&
layer_bound_to_fullscreen_ == !!fullscreen_container_) {
@@ -2273,7 +2272,7 @@ PP_Bool PepperPluginInstanceImpl::BindGraphics(PP_Instance instance,
// Special-case clearing the current device.
if (!device) {
- UpdateLayer(true);
+ UpdateLayer();
InvalidateRect(gfx::Rect());
return PP_TRUE;
}
@@ -2309,13 +2308,13 @@ PP_Bool PepperPluginInstanceImpl::BindGraphics(PP_Instance instance,
if (compositor) {
if (compositor->BindToInstance(this)) {
bound_compositor_ = compositor;
- UpdateLayer(true);
+ UpdateLayer();
return PP_TRUE;
}
} else if (graphics_2d) {
if (graphics_2d->BindToInstance(this)) {
bound_graphics_2d_platform_ = graphics_2d;
- UpdateLayer(true);
+ UpdateLayer();
return PP_TRUE;
}
} else if (graphics_3d) {
@@ -2324,7 +2323,7 @@ PP_Bool PepperPluginInstanceImpl::BindGraphics(PP_Instance instance,
if (graphics_3d->pp_instance() == pp_instance() &&
graphics_3d->BindToInstance(true)) {
bound_graphics_3d_ = graphics_3d;
- UpdateLayer(true);
+ UpdateLayer();
return PP_TRUE;
}
}
@@ -3095,7 +3094,7 @@ bool PepperPluginInstanceImpl::FlashSetFullscreen(bool fullscreen,
DCHECK(!fullscreen_container_);
fullscreen_container_ =
render_frame_->CreatePepperFullscreenContainer(this);
- UpdateLayer(false);
+ UpdateLayer();
} else {
DCHECK(fullscreen_container_);
fullscreen_container_->Destroy();
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h
index ee66136..ea21418 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.h
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.h
@@ -635,10 +635,7 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
// - we are not in Flash full-screen mode (or transitioning to it)
// Otherwise it destroys the layer.
// It does either operation lazily.
- // device_changed: true if the bound device has been changed, and
- // UpdateLayer() will be forced to recreate the layer and attaches to the
- // container.
- void UpdateLayer(bool device_changed);
+ void UpdateLayer();
// Internal helper function for PrintPage().
bool PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges,