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

Unified Diff: content/renderer/render_widget.cc

Issue 23694031: Fix race conditions in window snapshot code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Nit Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_widget.h ('k') | tools/telemetry/telemetry/core/tab_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index e1b735333849023a87016dd4b0f951c47443c78f..1cb162a4843b4c8b660873e3c838448ebe051633 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -582,6 +582,34 @@ void RenderWidget::OnShowHostContextMenu(ContextMenuParams* params) {
screen_metrics_emulator_->OnShowContextMenu(params);
}
+void RenderWidget::ScheduleCompositeWithForcedRedraw() {
+ if (compositor_) {
+ // Regardless of whether threaded compositing is enabled, always
+ // use this mechanism to force the compositor to redraw. However,
+ // the invalidation code path below is still needed for the
+ // non-threaded case.
+ compositor_->SetNeedsForcedRedraw();
+ }
+ ScheduleCompositeImpl(true);
+}
+
+void RenderWidget::ScheduleCompositeImpl(bool force_redraw) {
+ if (RenderThreadImpl::current()->compositor_message_loop_proxy().get() &&
+ compositor_) {
+ if (!force_redraw) {
+ compositor_->setNeedsRedraw();
+ }
+ } else {
+ // TODO(nduca): replace with something a little less hacky. The reason this
+ // hack is still used is because the Invalidate-DoDeferredUpdate loop
+ // contains a lot of host-renderer synchronization logic that is still
+ // important for the accelerated compositing case. The option of simply
+ // duplicating all that code is less desirable than "faking out" the
+ // invalidation path using a magical damage rect.
+ didInvalidateRect(WebRect(0, 0, 1, 1));
+ }
+}
+
bool RenderWidget::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(RenderWidget, message)
@@ -1883,18 +1911,7 @@ void RenderWidget::didCompleteSwapBuffers() {
}
void RenderWidget::scheduleComposite() {
- if (RenderThreadImpl::current()->compositor_message_loop_proxy().get() &&
- compositor_) {
- compositor_->setNeedsRedraw();
- } else {
- // TODO(nduca): replace with something a little less hacky. The reason this
- // hack is still used is because the Invalidate-DoDeferredUpdate loop
- // contains a lot of host-renderer synchronization logic that is still
- // important for the accelerated compositing case. The option of simply
- // duplicating all that code is less desirable than "faking out" the
- // invalidation path using a magical damage rect.
- didInvalidateRect(WebRect(0, 0, 1, 1));
- }
+ ScheduleCompositeImpl(false);
}
void RenderWidget::scheduleAnimation() {
« no previous file with comments | « content/renderer/render_widget.h ('k') | tools/telemetry/telemetry/core/tab_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698