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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_guest.cc

Issue 2383373002: Reduce SurfaceIdAllocator usage and tie SurfaceFactory to a single FrameSinkId (Closed)
Patch Set: Rebased Created 4 years, 2 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/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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // Make sure the size of this view matches the size of the WebContentsView. 106 // Make sure the size of this view matches the size of the WebContentsView.
107 // The two sizes may fall out of sync if we switch RenderWidgetHostViews, 107 // The two sizes may fall out of sync if we switch RenderWidgetHostViews,
108 // resize, and then switch page, as is the case with interstitial pages. 108 // resize, and then switch page, as is the case with interstitial pages.
109 // NOTE: |guest_| is NULL in unit tests. 109 // NOTE: |guest_| is NULL in unit tests.
110 if (guest_) { 110 if (guest_) {
111 SetSize(guest_->web_contents()->GetViewBounds().size()); 111 SetSize(guest_->web_contents()->GetViewBounds().size());
112 // Since we were last shown, our renderer may have had a different surface 112 // Since we were last shown, our renderer may have had a different surface
113 // set (e.g. showing an interstitial), so we resend our current surface to 113 // set (e.g. showing an interstitial), so we resend our current surface to
114 // the renderer. 114 // the renderer.
115 if (!surface_id_.is_null()) { 115 if (!surface_id_.is_null()) {
116 cc::SurfaceSequence sequence = cc::SurfaceSequence( 116 cc::SurfaceSequence sequence =
117 id_allocator_->frame_sink_id(), next_surface_sequence_++); 117 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++);
118 GetSurfaceManager() 118 GetSurfaceManager()
119 ->GetSurfaceForId(surface_id_) 119 ->GetSurfaceForId(surface_id_)
120 ->AddDestructionDependency(sequence); 120 ->AddDestructionDependency(sequence);
121 guest_->SetChildFrameSurface(surface_id_, current_surface_size_, 121 guest_->SetChildFrameSurface(surface_id_, current_surface_size_,
122 current_surface_scale_factor_, 122 current_surface_scale_factor_,
123 sequence); 123 sequence);
124 } 124 }
125 } 125 }
126 host_->WasShown(ui::LatencyInfo()); 126 host_->WasShown(ui::LatencyInfo());
127 } 127 }
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 scale_factor != current_surface_scale_factor_ || 286 scale_factor != current_surface_scale_factor_ ||
287 (guest_ && guest_->has_attached_since_surface_set())) { 287 (guest_ && guest_->has_attached_since_surface_set())) {
288 ClearCompositorSurfaceIfNecessary(); 288 ClearCompositorSurfaceIfNecessary();
289 last_compositor_frame_sink_id_ = compositor_frame_sink_id; 289 last_compositor_frame_sink_id_ = compositor_frame_sink_id;
290 current_surface_size_ = frame_size; 290 current_surface_size_ = frame_size;
291 current_surface_scale_factor_ = scale_factor; 291 current_surface_scale_factor_ = scale_factor;
292 } 292 }
293 293
294 if (!surface_factory_) { 294 if (!surface_factory_) {
295 cc::SurfaceManager* manager = GetSurfaceManager(); 295 cc::SurfaceManager* manager = GetSurfaceManager();
296 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>(manager, this); 296 surface_factory_ =
297 base::MakeUnique<cc::SurfaceFactory>(frame_sink_id_, manager, this);
297 } 298 }
298 299
299 if (surface_id_.is_null()) { 300 if (surface_id_.is_null()) {
300 surface_id_ = id_allocator_->GenerateId(); 301 surface_id_ = id_allocator_->GenerateId();
301 surface_factory_->Create(surface_id_); 302 surface_factory_->Create(surface_id_);
302 303
303 cc::SurfaceSequence sequence = cc::SurfaceSequence( 304 cc::SurfaceSequence sequence =
304 id_allocator_->frame_sink_id(), next_surface_sequence_++); 305 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++);
305 // The renderer process will satisfy this dependency when it creates a 306 // The renderer process will satisfy this dependency when it creates a
306 // SurfaceLayer. 307 // SurfaceLayer.
307 cc::SurfaceManager* manager = GetSurfaceManager(); 308 cc::SurfaceManager* manager = GetSurfaceManager();
308 manager->GetSurfaceForId(surface_id_)->AddDestructionDependency(sequence); 309 manager->GetSurfaceForId(surface_id_)->AddDestructionDependency(sequence);
309 // TODO(wjmaclean): I'm not sure what it means to create a surface id 310 // TODO(wjmaclean): I'm not sure what it means to create a surface id
310 // without setting it on the child, though since we will in this case be 311 // without setting it on the child, though since we will in this case be
311 // guaranteed to call ClearCompositorSurfaceIfNecessary() below, I suspect 312 // guaranteed to call ClearCompositorSurfaceIfNecessary() below, I suspect
312 // skipping SetChildFrameSurface() here is irrelevant. 313 // skipping SetChildFrameSurface() here is irrelevant.
313 if (guest_ && !guest_->is_in_destruction()) { 314 if (guest_ && !guest_->is_in_destruction()) {
314 guest_->SetChildFrameSurface(surface_id_, frame_size, scale_factor, 315 guest_->SetChildFrameSurface(surface_id_, frame_size, scale_factor,
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 gesture_event.data.scrollUpdate.inertialPhase == 677 gesture_event.data.scrollUpdate.inertialPhase ==
677 blink::WebGestureEvent::MomentumPhase) { 678 blink::WebGestureEvent::MomentumPhase) {
678 return; 679 return;
679 } 680 }
680 host_->ForwardGestureEvent(gesture_event); 681 host_->ForwardGestureEvent(gesture_event);
681 return; 682 return;
682 } 683 }
683 } 684 }
684 685
685 } // namespace content 686 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698