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

Side by Side Diff: content/renderer/child_frame_compositing_helper.cc

Issue 1783613004: CC Animation: Erase cc::LayerSettings everywhere. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@eraseandroid
Patch Set: Rebase. Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/child_frame_compositing_helper.h" 5 #include "content/renderer/child_frame_compositing_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "cc/blink/web_layer_impl.h" 9 #include "cc/blink/web_layer_impl.h"
10 #include "cc/layers/layer_settings.h"
11 #include "cc/layers/picture_image_layer.h" 10 #include "cc/layers/picture_image_layer.h"
12 #include "cc/layers/solid_color_layer.h" 11 #include "cc/layers/solid_color_layer.h"
13 #include "cc/layers/surface_layer.h" 12 #include "cc/layers/surface_layer.h"
14 #include "cc/output/context_provider.h" 13 #include "cc/output/context_provider.h"
15 #include "cc/output/copy_output_request.h" 14 #include "cc/output/copy_output_request.h"
16 #include "cc/output/copy_output_result.h" 15 #include "cc/output/copy_output_result.h"
17 #include "cc/resources/single_release_callback.h" 16 #include "cc/resources/single_release_callback.h"
18 #include "content/child/thread_safe_sender.h" 17 #include "content/child/thread_safe_sender.h"
19 #include "content/common/browser_plugin/browser_plugin_messages.h" 18 #include "content/common/browser_plugin/browser_plugin_messages.h"
20 #include "content/common/content_switches_internal.h" 19 #include "content/common/content_switches_internal.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 layer->SetBounds(device_scale_adjusted_size); 111 layer->SetBounds(device_scale_adjusted_size);
113 } 112 }
114 } 113 }
115 114
116 void ChildFrameCompositingHelper::OnContainerDestroy() { 115 void ChildFrameCompositingHelper::OnContainerDestroy() {
117 UpdateWebLayer(nullptr); 116 UpdateWebLayer(nullptr);
118 } 117 }
119 118
120 void ChildFrameCompositingHelper::ChildFrameGone() { 119 void ChildFrameCompositingHelper::ChildFrameGone() {
121 scoped_refptr<cc::SolidColorLayer> crashed_layer = 120 scoped_refptr<cc::SolidColorLayer> crashed_layer =
122 cc::SolidColorLayer::Create(cc::LayerSettings()); 121 cc::SolidColorLayer::Create();
123 crashed_layer->SetMasksToBounds(true); 122 crashed_layer->SetMasksToBounds(true);
124 crashed_layer->SetBackgroundColor(SK_ColorBLACK); 123 crashed_layer->SetBackgroundColor(SK_ColorBLACK);
125 124
126 if (web_layer_) { 125 if (web_layer_) {
127 SkBitmap* sad_bitmap = 126 SkBitmap* sad_bitmap =
128 GetContentClient()->renderer()->GetSadWebViewBitmap(); 127 GetContentClient()->renderer()->GetSadWebViewBitmap();
129 if (sad_bitmap && web_layer_->bounds().width > sad_bitmap->width() && 128 if (sad_bitmap && web_layer_->bounds().width > sad_bitmap->width() &&
130 web_layer_->bounds().height > sad_bitmap->height()) { 129 web_layer_->bounds().height > sad_bitmap->height()) {
131 scoped_refptr<cc::PictureImageLayer> sad_layer = 130 scoped_refptr<cc::PictureImageLayer> sad_layer =
132 cc::PictureImageLayer::Create(cc::LayerSettings()); 131 cc::PictureImageLayer::Create();
133 skia::RefPtr<SkImage> image = 132 skia::RefPtr<SkImage> image =
134 skia::AdoptRef(SkImage::NewFromBitmap(*sad_bitmap)); 133 skia::AdoptRef(SkImage::NewFromBitmap(*sad_bitmap));
135 sad_layer->SetImage(image); 134 sad_layer->SetImage(image);
136 sad_layer->SetBounds( 135 sad_layer->SetBounds(
137 gfx::Size(sad_bitmap->width(), sad_bitmap->height())); 136 gfx::Size(sad_bitmap->width(), sad_bitmap->height()));
138 sad_layer->SetPosition(gfx::PointF( 137 sad_layer->SetPosition(gfx::PointF(
139 (web_layer_->bounds().width - sad_bitmap->width()) / 2, 138 (web_layer_->bounds().width - sad_bitmap->width()) / 2,
140 (web_layer_->bounds().height - sad_bitmap->height()) / 2)); 139 (web_layer_->bounds().height - sad_bitmap->height()) / 2));
141 sad_layer->SetIsDrawable(true); 140 sad_layer->SetIsDrawable(true);
142 141
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 browser_plugin_->browser_plugin_instance_id()); 205 browser_plugin_->browser_plugin_instance_id());
207 cc::SurfaceLayer::RequireCallback require_callback = 206 cc::SurfaceLayer::RequireCallback require_callback =
208 render_frame_proxy_ 207 render_frame_proxy_
209 ? base::Bind(&ChildFrameCompositingHelper::RequireCallback, sender, 208 ? base::Bind(&ChildFrameCompositingHelper::RequireCallback, sender,
210 host_routing_id_) 209 host_routing_id_)
211 : base::Bind( 210 : base::Bind(
212 &ChildFrameCompositingHelper::RequireCallbackBrowserPlugin, 211 &ChildFrameCompositingHelper::RequireCallbackBrowserPlugin,
213 sender, host_routing_id_, 212 sender, host_routing_id_,
214 browser_plugin_->browser_plugin_instance_id()); 213 browser_plugin_->browser_plugin_instance_id());
215 scoped_refptr<cc::SurfaceLayer> surface_layer = 214 scoped_refptr<cc::SurfaceLayer> surface_layer =
216 cc::SurfaceLayer::Create(cc::LayerSettings(), 215 cc::SurfaceLayer::Create(satisfy_callback, require_callback);
217 satisfy_callback, require_callback);
218 // TODO(oshima): This is a stopgap fix so that the compositor does not 216 // TODO(oshima): This is a stopgap fix so that the compositor does not
219 // scaledown the content when 2x frame data is added to 1x parent frame data. 217 // scaledown the content when 2x frame data is added to 1x parent frame data.
220 // Fix this in cc/. 218 // Fix this in cc/.
221 if (IsUseZoomForDSFEnabled()) 219 if (IsUseZoomForDSFEnabled())
222 scale_factor = 1.0f; 220 scale_factor = 1.0f;
223 221
224 surface_layer->SetSurfaceId(surface_id, scale_factor, frame_size); 222 surface_layer->SetSurfaceId(surface_id, scale_factor, frame_size);
225 surface_layer->SetMasksToBounds(true); 223 surface_layer->SetMasksToBounds(true);
226 blink::WebLayer* layer = new cc_blink::WebLayerImpl(surface_layer); 224 blink::WebLayer* layer = new cc_blink::WebLayerImpl(surface_layer);
227 UpdateWebLayer(layer); 225 UpdateWebLayer(layer);
(...skipping 15 matching lines...) Expand all
243 frame_size, scale_factor, 241 frame_size, scale_factor,
244 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer()); 242 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer());
245 } 243 }
246 244
247 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { 245 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) {
248 if (web_layer_) 246 if (web_layer_)
249 web_layer_->setDrawsContent(visible); 247 web_layer_->setDrawsContent(visible);
250 } 248 }
251 249
252 } // namespace content 250 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698