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

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

Issue 1545243002: Convert Pass()→std::move() in //content/browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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"
6
7 #include <utility>
8
5 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
6 #include "base/command_line.h" 10 #include "base/command_line.h"
7 #include "base/logging.h" 11 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
9 #include "build/build_config.h" 13 #include "build/build_config.h"
10 #include "cc/surfaces/surface.h" 14 #include "cc/surfaces/surface.h"
11 #include "cc/surfaces/surface_factory.h" 15 #include "cc/surfaces/surface_factory.h"
12 #include "cc/surfaces/surface_manager.h" 16 #include "cc/surfaces/surface_manager.h"
13 #include "cc/surfaces/surface_sequence.h" 17 #include "cc/surfaces/surface_sequence.h"
14 #include "content/browser/browser_plugin/browser_plugin_guest.h" 18 #include "content/browser/browser_plugin/browser_plugin_guest.h"
15 #include "content/browser/compositor/surface_utils.h" 19 #include "content/browser/compositor/surface_utils.h"
16 #include "content/browser/frame_host/render_widget_host_view_guest.h"
17 #include "content/browser/renderer_host/render_view_host_impl.h" 20 #include "content/browser/renderer_host/render_view_host_impl.h"
18 #include "content/browser/renderer_host/render_widget_host_delegate.h" 21 #include "content/browser/renderer_host/render_widget_host_delegate.h"
19 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" 22 #include "content/browser/renderer_host/render_widget_host_input_event_router.h"
20 #include "content/common/browser_plugin/browser_plugin_messages.h" 23 #include "content/common/browser_plugin/browser_plugin_messages.h"
21 #include "content/common/frame_messages.h" 24 #include "content/common/frame_messages.h"
22 #include "content/common/gpu/gpu_messages.h" 25 #include "content/common/gpu/gpu_messages.h"
23 #include "content/common/input/web_touch_event_traits.h" 26 #include "content/common/input/web_touch_event_traits.h"
24 #include "content/common/view_messages.h" 27 #include "content/common/view_messages.h"
25 #include "content/common/webplugin_geometry.h" 28 #include "content/common/webplugin_geometry.h"
26 #include "content/public/common/content_switches.h" 29 #include "content/public/common/content_switches.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 if (!guest_ || !guest_->attached()) { 237 if (!guest_ || !guest_->attached()) {
235 // We shouldn't hang on to a surface while we are detached. 238 // We shouldn't hang on to a surface while we are detached.
236 ClearCompositorSurfaceIfNecessary(); 239 ClearCompositorSurfaceIfNecessary();
237 return; 240 return;
238 } 241 }
239 242
240 last_scroll_offset_ = frame->metadata.root_scroll_offset; 243 last_scroll_offset_ = frame->metadata.root_scroll_offset;
241 // When not using surfaces, the frame just gets proxied to 244 // When not using surfaces, the frame just gets proxied to
242 // the embedder's renderer to be composited. 245 // the embedder's renderer to be composited.
243 if (!frame->delegated_frame_data || !use_surfaces_) { 246 if (!frame->delegated_frame_data || !use_surfaces_) {
244 guest_->SwapCompositorFrame(output_surface_id, 247 guest_->SwapCompositorFrame(output_surface_id, host_->GetProcess()->GetID(),
245 host_->GetProcess()->GetID(), 248 host_->GetRoutingID(), std::move(frame));
246 host_->GetRoutingID(),
247 frame.Pass());
248 return; 249 return;
249 } 250 }
250 251
251 cc::RenderPass* root_pass = 252 cc::RenderPass* root_pass =
252 frame->delegated_frame_data->render_pass_list.back().get(); 253 frame->delegated_frame_data->render_pass_list.back().get();
253 254
254 gfx::Size frame_size = root_pass->output_rect.size(); 255 gfx::Size frame_size = root_pass->output_rect.size();
255 float scale_factor = frame->metadata.device_scale_factor; 256 float scale_factor = frame->metadata.device_scale_factor;
256 257
257 // Check whether we need to recreate the cc::Surface, which means the child 258 // Check whether we need to recreate the cc::Surface, which means the child
(...skipping 30 matching lines...) Expand all
288 guest_->SetChildFrameSurface(surface_id_, frame_size, scale_factor, 289 guest_->SetChildFrameSurface(surface_id_, frame_size, scale_factor,
289 sequence); 290 sequence);
290 } 291 }
291 292
292 cc::SurfaceFactory::DrawCallback ack_callback = base::Bind( 293 cc::SurfaceFactory::DrawCallback ack_callback = base::Bind(
293 &RenderWidgetHostViewChildFrame::SurfaceDrawn, 294 &RenderWidgetHostViewChildFrame::SurfaceDrawn,
294 RenderWidgetHostViewChildFrame::AsWeakPtr(), output_surface_id); 295 RenderWidgetHostViewChildFrame::AsWeakPtr(), output_surface_id);
295 ack_pending_count_++; 296 ack_pending_count_++;
296 // If this value grows very large, something is going wrong. 297 // If this value grows very large, something is going wrong.
297 DCHECK(ack_pending_count_ < 1000); 298 DCHECK(ack_pending_count_ < 1000);
298 surface_factory_->SubmitCompositorFrame(surface_id_, frame.Pass(), 299 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame),
299 ack_callback); 300 ack_callback);
300 } 301 }
301 302
302 bool RenderWidgetHostViewGuest::OnMessageReceived(const IPC::Message& msg) { 303 bool RenderWidgetHostViewGuest::OnMessageReceived(const IPC::Message& msg) {
303 if (!platform_view_) { 304 if (!platform_view_) {
304 // In theory, we can get here if there's a delay between DestroyGuestView() 305 // In theory, we can get here if there's a delay between DestroyGuestView()
305 // being called and when our destructor is invoked. 306 // being called and when our destructor is invoked.
306 return false; 307 return false;
307 } 308 }
308 309
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate && 703 if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate &&
703 gesture_event.data.scrollUpdate.inertial) { 704 gesture_event.data.scrollUpdate.inertial) {
704 return; 705 return;
705 } 706 }
706 host_->ForwardGestureEvent(gesture_event); 707 host_->ForwardGestureEvent(gesture_event);
707 return; 708 return;
708 } 709 }
709 } 710 }
710 711
711 } // namespace content 712 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698