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/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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 paint_aggregator_.ClearPendingUpdate(); | 399 paint_aggregator_.ClearPendingUpdate(); |
400 | 400 |
401 // When resizing, we want to wait to paint before ACK'ing the resize. This | 401 // When resizing, we want to wait to paint before ACK'ing the resize. This |
402 // ensures that we only resize as fast as we can paint. We only need to | 402 // ensures that we only resize as fast as we can paint. We only need to |
403 // send an ACK if we are resized to a non-empty rect. | 403 // send an ACK if we are resized to a non-empty rect. |
404 webwidget_->resize(new_size); | 404 webwidget_->resize(new_size); |
405 | 405 |
406 // Resize should have caused an invalidation of the entire view. | 406 // Resize should have caused an invalidation of the entire view. |
407 DCHECK(new_size.IsEmpty() || is_accelerated_compositing_active_ || | 407 DCHECK(new_size.IsEmpty() || is_accelerated_compositing_active_ || |
408 paint_aggregator_.HasPendingUpdate()); | 408 paint_aggregator_.HasPendingUpdate()); |
409 } else if (!RenderThreadImpl::current()->short_circuit_size_updates()) { | 409 } else if (!RenderThreadImpl::current() || // Will be NULL during unit tests. |
| 410 !RenderThreadImpl::current()->short_circuit_size_updates()) { |
| 411 resize_ack = NO_RESIZE_ACK; |
| 412 } |
| 413 |
| 414 if (new_size.IsEmpty() || physical_backing_size.IsEmpty()) { |
| 415 // For empty size or empty physical_backing_size, there is no next paint |
| 416 // (along with which to send the ack) until they are set to non-empty. |
410 resize_ack = NO_RESIZE_ACK; | 417 resize_ack = NO_RESIZE_ACK; |
411 } | 418 } |
412 | 419 |
413 // Send the Resize_ACK flag once we paint again if requested. | 420 // Send the Resize_ACK flag once we paint again if requested. |
414 if (resize_ack == SEND_RESIZE_ACK && !new_size.IsEmpty()) | 421 if (resize_ack == SEND_RESIZE_ACK) |
415 set_next_paint_is_resize_ack(); | 422 set_next_paint_is_resize_ack(); |
416 | 423 |
417 if (fullscreen_change) | 424 if (fullscreen_change) |
418 DidToggleFullscreen(); | 425 DidToggleFullscreen(); |
419 | 426 |
420 // If a resize ack is requested and it isn't set-up, then no more resizes will | 427 // If a resize ack is requested and it isn't set-up, then no more resizes will |
421 // come in and in general things will go wrong. | 428 // come in and in general things will go wrong. |
422 DCHECK(resize_ack != SEND_RESIZE_ACK || new_size.IsEmpty() || | 429 DCHECK(resize_ack != SEND_RESIZE_ACK || next_paint_is_resize_ack()); |
423 next_paint_is_resize_ack()); | |
424 } | 430 } |
425 | 431 |
426 void RenderWidget::OnClose() { | 432 void RenderWidget::OnClose() { |
427 if (closing_) | 433 if (closing_) |
428 return; | 434 return; |
429 closing_ = true; | 435 closing_ = true; |
430 | 436 |
431 // Browser correspondence is no longer needed at this point. | 437 // Browser correspondence is no longer needed at this point. |
432 if (routing_id_ != MSG_ROUTING_NONE) { | 438 if (routing_id_ != MSG_ROUTING_NONE) { |
433 RenderThread::Get()->RemoveRoute(routing_id_); | 439 RenderThread::Get()->RemoveRoute(routing_id_); |
(...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2346 | 2352 |
2347 if (!context->Initialize( | 2353 if (!context->Initialize( |
2348 attributes, | 2354 attributes, |
2349 false /* bind generates resources */, | 2355 false /* bind generates resources */, |
2350 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2356 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
2351 return NULL; | 2357 return NULL; |
2352 return context.release(); | 2358 return context.release(); |
2353 } | 2359 } |
2354 | 2360 |
2355 } // namespace content | 2361 } // namespace content |
OLD | NEW |