Index: content/renderer/pepper/pepper_plugin_instance_impl.cc |
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc |
index 49daf81eb43eb74139bcd78eb44888b8ff8fce0c..999ce74f617ffec6bf4c9a40e874905ace3b18f1 100644 |
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc |
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc |
@@ -6,6 +6,7 @@ |
#include "base/bind.h" |
#include "base/callback_helpers.h" |
+#include "base/command_line.h" |
#include "base/debug/trace_event.h" |
#include "base/logging.h" |
#include "base/memory/linked_ptr.h" |
@@ -17,6 +18,7 @@ |
#include "base/time/time.h" |
#include "cc/layers/texture_layer.h" |
#include "content/common/content_constants_internal.h" |
+#include "content/public/common/content_switches.h" |
#include "content/public/common/page_zoom.h" |
#include "content/public/renderer/content_renderer_client.h" |
#include "content/renderer/pepper/common.h" |
@@ -621,6 +623,8 @@ void PepperPluginInstanceImpl::InvalidateRect(const gfx::Rect& rect) { |
fullscreen_container_->Invalidate(); |
else |
fullscreen_container_->InvalidateRect(rect); |
+ if (software_texture_layer_) |
+ software_texture_layer_->SetNeedsDisplay(); |
} else { |
if (!container_ || |
view_data_.rect.size.width == 0 || view_data_.rect.size.height == 0) |
@@ -1665,9 +1669,7 @@ void PepperPluginInstanceImpl::UpdateFlashFullscreenState( |
return; |
} |
- PPB_Graphics3D_Impl* graphics_3d = bound_graphics_3d_.get(); |
- if (graphics_3d) |
- UpdateLayer(); |
+ UpdateLayer(); |
bool old_plugin_focus = PluginHasFocus(); |
flash_fullscreen_ = flash_fullscreen; |
@@ -1808,18 +1810,23 @@ void PepperPluginInstanceImpl::UpdateLayer() { |
context->GetBackingMailbox(&mailbox); |
} |
bool want_layer = !mailbox.IsZero(); |
+ bool want_2d_layer = |
+ !!fullscreen_container_ && CommandLine::ForCurrentProcess()->HasSwitch( |
piman
2013/09/05 00:19:43
Should we do this in the !fullscreen case too? Wit
|
+ switches::kEnableSoftwareCompositing); |
if (want_layer == !!texture_layer_.get() && |
+ (want_layer || (want_2d_layer == !!software_texture_layer_.get())) && |
layer_bound_to_fullscreen_ == !!fullscreen_container_) |
return; |
- if (texture_layer_.get()) { |
+ if (texture_layer_ || software_texture_layer_) { |
if (!layer_bound_to_fullscreen_) |
container_->setWebLayer(NULL); |
else if (fullscreen_container_) |
fullscreen_container_->SetLayer(NULL); |
web_layer_.reset(); |
texture_layer_ = NULL; |
+ software_texture_layer_ = NULL; |
} |
if (want_layer) { |
DCHECK(bound_graphics_3d_.get()); |
@@ -1837,10 +1844,33 @@ void PepperPluginInstanceImpl::UpdateLayer() { |
} |
texture_layer_->SetTextureMailbox( |
cc::TextureMailbox(mailbox, base::Bind(&IgnoreCallback), 0)); |
+ } else if (want_2d_layer) { |
+ software_texture_layer_ = cc::TextureLayer::CreateForMailbox(this); |
+ software_texture_layer_->SetContentsOpaque(true); |
+ web_layer_.reset(new webkit::WebLayerImpl(software_texture_layer_)); |
+ fullscreen_container_->SetLayer(web_layer_.get()); |
+ software_texture_layer_->SetIsDrawable(true); |
+ software_texture_layer_->SetFlipped(false); |
} |
layer_bound_to_fullscreen_ = !!fullscreen_container_; |
} |
+unsigned PepperPluginInstanceImpl::PrepareTexture() { |
+ return 0; |
+} |
+ |
+WebKit::WebGraphicsContext3D* PepperPluginInstanceImpl::Context3d() { |
+ return NULL; |
+} |
+ |
+bool PepperPluginInstanceImpl::PrepareTextureMailbox( |
+ cc::TextureMailbox* mailbox, |
+ bool use_shared_memory) { |
+ if (!bound_graphics_2d_platform_) |
+ return false; |
+ return bound_graphics_2d_platform_->PrepareTextureMailbox(mailbox); |
+} |
+ |
void PepperPluginInstanceImpl::AddPluginObject(PluginObject* plugin_object) { |
DCHECK(live_plugin_objects_.find(plugin_object) == |
live_plugin_objects_.end()); |