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

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

Issue 1772393002: Frames received after guest detaches should be displayed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary variable. 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 200
201 void RenderWidgetHostViewGuest::SetTooltipText( 201 void RenderWidgetHostViewGuest::SetTooltipText(
202 const base::string16& tooltip_text) { 202 const base::string16& tooltip_text) {
203 if (guest_) 203 if (guest_)
204 guest_->SetTooltipText(tooltip_text); 204 guest_->SetTooltipText(tooltip_text);
205 } 205 }
206 206
207 void RenderWidgetHostViewGuest::OnSwapCompositorFrame( 207 void RenderWidgetHostViewGuest::OnSwapCompositorFrame(
208 uint32_t output_surface_id, 208 uint32_t output_surface_id,
209 scoped_ptr<cc::CompositorFrame> frame) { 209 scoped_ptr<cc::CompositorFrame> frame) {
210 if (!guest_ || !guest_->attached()) {
211 // We shouldn't hang on to a surface while we are detached.
212 ClearCompositorSurfaceIfNecessary();
213 return;
214 }
215
216 last_scroll_offset_ = frame->metadata.root_scroll_offset; 210 last_scroll_offset_ = frame->metadata.root_scroll_offset;
217 211
218 cc::RenderPass* root_pass = 212 cc::RenderPass* root_pass =
219 frame->delegated_frame_data->render_pass_list.back().get(); 213 frame->delegated_frame_data->render_pass_list.back().get();
220 214
221 gfx::Size frame_size = root_pass->output_rect.size(); 215 gfx::Size frame_size = root_pass->output_rect.size();
222 float scale_factor = frame->metadata.device_scale_factor; 216 float scale_factor = frame->metadata.device_scale_factor;
223 217
224 // Check whether we need to recreate the cc::Surface, which means the child 218 // Check whether we need to recreate the cc::Surface, which means the child
225 // frame renderer has changed its output surface, or size, or scale factor. 219 // frame renderer has changed its output surface, or size, or scale factor.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 cc::SurfaceFactory::DrawCallback ack_callback = base::Bind( 253 cc::SurfaceFactory::DrawCallback ack_callback = base::Bind(
260 &RenderWidgetHostViewChildFrame::SurfaceDrawn, 254 &RenderWidgetHostViewChildFrame::SurfaceDrawn,
261 RenderWidgetHostViewChildFrame::AsWeakPtr(), output_surface_id); 255 RenderWidgetHostViewChildFrame::AsWeakPtr(), output_surface_id);
262 ack_pending_count_++; 256 ack_pending_count_++;
263 // If this value grows very large, something is going wrong. 257 // If this value grows very large, something is going wrong.
264 DCHECK(ack_pending_count_ < 1000); 258 DCHECK(ack_pending_count_ < 1000);
265 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), 259 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame),
266 ack_callback); 260 ack_callback);
267 261
268 ProcessFrameSwappedCallbacks(); 262 ProcessFrameSwappedCallbacks();
263
264 // If after detaching we are sent a frame, we should finish processing it, and
265 // then we should clear the surface so that we are not holding resources we
266 // no longer need.
267 if (!guest_ || !guest_->attached())
268 ClearCompositorSurfaceIfNecessary();
269 } 269 }
270 270
271 bool RenderWidgetHostViewGuest::OnMessageReceived(const IPC::Message& msg) { 271 bool RenderWidgetHostViewGuest::OnMessageReceived(const IPC::Message& msg) {
272 if (!platform_view_) { 272 if (!platform_view_) {
273 // In theory, we can get here if there's a delay between DestroyGuestView() 273 // In theory, we can get here if there's a delay between DestroyGuestView()
274 // being called and when our destructor is invoked. 274 // being called and when our destructor is invoked.
275 return false; 275 return false;
276 } 276 }
277 277
278 return platform_view_->OnMessageReceived(msg); 278 return platform_view_->OnMessageReceived(msg);
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate && 628 if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate &&
629 gesture_event.data.scrollUpdate.inertial) { 629 gesture_event.data.scrollUpdate.inertial) {
630 return; 630 return;
631 } 631 }
632 host_->ForwardGestureEvent(gesture_event); 632 host_->ForwardGestureEvent(gesture_event);
633 return; 633 return;
634 } 634 }
635 } 635 }
636 636
637 } // namespace content 637 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698