| OLD | NEW |
| 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 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 (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 Loading... |
| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2385 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2384 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2386 video_hole_frames_.AddObserver(frame); | 2385 video_hole_frames_.AddObserver(frame); |
| 2387 } | 2386 } |
| 2388 | 2387 |
| 2389 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2388 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2390 video_hole_frames_.RemoveObserver(frame); | 2389 video_hole_frames_.RemoveObserver(frame); |
| 2391 } | 2390 } |
| 2392 #endif // defined(VIDEO_HOLE) | 2391 #endif // defined(VIDEO_HOLE) |
| 2393 | 2392 |
| 2394 } // namespace content | 2393 } // namespace content |
| OLD | NEW |