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

Side by Side Diff: content/renderer/render_widget.cc

Issue 2730203002: Revert of Discard compositor frames from unloaded web content (Closed)
Patch Set: Created 3 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 | « content/renderer/render_widget.h ('k') | content/test/test_render_view_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 resizing_mode_selector_(new ResizingModeSelector()), 371 resizing_mode_selector_(new ResizingModeSelector()),
372 has_host_context_menu_location_(false), 372 has_host_context_menu_location_(false),
373 has_added_input_handler_(false), 373 has_added_input_handler_(false),
374 has_focus_(false), 374 has_focus_(false),
375 #if defined(OS_MACOSX) 375 #if defined(OS_MACOSX)
376 text_input_client_observer_(new TextInputClientObserver(this)), 376 text_input_client_observer_(new TextInputClientObserver(this)),
377 #endif 377 #endif
378 focused_pepper_plugin_(nullptr), 378 focused_pepper_plugin_(nullptr),
379 time_to_first_active_paint_recorded_(true), 379 time_to_first_active_paint_recorded_(true),
380 was_shown_time_(base::TimeTicks::Now()), 380 was_shown_time_(base::TimeTicks::Now()),
381 current_content_source_id_(0),
382 weak_ptr_factory_(this) { 381 weak_ptr_factory_(this) {
383 DCHECK_NE(routing_id_, MSG_ROUTING_NONE); 382 DCHECK_NE(routing_id_, MSG_ROUTING_NONE);
384 if (!swapped_out) 383 if (!swapped_out)
385 RenderProcess::current()->AddRefProcess(); 384 RenderProcess::current()->AddRefProcess();
386 DCHECK(RenderThread::Get()); 385 DCHECK(RenderThread::Get());
387 386
388 // In tests there may not be a RenderThreadImpl. 387 // In tests there may not be a RenderThreadImpl.
389 if (RenderThreadImpl::current()) { 388 if (RenderThreadImpl::current()) {
390 render_widget_scheduling_state_ = RenderThreadImpl::current() 389 render_widget_scheduling_state_ = RenderThreadImpl::current()
391 ->GetRendererScheduler() 390 ->GetRendererScheduler()
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 auto layer_tree_host = RenderWidgetCompositor::CreateLayerTreeHost( 1279 auto layer_tree_host = RenderWidgetCompositor::CreateLayerTreeHost(
1281 compositor_.get(), compositor_.get(), animation_host.get(), 1280 compositor_.get(), compositor_.get(), animation_host.get(),
1282 compositor_deps_, device_scale_factor_, screen_info_); 1281 compositor_deps_, device_scale_factor_, screen_info_);
1283 compositor_->Initialize(std::move(layer_tree_host), 1282 compositor_->Initialize(std::move(layer_tree_host),
1284 std::move(animation_host)); 1283 std::move(animation_host));
1285 1284
1286 compositor_->SetIsForOopif(for_oopif_); 1285 compositor_->SetIsForOopif(for_oopif_);
1287 compositor_->setViewportSize(physical_backing_size_); 1286 compositor_->setViewportSize(physical_backing_size_);
1288 OnDeviceScaleFactorChanged(); 1287 OnDeviceScaleFactorChanged();
1289 compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace()); 1288 compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace());
1290 compositor_->SetContentSourceId(current_content_source_id_);
1291 // For background pages and certain tests, we don't want to trigger 1289 // For background pages and certain tests, we don't want to trigger
1292 // CompositorFrameSink creation. 1290 // CompositorFrameSink creation.
1293 if (compositor_never_visible_ || !RenderThreadImpl::current()) 1291 if (compositor_never_visible_ || !RenderThreadImpl::current())
1294 compositor_->SetNeverVisible(); 1292 compositor_->SetNeverVisible();
1295 1293
1296 StartCompositor(); 1294 StartCompositor();
1297 DCHECK_NE(MSG_ROUTING_NONE, routing_id_); 1295 DCHECK_NE(MSG_ROUTING_NONE, routing_id_);
1298 compositor_->SetFrameSinkId( 1296 compositor_->SetFrameSinkId(
1299 cc::FrameSinkId(RenderThread::Get()->GetClientId(), routing_id_)); 1297 cc::FrameSinkId(RenderThread::Get()->GetClientId(), routing_id_));
1300 1298
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
2295 blink::WebRect offset_in_window(webImageOffset.x, webImageOffset.y, 0, 0); 2293 blink::WebRect offset_in_window(webImageOffset.x, webImageOffset.y, 0, 0);
2296 convertViewportToWindow(&offset_in_window); 2294 convertViewportToWindow(&offset_in_window);
2297 DropData drop_data(DropDataBuilder::Build(data)); 2295 DropData drop_data(DropDataBuilder::Build(data));
2298 drop_data.referrer_policy = policy; 2296 drop_data.referrer_policy = policy;
2299 gfx::Vector2d imageOffset(offset_in_window.x, offset_in_window.y); 2297 gfx::Vector2d imageOffset(offset_in_window.x, offset_in_window.y);
2300 Send(new DragHostMsg_StartDragging(routing_id(), drop_data, mask, 2298 Send(new DragHostMsg_StartDragging(routing_id(), drop_data, mask,
2301 image.getSkBitmap(), imageOffset, 2299 image.getSkBitmap(), imageOffset,
2302 possible_drag_event_info_)); 2300 possible_drag_event_info_));
2303 } 2301 }
2304 2302
2305 uint32_t RenderWidget::GetContentSourceId() {
2306 return current_content_source_id_;
2307 }
2308
2309 void RenderWidget::IncrementContentSourceId() {
2310 if (compositor_)
2311 compositor_->SetContentSourceId(++current_content_source_id_);
2312 }
2313
2314 blink::WebWidget* RenderWidget::GetWebWidget() const { 2303 blink::WebWidget* RenderWidget::GetWebWidget() const {
2315 return webwidget_internal_; 2304 return webwidget_internal_;
2316 } 2305 }
2317 2306
2318 blink::WebInputMethodController* RenderWidget::GetInputMethodController() 2307 blink::WebInputMethodController* RenderWidget::GetInputMethodController()
2319 const { 2308 const {
2320 if (!GetWebWidget()->isWebFrameWidget()) { 2309 if (!GetWebWidget()->isWebFrameWidget()) {
2321 // TODO(ekaramad): We should not get here in response to IME IPC or updates 2310 // TODO(ekaramad): We should not get here in response to IME IPC or updates
2322 // when the RenderWidget is swapped out. We should top sending IPCs from the 2311 // when the RenderWidget is swapped out. We should top sending IPCs from the
2323 // browser side (https://crbug.com/669219). 2312 // browser side (https://crbug.com/669219).
2324 // If there is no WebFrameWidget, then there will be no 2313 // If there is no WebFrameWidget, then there will be no
2325 // InputMethodControllers for a WebLocalFrame. 2314 // InputMethodControllers for a WebLocalFrame.
2326 return nullptr; 2315 return nullptr;
2327 } 2316 }
2328 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) 2317 return static_cast<blink::WebFrameWidget*>(GetWebWidget())
2329 ->getActiveWebInputMethodController(); 2318 ->getActiveWebInputMethodController();
2330 } 2319 }
2331 2320
2332 } // namespace content 2321 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/test/test_render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698