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

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

Issue 1385043002: cc: Remove SetLayerTreeHostClientReady() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@startcomp
Patch Set: sky's offline comment Created 5 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
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/test/web_layer_tree_view_impl_for_testing.cc » ('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 "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 compositor_deps_(compositor_deps), 485 compositor_deps_(compositor_deps),
486 webwidget_(nullptr), 486 webwidget_(nullptr),
487 opener_id_(MSG_ROUTING_NONE), 487 opener_id_(MSG_ROUTING_NONE),
488 top_controls_shrink_blink_size_(false), 488 top_controls_shrink_blink_size_(false),
489 top_controls_height_(0.f), 489 top_controls_height_(0.f),
490 next_paint_flags_(0), 490 next_paint_flags_(0),
491 auto_resize_mode_(false), 491 auto_resize_mode_(false),
492 need_update_rect_for_auto_resize_(false), 492 need_update_rect_for_auto_resize_(false),
493 did_show_(false), 493 did_show_(false),
494 is_hidden_(hidden), 494 is_hidden_(hidden),
495 never_visible_(never_visible), 495 compositor_never_visible_(never_visible),
496 is_fullscreen_granted_(false), 496 is_fullscreen_granted_(false),
497 display_mode_(blink::WebDisplayModeUndefined), 497 display_mode_(blink::WebDisplayModeUndefined),
498 has_focus_(false), 498 has_focus_(false),
499 handling_input_event_(false), 499 handling_input_event_(false),
500 handling_event_overscroll_(nullptr), 500 handling_event_overscroll_(nullptr),
501 handling_ime_event_(false), 501 handling_ime_event_(false),
502 handling_event_type_(WebInputEvent::Undefined), 502 handling_event_type_(WebInputEvent::Undefined),
503 ignore_ack_for_mouse_move_from_debugger_(false), 503 ignore_ack_for_mouse_move_from_debugger_(false),
504 closing_(false), 504 closing_(false),
505 host_closing_(false), 505 host_closing_(false),
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 pending_window_rect_count_--; 960 pending_window_rect_count_--;
961 } 961 }
962 962
963 GURL RenderWidget::GetURLForGraphicsContext3D() { 963 GURL RenderWidget::GetURLForGraphicsContext3D() {
964 return GURL(); 964 return GURL();
965 } 965 }
966 966
967 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) { 967 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) {
968 // For widgets that are never visible, we don't start the compositor, so we 968 // For widgets that are never visible, we don't start the compositor, so we
969 // never get a request for a cc::OutputSurface. 969 // never get a request for a cc::OutputSurface.
970 DCHECK(!never_visible_); 970 DCHECK(!compositor_never_visible_);
971 971
972 #if defined(OS_ANDROID) 972 #if defined(OS_ANDROID)
973 if (SynchronousCompositorFactory* factory = 973 if (SynchronousCompositorFactory* factory =
974 SynchronousCompositorFactory::GetInstance()) { 974 SynchronousCompositorFactory::GetInstance()) {
975 return factory->CreateOutputSurface(routing_id(), 975 return factory->CreateOutputSurface(routing_id(),
976 frame_swap_message_queue_); 976 frame_swap_message_queue_);
977 } 977 }
978 #endif 978 #endif
979 979
980 const base::CommandLine& command_line = 980 const base::CommandLine& command_line =
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 physical_backing_size_ = gfx::ScaleToCeiledSize(size_, device_scale_factor_); 1332 physical_backing_size_ = gfx::ScaleToCeiledSize(size_, device_scale_factor_);
1333 if (compositor_) 1333 if (compositor_)
1334 compositor_->setViewportSize(size_, physical_backing_size_); 1334 compositor_->setViewportSize(size_, physical_backing_size_);
1335 } 1335 }
1336 1336
1337 void RenderWidget::initializeLayerTreeView() { 1337 void RenderWidget::initializeLayerTreeView() {
1338 DCHECK(!host_closing_); 1338 DCHECK(!host_closing_);
1339 1339
1340 compositor_ = RenderWidgetCompositor::Create(this, compositor_deps_); 1340 compositor_ = RenderWidgetCompositor::Create(this, compositor_deps_);
1341 compositor_->setViewportSize(size_, physical_backing_size_); 1341 compositor_->setViewportSize(size_, physical_backing_size_);
1342
1343 // For background pages and certain tests, we don't want to trigger
1344 // OutputSurface creation.
1345 if (compositor_never_visible_ || !RenderThreadImpl::current())
1346 compositor_->SetNeverVisible();
1347
1342 StartCompositor(); 1348 StartCompositor();
1343 } 1349 }
1344 1350
1345 void RenderWidget::WillCloseLayerTreeView() { 1351 void RenderWidget::WillCloseLayerTreeView() {
1346 if (host_closing_) 1352 if (host_closing_)
1347 return; 1353 return;
1348 1354
1349 // Prevent new compositors or output surfaces from being created. 1355 // Prevent new compositors or output surfaces from being created.
1350 host_closing_ = true; 1356 host_closing_ = true;
1351 1357
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 // it can be bundled in the event ack. 2167 // it can be bundled in the event ack.
2162 if (handling_event_overscroll_) { 2168 if (handling_event_overscroll_) {
2163 handling_event_overscroll_->reset(new DidOverscrollParams(params)); 2169 handling_event_overscroll_->reset(new DidOverscrollParams(params));
2164 return; 2170 return;
2165 } 2171 }
2166 2172
2167 Send(new InputHostMsg_DidOverscroll(routing_id_, params)); 2173 Send(new InputHostMsg_DidOverscroll(routing_id_, params));
2168 } 2174 }
2169 2175
2170 void RenderWidget::StartCompositor() { 2176 void RenderWidget::StartCompositor() {
2171 // For widgets that are never visible, we don't need the compositor to run 2177 if (!is_hidden())
2172 // at all. 2178 compositor_->setVisible(true);
2173 if (never_visible_)
2174 return;
2175 // In tests without a RenderThreadImpl, don't set ready as this kicks
2176 // off creating output surfaces that the test can't create.
2177 if (!RenderThreadImpl::current())
2178 return;
2179 compositor_->StartCompositor();
2180 } 2179 }
2181 2180
2182 void RenderWidget::SchedulePluginMove(const WebPluginGeometry& move) { 2181 void RenderWidget::SchedulePluginMove(const WebPluginGeometry& move) {
2183 size_t i = 0; 2182 size_t i = 0;
2184 for (; i < plugin_window_moves_.size(); ++i) { 2183 for (; i < plugin_window_moves_.size(); ++i) {
2185 if (plugin_window_moves_[i].window == move.window) { 2184 if (plugin_window_moves_[i].window == move.window) {
2186 if (move.rects_valid) { 2185 if (move.rects_valid) {
2187 plugin_window_moves_[i] = move; 2186 plugin_window_moves_[i] = move;
2188 } else { 2187 } else {
2189 plugin_window_moves_[i].visible = move.visible; 2188 plugin_window_moves_[i].visible = move.visible;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2379 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2381 video_hole_frames_.AddObserver(frame); 2380 video_hole_frames_.AddObserver(frame);
2382 } 2381 }
2383 2382
2384 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2383 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2385 video_hole_frames_.RemoveObserver(frame); 2384 video_hole_frames_.RemoveObserver(frame);
2386 } 2385 }
2387 #endif // defined(VIDEO_HOLE) 2386 #endif // defined(VIDEO_HOLE)
2388 2387
2389 } // namespace content 2388 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/test/web_layer_tree_view_impl_for_testing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698