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

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

Issue 1101823002: CC Animations: Make LayerAnimationController creation optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Plumb LayerSettings parameter for cc::Layer construction. Created 5 years, 7 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 d366db4bff7d7f4a63870a1253f93e6c35633d7c..ac1cfeabe2d1318a365bed154a00240e16fc692f 100644
--- a/content/renderer/pepper/pepper_compositor_host.cc
+++ b/content/renderer/pepper/pepper_compositor_host.cc
@@ -145,6 +145,8 @@ int32_t VerifyCommittedLayer(
return PP_ERROR_BADARGUMENT;
}
+cc::LayerSettings g_pepper_layer_settings;
+
} // namespace
PepperCompositorHost::LayerData::LayerData(
@@ -160,7 +162,7 @@ PepperCompositorHost::PepperCompositorHost(
: ResourceHost(host->GetPpapiHost(), instance, resource),
bound_instance_(NULL),
weak_factory_(this) {
- layer_ = cc::Layer::Create();
+ layer_ = cc::Layer::Create(PepperLayerSettings());
// TODO(penghuang): SetMasksToBounds() can be expensive if the layer is
// transformed. Possibly better could be to explicitly clip the child layers
// (by modifying their bounds).
@@ -174,6 +176,17 @@ PepperCompositorHost::~PepperCompositorHost() {
bound_instance_->BindGraphics(bound_instance_->pp_instance(), 0);
}
+// static
+const cc::LayerSettings& PepperCompositorHost::PepperLayerSettings() {
+ return g_pepper_layer_settings;
+}
+
+// static
+void PepperCompositorHost::SetPepperLayerSettings(
+ const cc::LayerSettings& settings) {
+ g_pepper_layer_settings = settings;
+}
+
bool PepperCompositorHost::BindToInstance(
PepperPluginInstanceImpl* new_instance) {
if (new_instance && new_instance->pp_instance() != pp_instance())
@@ -247,7 +260,7 @@ void PepperCompositorHost::UpdateLayer(
scoped_refptr<cc::Layer> clip_parent = layer->parent();
if (clip_parent.get() == layer_.get()) {
// Create a clip parent layer, if it does not exist.
- clip_parent = cc::Layer::Create();
+ clip_parent = cc::Layer::Create(PepperLayerSettings());
clip_parent->SetMasksToBounds(true);
clip_parent->SetIsDrawable(true);
layer_->ReplaceChild(layer.get(), clip_parent);
@@ -389,9 +402,10 @@ int32_t PepperCompositorHost::OnHostMsgCommitLayers(
if (!cc_layer.get()) {
if (pp_layer->color)
- cc_layer = cc::SolidColorLayer::Create();
+ cc_layer = cc::SolidColorLayer::Create(PepperLayerSettings());
else if (pp_layer->texture || pp_layer->image)
- cc_layer = cc::TextureLayer::CreateForMailbox(NULL);
+ cc_layer =
+ cc::TextureLayer::CreateForMailbox(PepperLayerSettings(), NULL);
layer_->AddChild(cc_layer);
}

Powered by Google App Engine
This is Rietveld 408576698