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

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

Issue 6665029: Adds a TransportDIB::Id value that is explicitly invalid and use it when compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mebbe this one compiles? Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/surface/transport_dib.h" 7 #include "app/surface/transport_dib.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 return; 573 return;
574 574
575 // OK, save the pending update to a local since painting may cause more 575 // OK, save the pending update to a local since painting may cause more
576 // invalidation. Some WebCore rendering objects only layout when painted. 576 // invalidation. Some WebCore rendering objects only layout when painted.
577 PaintAggregator::PendingUpdate update; 577 PaintAggregator::PendingUpdate update;
578 paint_aggregator_.PopPendingUpdate(&update); 578 paint_aggregator_.PopPendingUpdate(&update);
579 579
580 gfx::Rect scroll_damage = update.GetScrollDamage(); 580 gfx::Rect scroll_damage = update.GetScrollDamage();
581 gfx::Rect bounds = update.GetPaintBounds().Union(scroll_damage); 581 gfx::Rect bounds = update.GetPaintBounds().Union(scroll_damage);
582 582
583 // Compositing the page may disable accelerated compositing.
584 bool accelerated_compositing_was_active = is_accelerated_compositing_active_;
585
583 // A plugin may be able to do an optimized paint. First check this, in which 586 // A plugin may be able to do an optimized paint. First check this, in which
584 // case we can skip all of the bitmap generation and regular paint code. 587 // case we can skip all of the bitmap generation and regular paint code.
585 // This optimization allows PPAPI plugins that declare themselves on top of 588 // This optimization allows PPAPI plugins that declare themselves on top of
586 // the page (like a traditional windowed plugin) to be able to animate (think 589 // the page (like a traditional windowed plugin) to be able to animate (think
587 // movie playing) without repeatedly re-painting the page underneath, or 590 // movie playing) without repeatedly re-painting the page underneath, or
588 // copying the plugin backing store (since we can send the plugin's backing 591 // copying the plugin backing store (since we can send the plugin's backing
589 // store directly to the browser). 592 // store directly to the browser).
590 // 593 //
591 // This optimization only works when the entire invalid region is contained 594 // This optimization only works when the entire invalid region is contained
592 // within the plugin. There is a related optimization in PaintRect for the 595 // within the plugin. There is a related optimization in PaintRect for the
593 // case where there may be multiple invalid regions. 596 // case where there may be multiple invalid regions.
594 TransportDIB::Id dib_id = TransportDIB::Id(); 597 TransportDIB::Id dib_id;
595 TransportDIB* dib = NULL; 598 TransportDIB* dib = NULL;
596 std::vector<gfx::Rect> copy_rects; 599 std::vector<gfx::Rect> copy_rects;
597 gfx::Rect optimized_copy_rect, optimized_copy_location; 600 gfx::Rect optimized_copy_rect, optimized_copy_location;
598 if (update.scroll_rect.IsEmpty() && 601 if (update.scroll_rect.IsEmpty() &&
599 !is_accelerated_compositing_active_ && 602 !is_accelerated_compositing_active_ &&
600 GetBitmapForOptimizedPluginPaint(bounds, &dib, &optimized_copy_location, 603 GetBitmapForOptimizedPluginPaint(bounds, &dib, &optimized_copy_location,
601 &optimized_copy_rect)) { 604 &optimized_copy_rect)) {
602 // Only update the part of the plugin that actually changed. 605 // Only update the part of the plugin that actually changed.
603 optimized_copy_rect = optimized_copy_rect.Intersect(bounds); 606 optimized_copy_rect = optimized_copy_rect.Intersect(bounds);
604 bounds = optimized_copy_location; 607 bounds = optimized_copy_location;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 // Begin painting. 639 // Begin painting.
637 webwidget_->composite(false); 640 webwidget_->composite(false);
638 } 641 }
639 642
640 // sending an ack to browser process that the paint is complete... 643 // sending an ack to browser process that the paint is complete...
641 ViewHostMsg_UpdateRect_Params params; 644 ViewHostMsg_UpdateRect_Params params;
642 params.bitmap = dib_id; 645 params.bitmap = dib_id;
643 params.bitmap_rect = bounds; 646 params.bitmap_rect = bounds;
644 params.dx = update.scroll_delta.x(); 647 params.dx = update.scroll_delta.x();
645 params.dy = update.scroll_delta.y(); 648 params.dy = update.scroll_delta.y();
646 if (is_accelerated_compositing_active_) { 649 if (accelerated_compositing_was_active) {
647 // If painting is done via the gpu process then we clear out all damage 650 // If painting is done via the gpu process then we clear out all damage
648 // rects to save the browser process from doing unecessary work. 651 // rects to save the browser process from doing unecessary work.
649 params.scroll_rect = gfx::Rect(); 652 params.scroll_rect = gfx::Rect();
650 params.copy_rects.clear(); 653 params.copy_rects.clear();
651 } else { 654 } else {
652 params.scroll_rect = update.scroll_rect; 655 params.scroll_rect = update.scroll_rect;
653 params.copy_rects.swap(copy_rects); // TODO(darin): clip to bounds? 656 params.copy_rects.swap(copy_rects); // TODO(darin): clip to bounds?
654 } 657 }
655 params.view_size = size_; 658 params.view_size = size_;
656 params.resizer_rect = resizer_rect_; 659 params.resizer_rect = resizer_rect_;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 if (webwidget_) 897 if (webwidget_)
895 webwidget_->confirmComposition(text); 898 webwidget_->confirmComposition(text);
896 } 899 }
897 900
898 // This message causes the renderer to render an image of the 901 // This message causes the renderer to render an image of the
899 // desired_size, regardless of whether the tab is hidden or not. 902 // desired_size, regardless of whether the tab is hidden or not.
900 void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle, 903 void RenderWidget::OnMsgPaintAtSize(const TransportDIB::Handle& dib_handle,
901 int tag, 904 int tag,
902 const gfx::Size& page_size, 905 const gfx::Size& page_size,
903 const gfx::Size& desired_size) { 906 const gfx::Size& desired_size) {
904 if (!webwidget_ || !TransportDIB::is_valid(dib_handle)) { 907 if (!webwidget_ || !TransportDIB::is_valid_handle(dib_handle)) {
905 if (TransportDIB::is_valid(dib_handle)) { 908 if (TransportDIB::is_valid_handle(dib_handle)) {
906 // Close our unused handle. 909 // Close our unused handle.
907 #if defined(OS_WIN) 910 #if defined(OS_WIN)
908 ::CloseHandle(dib_handle); 911 ::CloseHandle(dib_handle);
909 #elif defined(OS_MACOSX) 912 #elif defined(OS_MACOSX)
910 base::SharedMemory::CloseHandle(dib_handle); 913 base::SharedMemory::CloseHandle(dib_handle);
911 #endif 914 #endif
912 } 915 }
913 return; 916 return;
914 } 917 }
915 918
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 1109
1107 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { 1110 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) {
1108 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); 1111 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin();
1109 i != plugin_window_moves_.end(); ++i) { 1112 i != plugin_window_moves_.end(); ++i) {
1110 if (i->window == window) { 1113 if (i->window == window) {
1111 plugin_window_moves_.erase(i); 1114 plugin_window_moves_.erase(i);
1112 break; 1115 break;
1113 } 1116 }
1114 } 1117 }
1115 } 1118 }
OLDNEW
« content/common/common_param_traits.h ('K') | « content/renderer/pepper_plugin_delegate_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698