| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 // static | 223 // static |
| 224 std::unique_ptr<cc::LayerTreeHost> RenderWidgetCompositor::CreateLayerTreeHost( | 224 std::unique_ptr<cc::LayerTreeHost> RenderWidgetCompositor::CreateLayerTreeHost( |
| 225 LayerTreeHostClient* client, | 225 LayerTreeHostClient* client, |
| 226 cc::LayerTreeHostSingleThreadClient* single_thread_client, | 226 cc::LayerTreeHostSingleThreadClient* single_thread_client, |
| 227 cc::MutatorHost* mutator_host, | 227 cc::MutatorHost* mutator_host, |
| 228 CompositorDependencies* deps, | 228 CompositorDependencies* deps, |
| 229 float device_scale_factor, | 229 float device_scale_factor, |
| 230 const ScreenInfo& screen_info) { | 230 const ScreenInfo& screen_info) { |
| 231 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 231 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 232 cc::LayerTreeSettings settings = | 232 cc::LayerTreeSettings settings = GenerateLayerTreeSettings( |
| 233 GenerateLayerTreeSettings(*cmd, deps, device_scale_factor, screen_info); | 233 *cmd, deps, device_scale_factor, client->IsForSubframe(), screen_info); |
| 234 | 234 |
| 235 const bool is_threaded = !!deps->GetCompositorImplThreadTaskRunner(); | 235 const bool is_threaded = !!deps->GetCompositorImplThreadTaskRunner(); |
| 236 | 236 |
| 237 std::unique_ptr<cc::LayerTreeHost> layer_tree_host; | 237 std::unique_ptr<cc::LayerTreeHost> layer_tree_host; |
| 238 | 238 |
| 239 cc::LayerTreeHost::InitParams params; | 239 cc::LayerTreeHost::InitParams params; |
| 240 params.client = client; | 240 params.client = client; |
| 241 params.settings = &settings; | 241 params.settings = &settings; |
| 242 params.task_graph_runner = deps->GetTaskGraphRunner(); | 242 params.task_graph_runner = deps->GetTaskGraphRunner(); |
| 243 params.main_task_runner = deps->GetCompositorMainThreadTaskRunner(); | 243 params.main_task_runner = deps->GetCompositorMainThreadTaskRunner(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 263 } | 263 } |
| 264 | 264 |
| 265 return layer_tree_host; | 265 return layer_tree_host; |
| 266 } | 266 } |
| 267 | 267 |
| 268 // static | 268 // static |
| 269 cc::LayerTreeSettings RenderWidgetCompositor::GenerateLayerTreeSettings( | 269 cc::LayerTreeSettings RenderWidgetCompositor::GenerateLayerTreeSettings( |
| 270 const base::CommandLine& cmd, | 270 const base::CommandLine& cmd, |
| 271 CompositorDependencies* compositor_deps, | 271 CompositorDependencies* compositor_deps, |
| 272 float device_scale_factor, | 272 float device_scale_factor, |
| 273 bool is_for_subframe, |
| 273 const ScreenInfo& screen_info) { | 274 const ScreenInfo& screen_info) { |
| 274 cc::LayerTreeSettings settings; | 275 cc::LayerTreeSettings settings; |
| 275 | 276 |
| 277 settings.is_layer_tree_for_subframe = is_for_subframe; |
| 278 |
| 276 // For web contents, layer transforms should scale up the contents of layers | 279 // For web contents, layer transforms should scale up the contents of layers |
| 277 // to keep content always crisp when possible. | 280 // to keep content always crisp when possible. |
| 278 settings.layer_transforms_should_scale_layer_contents = true; | 281 settings.layer_transforms_should_scale_layer_contents = true; |
| 279 | 282 |
| 280 settings.main_frame_before_activation_enabled = | 283 settings.main_frame_before_activation_enabled = |
| 281 cmd.HasSwitch(cc::switches::kEnableMainFrameBeforeActivation); | 284 cmd.HasSwitch(cc::switches::kEnableMainFrameBeforeActivation); |
| 282 | 285 |
| 283 settings.enable_checker_imaging = | 286 settings.enable_checker_imaging = |
| 284 cmd.HasSwitch(cc::switches::kEnableCheckerImaging); | 287 cmd.HasSwitch(cc::switches::kEnableCheckerImaging); |
| 285 | 288 |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 } | 1113 } |
| 1111 | 1114 |
| 1112 void RenderWidgetCompositor::DidReceiveCompositorFrameAck() { | 1115 void RenderWidgetCompositor::DidReceiveCompositorFrameAck() { |
| 1113 delegate_->DidReceiveCompositorFrameAck(); | 1116 delegate_->DidReceiveCompositorFrameAck(); |
| 1114 } | 1117 } |
| 1115 | 1118 |
| 1116 void RenderWidgetCompositor::DidCompletePageScaleAnimation() { | 1119 void RenderWidgetCompositor::DidCompletePageScaleAnimation() { |
| 1117 delegate_->DidCompletePageScaleAnimation(); | 1120 delegate_->DidCompletePageScaleAnimation(); |
| 1118 } | 1121 } |
| 1119 | 1122 |
| 1123 bool RenderWidgetCompositor::IsForSubframe() { |
| 1124 return is_for_oopif_; |
| 1125 } |
| 1126 |
| 1120 void RenderWidgetCompositor::RequestScheduleAnimation() { | 1127 void RenderWidgetCompositor::RequestScheduleAnimation() { |
| 1121 delegate_->RequestScheduleAnimation(); | 1128 delegate_->RequestScheduleAnimation(); |
| 1122 } | 1129 } |
| 1123 | 1130 |
| 1124 void RenderWidgetCompositor::DidSubmitCompositorFrame() {} | 1131 void RenderWidgetCompositor::DidSubmitCompositorFrame() {} |
| 1125 | 1132 |
| 1126 void RenderWidgetCompositor::DidLoseCompositorFrameSink() {} | 1133 void RenderWidgetCompositor::DidLoseCompositorFrameSink() {} |
| 1127 | 1134 |
| 1128 void RenderWidgetCompositor::SetFrameSinkId( | 1135 void RenderWidgetCompositor::SetFrameSinkId( |
| 1129 const cc::FrameSinkId& frame_sink_id) { | 1136 const cc::FrameSinkId& frame_sink_id) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1147 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) { | 1154 void RenderWidgetCompositor::SetContentSourceId(uint32_t id) { |
| 1148 layer_tree_host_->SetContentSourceId(id); | 1155 layer_tree_host_->SetContentSourceId(id); |
| 1149 } | 1156 } |
| 1150 | 1157 |
| 1151 void RenderWidgetCompositor::SetLocalSurfaceId( | 1158 void RenderWidgetCompositor::SetLocalSurfaceId( |
| 1152 const cc::LocalSurfaceId& local_surface_id) { | 1159 const cc::LocalSurfaceId& local_surface_id) { |
| 1153 layer_tree_host_->SetLocalSurfaceId(local_surface_id); | 1160 layer_tree_host_->SetLocalSurfaceId(local_surface_id); |
| 1154 } | 1161 } |
| 1155 | 1162 |
| 1156 } // namespace content | 1163 } // namespace content |
| OLD | NEW |