OLD | NEW |
---|---|
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/browser/frame_host/render_widget_host_view_guest.h" | 5 #include "content/browser/frame_host/render_widget_host_view_guest.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 | 281 |
282 cc::RenderPass* root_pass = frame.render_pass_list.back().get(); | 282 cc::RenderPass* root_pass = frame.render_pass_list.back().get(); |
283 | 283 |
284 gfx::Size frame_size = root_pass->output_rect.size(); | 284 gfx::Size frame_size = root_pass->output_rect.size(); |
285 float scale_factor = frame.metadata.device_scale_factor; | 285 float scale_factor = frame.metadata.device_scale_factor; |
286 | 286 |
287 // Check whether we need to recreate the cc::Surface, which means the child | 287 // Check whether we need to recreate the cc::Surface, which means the child |
288 // frame renderer has changed its output surface, or size, or scale factor. | 288 // frame renderer has changed its output surface, or size, or scale factor. |
289 if (compositor_frame_sink_id != last_compositor_frame_sink_id_ && | 289 if (compositor_frame_sink_id != last_compositor_frame_sink_id_ && |
290 surface_factory_) { | 290 surface_factory_) { |
291 surface_factory_->Destroy(local_frame_id_); | |
292 surface_factory_.reset(); | 291 surface_factory_.reset(); |
293 } | 292 } |
294 if (compositor_frame_sink_id != last_compositor_frame_sink_id_ || | 293 if (compositor_frame_sink_id != last_compositor_frame_sink_id_ || |
295 frame_size != current_surface_size_ || | 294 frame_size != current_surface_size_ || |
296 scale_factor != current_surface_scale_factor_ || | 295 scale_factor != current_surface_scale_factor_ || |
297 (guest_ && guest_->has_attached_since_surface_set())) { | 296 (guest_ && guest_->has_attached_since_surface_set())) { |
298 ClearCompositorSurfaceIfNecessary(); | 297 ClearCompositorSurfaceIfNecessary(); |
299 last_compositor_frame_sink_id_ = compositor_frame_sink_id; | 298 last_compositor_frame_sink_id_ = compositor_frame_sink_id; |
300 current_surface_size_ = frame_size; | 299 current_surface_size_ = frame_size; |
301 current_surface_scale_factor_ = scale_factor; | 300 current_surface_scale_factor_ = scale_factor; |
302 } | 301 } |
303 | 302 |
304 if (!surface_factory_) { | 303 if (!surface_factory_) { |
305 cc::SurfaceManager* manager = GetSurfaceManager(); | 304 cc::SurfaceManager* manager = GetSurfaceManager(); |
306 surface_factory_ = | 305 surface_factory_ = |
307 base::MakeUnique<cc::SurfaceFactory>(frame_sink_id_, manager, this); | 306 base::MakeUnique<cc::SurfaceFactory>(frame_sink_id_, manager, this); |
308 } | 307 } |
309 | 308 |
310 if (local_frame_id_.is_null()) { | 309 if (local_frame_id_.is_null()) { |
311 local_frame_id_ = id_allocator_->GenerateId(); | 310 local_frame_id_ = id_allocator_->GenerateId(); |
312 surface_factory_->Create(local_frame_id_); | 311 surface_factory_->SubmitCompositorFrame(local_frame_id_, |
Fady Samuel
2016/11/08 22:23:59
I don't think this approach is correct. We shouldn
Saman Sami
2016/11/11 17:49:58
Done.
| |
312 cc::CompositorFrame(), | |
313 cc::SurfaceFactory::DrawCallback()); | |
313 | 314 |
314 cc::SurfaceSequence sequence = | 315 cc::SurfaceSequence sequence = |
315 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); | 316 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); |
316 // The renderer process will satisfy this dependency when it creates a | 317 // The renderer process will satisfy this dependency when it creates a |
317 // SurfaceLayer. | 318 // SurfaceLayer. |
318 cc::SurfaceManager* manager = GetSurfaceManager(); | 319 cc::SurfaceManager* manager = GetSurfaceManager(); |
319 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); | 320 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); |
320 manager->GetSurfaceForId(surface_id)->AddDestructionDependency(sequence); | 321 manager->GetSurfaceForId(surface_id)->AddDestructionDependency(sequence); |
321 // TODO(wjmaclean): I'm not sure what it means to create a surface id | 322 // TODO(wjmaclean): I'm not sure what it means to create a surface id |
322 // without setting it on the child, though since we will in this case be | 323 // without setting it on the child, though since we will in this case be |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
688 gesture_event.data.scrollUpdate.inertialPhase == | 689 gesture_event.data.scrollUpdate.inertialPhase == |
689 blink::WebGestureEvent::MomentumPhase) { | 690 blink::WebGestureEvent::MomentumPhase) { |
690 return; | 691 return; |
691 } | 692 } |
692 host_->ForwardGestureEvent(gesture_event); | 693 host_->ForwardGestureEvent(gesture_event); |
693 return; | 694 return; |
694 } | 695 } |
695 } | 696 } |
696 | 697 |
697 } // namespace content | 698 } // namespace content |
OLD | NEW |