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 { |
piman
2013/05/14 22:19:43
I think you want to keep this check, as my underst
Xianzhu
2013/05/14 22:34:25
Done.
| |
410 resize_ack = NO_RESIZE_ACK; | |
411 } | |
412 | |
413 if (new_size.IsEmpty() || physical_backing_size.IsEmpty()) { | |
414 // For empty size or empty physical_backing_size, there is no next paint | |
415 // (along with which to send the ack) until they are set to non-empty. | |
410 resize_ack = NO_RESIZE_ACK; | 416 resize_ack = NO_RESIZE_ACK; |
411 } | 417 } |
412 | 418 |
413 // Send the Resize_ACK flag once we paint again if requested. | 419 // Send the Resize_ACK flag once we paint again if requested. |
414 if (resize_ack == SEND_RESIZE_ACK && !new_size.IsEmpty()) | 420 if (resize_ack == SEND_RESIZE_ACK) |
415 set_next_paint_is_resize_ack(); | 421 set_next_paint_is_resize_ack(); |
416 | 422 |
417 if (fullscreen_change) | 423 if (fullscreen_change) |
418 DidToggleFullscreen(); | 424 DidToggleFullscreen(); |
419 | 425 |
420 // If a resize ack is requested and it isn't set-up, then no more resizes will | 426 // 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. | 427 // come in and in general things will go wrong. |
422 DCHECK(resize_ack != SEND_RESIZE_ACK || new_size.IsEmpty() || | 428 DCHECK(resize_ack != SEND_RESIZE_ACK || next_paint_is_resize_ack()); |
423 next_paint_is_resize_ack()); | |
424 } | 429 } |
425 | 430 |
426 void RenderWidget::OnClose() { | 431 void RenderWidget::OnClose() { |
427 if (closing_) | 432 if (closing_) |
428 return; | 433 return; |
429 closing_ = true; | 434 closing_ = true; |
430 | 435 |
431 // Browser correspondence is no longer needed at this point. | 436 // Browser correspondence is no longer needed at this point. |
432 if (routing_id_ != MSG_ROUTING_NONE) { | 437 if (routing_id_ != MSG_ROUTING_NONE) { |
433 RenderThread::Get()->RemoveRoute(routing_id_); | 438 RenderThread::Get()->RemoveRoute(routing_id_); |
(...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2346 | 2351 |
2347 if (!context->Initialize( | 2352 if (!context->Initialize( |
2348 attributes, | 2353 attributes, |
2349 false /* bind generates resources */, | 2354 false /* bind generates resources */, |
2350 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ) | 2355 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ) |
2351 return NULL; | 2356 return NULL; |
2352 return context.release(); | 2357 return context.release(); |
2353 } | 2358 } |
2354 | 2359 |
2355 } // namespace content | 2360 } // namespace content |
OLD | NEW |