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

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

Issue 6879076: Prepare PepperWidget and RenderWidget for WebKit threaded compositing changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor tweaks Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/renderer/render_widget_fullscreen_pepper.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 needs_repainting_on_restore_ = false; 313 needs_repainting_on_restore_ = false;
314 314
315 // Tag the next paint as a restore ack, which is picked up by 315 // Tag the next paint as a restore ack, which is picked up by
316 // DoDeferredUpdate when it sends out the next PaintRect message. 316 // DoDeferredUpdate when it sends out the next PaintRect message.
317 set_next_paint_is_restore_ack(); 317 set_next_paint_is_restore_ack();
318 318
319 // Generate a full repaint. 319 // Generate a full repaint.
320 if (!is_accelerated_compositing_active_) { 320 if (!is_accelerated_compositing_active_) {
321 didInvalidateRect(gfx::Rect(size_.width(), size_.height())); 321 didInvalidateRect(gfx::Rect(size_.width(), size_.height()));
322 } else { 322 } else {
323 #ifndef WTF_USE_THREADED_COMPOSITING
324 webwidget_->composite(false);
325 #else
323 scheduleComposite(); 326 scheduleComposite();
327 #endif
324 } 328 }
325 } 329 }
326 330
327 void RenderWidget::OnWasSwappedOut() { 331 void RenderWidget::OnWasSwappedOut() {
328 // If we have been swapped out and no one else is using this process, 332 // If we have been swapped out and no one else is using this process,
329 // it's safe to exit now. If we get swapped back in, we will call 333 // it's safe to exit now. If we get swapped back in, we will call
330 // AddRefProcess in SetSwappedOut. 334 // AddRefProcess in SetSwappedOut.
331 if (is_swapped_out_) 335 if (is_swapped_out_)
332 RenderProcess::current()->ReleaseProcess(); 336 RenderProcess::current()->ReleaseProcess();
333 } 337 }
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 // running animation callbacks so that if a callback requests another 610 // running animation callbacks so that if a callback requests another
607 // we'll be sure to run it at the proper time. 611 // we'll be sure to run it at the proper time.
608 MessageLoop::current()->PostDelayedTask(FROM_HERE, NewRunnableMethod( 612 MessageLoop::current()->PostDelayedTask(FROM_HERE, NewRunnableMethod(
609 this, &RenderWidget::AnimationCallback), 16); 613 this, &RenderWidget::AnimationCallback), 16);
610 animation_task_posted_ = true; 614 animation_task_posted_ = true;
611 animation_update_pending_ = false; 615 animation_update_pending_ = false;
612 // Explicitly pump the WebCore Timer queue to avoid starvation on OS X. 616 // Explicitly pump the WebCore Timer queue to avoid starvation on OS X.
613 // See crbug.com/71735. 617 // See crbug.com/71735.
614 // TODO(jamesr) Remove this call once crbug.com/72007 is fixed. 618 // TODO(jamesr) Remove this call once crbug.com/72007 is fixed.
615 RenderThread::current()->GetWebKitClientImpl()->DoTimeout(); 619 RenderThread::current()->GetWebKitClientImpl()->DoTimeout();
620 #ifdef WEBWIDGET_HAS_ANIMATE_CHANGES
621 webwidget_->animate(0.0);
622 #else
616 webwidget_->animate(); 623 webwidget_->animate();
624 #endif
617 return; 625 return;
618 } 626 }
619 if (animation_task_posted_) 627 if (animation_task_posted_)
620 return; 628 return;
621 // This code uses base::Time::Now() to calculate the floor and next fire 629 // This code uses base::Time::Now() to calculate the floor and next fire
622 // time because javascript's Date object uses base::Time::Now(). The 630 // time because javascript's Date object uses base::Time::Now(). The
623 // message loop uses base::TimeTicks, which on windows can have a 631 // message loop uses base::TimeTicks, which on windows can have a
624 // different granularity than base::Time. 632 // different granularity than base::Time.
625 // The upshot of all this is that this function might be called before 633 // The upshot of all this is that this function might be called before
626 // base::Time::Now() has advanced past the animation_floor_time_. To 634 // base::Time::Now() has advanced past the animation_floor_time_. To
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 Send(new ViewHostMsg_DidActivateAcceleratedCompositing( 868 Send(new ViewHostMsg_DidActivateAcceleratedCompositing(
861 routing_id_, is_accelerated_compositing_active_)); 869 routing_id_, is_accelerated_compositing_active_));
862 870
863 if (active) 871 if (active)
864 using_asynchronous_swapbuffers_ = SupportsAsynchronousSwapBuffers(); 872 using_asynchronous_swapbuffers_ = SupportsAsynchronousSwapBuffers();
865 else if (using_asynchronous_swapbuffers_) 873 else if (using_asynchronous_swapbuffers_)
866 using_asynchronous_swapbuffers_ = false; 874 using_asynchronous_swapbuffers_ = false;
867 } 875 }
868 876
869 void RenderWidget::scheduleComposite() { 877 void RenderWidget::scheduleComposite() {
878 #if WTF_USE_THREADED_COMPOSITING
879 NOTREACHED();
880 #else
870 // TODO(nduca): replace with something a little less hacky. The reason this 881 // TODO(nduca): replace with something a little less hacky. The reason this
871 // hack is still used is because the Invalidate-DoDeferredUpdate loop 882 // hack is still used is because the Invalidate-DoDeferredUpdate loop
872 // contains a lot of host-renderer synchronization logic that is still 883 // contains a lot of host-renderer synchronization logic that is still
873 // important for the accelerated compositing case. The option of simply 884 // important for the accelerated compositing case. The option of simply
874 // duplicating all that code is less desirable than "faking out" the 885 // duplicating all that code is less desirable than "faking out" the
875 // invalidation path using a magical damage rect. 886 // invalidation path using a magical damage rect.
876 didInvalidateRect(WebRect(0, 0, 1, 1)); 887 didInvalidateRect(WebRect(0, 0, 1, 1));
888 #endif
877 } 889 }
878 890
879 void RenderWidget::scheduleAnimation() { 891 void RenderWidget::scheduleAnimation() {
880 if (!animation_update_pending_) { 892 if (!animation_update_pending_) {
881 animation_update_pending_ = true; 893 animation_update_pending_ = true;
882 if (!animation_task_posted_) { 894 if (!animation_task_posted_) {
883 animation_task_posted_ = true; 895 animation_task_posted_ = true;
884 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( 896 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
885 this, &RenderWidget::AnimationCallback)); 897 this, &RenderWidget::AnimationCallback));
886 } 898 }
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, bounds.size())); 1141 Send(new ViewHostMsg_PaintAtSize_ACK(routing_id_, tag, bounds.size()));
1130 } 1142 }
1131 1143
1132 void RenderWidget::OnMsgRepaint(const gfx::Size& size_to_paint) { 1144 void RenderWidget::OnMsgRepaint(const gfx::Size& size_to_paint) {
1133 // During shutdown we can just ignore this message. 1145 // During shutdown we can just ignore this message.
1134 if (!webwidget_) 1146 if (!webwidget_)
1135 return; 1147 return;
1136 1148
1137 set_next_paint_is_repaint_ack(); 1149 set_next_paint_is_repaint_ack();
1138 if (is_accelerated_compositing_active_) { 1150 if (is_accelerated_compositing_active_) {
1151 #ifndef WTF_USE_THREADED_COMPOSITING
1139 scheduleComposite(); 1152 scheduleComposite();
1153 #else
1154 #ifdef WEBWIDGET_HAS_THREADED_COMPOSITING_CHANGES
1155 webwidget_->composite(false);
1156 #endif
1157 #endif
1140 } else { 1158 } else {
1141 gfx::Rect repaint_rect(size_to_paint.width(), size_to_paint.height()); 1159 gfx::Rect repaint_rect(size_to_paint.width(), size_to_paint.height());
1142 didInvalidateRect(repaint_rect); 1160 didInvalidateRect(repaint_rect);
1143 } 1161 }
1144 } 1162 }
1145 1163
1146 void RenderWidget::OnSetTextDirection(WebTextDirection direction) { 1164 void RenderWidget::OnSetTextDirection(WebTextDirection direction) {
1147 if (!webwidget_) 1165 if (!webwidget_)
1148 return; 1166 return;
1149 webwidget_->setTextDirection(direction); 1167 webwidget_->setTextDirection(direction);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 1291
1274 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { 1292 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) {
1275 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); 1293 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin();
1276 i != plugin_window_moves_.end(); ++i) { 1294 i != plugin_window_moves_.end(); ++i) {
1277 if (i->window == window) { 1295 if (i->window == window) {
1278 plugin_window_moves_.erase(i); 1296 plugin_window_moves_.erase(i);
1279 break; 1297 break;
1280 } 1298 }
1281 } 1299 }
1282 } 1300 }
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_widget_fullscreen_pepper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698