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

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

Issue 15402010: When short-circuiting resize requests, keep track what the browser thinks the current size is (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « content/renderer/render_widget.h ('k') | no next file » | 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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 paint_aggregator_.ClearPendingUpdate(); 403 paint_aggregator_.ClearPendingUpdate();
404 404
405 // When resizing, we want to wait to paint before ACK'ing the resize. This 405 // When resizing, we want to wait to paint before ACK'ing the resize. This
406 // ensures that we only resize as fast as we can paint. We only need to 406 // ensures that we only resize as fast as we can paint. We only need to
407 // send an ACK if we are resized to a non-empty rect. 407 // send an ACK if we are resized to a non-empty rect.
408 webwidget_->resize(new_size); 408 webwidget_->resize(new_size);
409 409
410 // Resize should have caused an invalidation of the entire view. 410 // Resize should have caused an invalidation of the entire view.
411 DCHECK(new_size.IsEmpty() || is_accelerated_compositing_active_ || 411 DCHECK(new_size.IsEmpty() || is_accelerated_compositing_active_ ||
412 paint_aggregator_.HasPendingUpdate()); 412 paint_aggregator_.HasPendingUpdate());
413 } else if (!RenderThreadImpl::current() || // Will be NULL during unit tests. 413 } else if (size_browser_expects_ == new_size) {
414 !RenderThreadImpl::current()->short_circuit_size_updates()) {
415 resize_ack = NO_RESIZE_ACK; 414 resize_ack = NO_RESIZE_ACK;
416 } 415 }
417 416
418 if (new_size.IsEmpty() || physical_backing_size.IsEmpty()) { 417 if (new_size.IsEmpty() || physical_backing_size.IsEmpty()) {
419 // For empty size or empty physical_backing_size, there is no next paint 418 // For empty size or empty physical_backing_size, there is no next paint
420 // (along with which to send the ack) until they are set to non-empty. 419 // (along with which to send the ack) until they are set to non-empty.
421 resize_ack = NO_RESIZE_ACK; 420 resize_ack = NO_RESIZE_ACK;
422 } 421 }
423 422
424 // Send the Resize_ACK flag once we paint again if requested. 423 // Send the Resize_ACK flag once we paint again if requested.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 CompleteInit(); 461 CompleteInit();
463 } 462 }
464 463
465 void RenderWidget::OnResize(const gfx::Size& new_size, 464 void RenderWidget::OnResize(const gfx::Size& new_size,
466 const gfx::Size& physical_backing_size, 465 const gfx::Size& physical_backing_size,
467 float overdraw_bottom_height, 466 float overdraw_bottom_height,
468 const gfx::Rect& resizer_rect, 467 const gfx::Rect& resizer_rect,
469 bool is_fullscreen) { 468 bool is_fullscreen) {
470 Resize(new_size, physical_backing_size, overdraw_bottom_height, resizer_rect, 469 Resize(new_size, physical_backing_size, overdraw_bottom_height, resizer_rect,
471 is_fullscreen, SEND_RESIZE_ACK); 470 is_fullscreen, SEND_RESIZE_ACK);
471 size_browser_expects_ = new_size;
472 } 472 }
473 473
474 void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) { 474 void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) {
475 if (resizer_rect_ != resizer_rect) { 475 if (resizer_rect_ != resizer_rect) {
476 gfx::Rect view_rect(size_); 476 gfx::Rect view_rect(size_);
477 477
478 gfx::Rect old_damage_rect = gfx::IntersectRects(view_rect, resizer_rect_); 478 gfx::Rect old_damage_rect = gfx::IntersectRects(view_rect, resizer_rect_);
479 if (!old_damage_rect.IsEmpty()) 479 if (!old_damage_rect.IsEmpty())
480 paint_aggregator_.InvalidateRect(old_damage_rect); 480 paint_aggregator_.InvalidateRect(old_damage_rect);
481 481
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 531
532 void RenderWidget::OnRequestMoveAck() { 532 void RenderWidget::OnRequestMoveAck() {
533 DCHECK(pending_window_rect_count_); 533 DCHECK(pending_window_rect_count_);
534 pending_window_rect_count_--; 534 pending_window_rect_count_--;
535 } 535 }
536 536
537 void RenderWidget::OnUpdateRectAck() { 537 void RenderWidget::OnUpdateRectAck() {
538 TRACE_EVENT0("renderer", "RenderWidget::OnUpdateRectAck"); 538 TRACE_EVENT0("renderer", "RenderWidget::OnUpdateRectAck");
539 DCHECK(update_reply_pending_); 539 DCHECK(update_reply_pending_);
540 update_reply_pending_ = false; 540 update_reply_pending_ = false;
541 size_browser_expects_ = size_;
541 542
542 // If we sent an UpdateRect message with a zero-sized bitmap, then we should 543 // If we sent an UpdateRect message with a zero-sized bitmap, then we should
543 // have no current paint buffer. 544 // have no current paint buffer.
544 if (current_paint_buf_) { 545 if (current_paint_buf_) {
545 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_); 546 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_);
546 current_paint_buf_ = NULL; 547 current_paint_buf_ = NULL;
547 } 548 }
548 549
549 // If swapbuffers is still pending, then defer the update until the 550 // If swapbuffers is still pending, then defer the update until the
550 // swapbuffers occurs. 551 // swapbuffers occurs.
(...skipping 1811 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 2363
2363 if (!context->Initialize( 2364 if (!context->Initialize(
2364 attributes, 2365 attributes,
2365 false /* bind generates resources */, 2366 false /* bind generates resources */,
2366 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ) 2367 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) )
2367 return NULL; 2368 return NULL;
2368 return context.release(); 2369 return context.release();
2369 } 2370 }
2370 2371
2371 } // namespace content 2372 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698