| 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 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 // on the call stack. | 1393 // on the call stack. |
| 1394 // 2) Allows us to collect more damage rects before painting to help coalesce | 1394 // 2) Allows us to collect more damage rects before painting to help coalesce |
| 1395 // the work that we will need to do. | 1395 // the work that we will need to do. |
| 1396 invalidation_task_posted_ = true; | 1396 invalidation_task_posted_ = true; |
| 1397 base::MessageLoop::current()->PostTask( | 1397 base::MessageLoop::current()->PostTask( |
| 1398 FROM_HERE, base::Bind(&RenderWidget::InvalidationCallback, this)); | 1398 FROM_HERE, base::Bind(&RenderWidget::InvalidationCallback, this)); |
| 1399 } | 1399 } |
| 1400 | 1400 |
| 1401 void RenderWidget::didAutoResize(const WebSize& new_size) { | 1401 void RenderWidget::didAutoResize(const WebSize& new_size) { |
| 1402 if (size_.width() != new_size.width || size_.height() != new_size.height) { | 1402 if (size_.width() != new_size.width || size_.height() != new_size.height) { |
| 1403 size_ = new_size; |
| 1404 |
| 1405 // If we don't clear PaintAggregator after changing autoResize state, then |
| 1406 // we might end up in a situation where bitmap_rect is larger than the |
| 1407 // view_size. By clearing PaintAggregator, we ensure that we don't end up |
| 1408 // with invalid damage rects. |
| 1409 paint_aggregator_.ClearPendingUpdate(); |
| 1410 |
| 1403 if (RenderThreadImpl::current()->short_circuit_size_updates()) { | 1411 if (RenderThreadImpl::current()->short_circuit_size_updates()) { |
| 1404 setWindowRect(WebRect(rootWindowRect().x, | 1412 WebRect new_pos(rootWindowRect().x, |
| 1405 rootWindowRect().y, | 1413 rootWindowRect().y, |
| 1406 new_size.width, | 1414 new_size.width, |
| 1407 new_size.height)); | 1415 new_size.height); |
| 1408 } else { | 1416 view_screen_rect_ = new_pos; |
| 1409 size_ = new_size; | 1417 window_screen_rect_ = new_pos; |
| 1410 | |
| 1411 // If we don't clear PaintAggregator after changing autoResize state, then | |
| 1412 // we might end up in a situation where bitmap_rect is larger than the | |
| 1413 // view_size. By clearing PaintAggregator, we ensure that we don't end up | |
| 1414 // with invalid damage rects. | |
| 1415 paint_aggregator_.ClearPendingUpdate(); | |
| 1416 } | 1418 } |
| 1417 | 1419 |
| 1418 if (auto_resize_mode_) | 1420 AutoResizeCompositor(); |
| 1419 AutoResizeCompositor(); | |
| 1420 | 1421 |
| 1421 if (!RenderThreadImpl::current()->short_circuit_size_updates()) | 1422 if (!RenderThreadImpl::current()->short_circuit_size_updates()) |
| 1422 need_update_rect_for_auto_resize_ = true; | 1423 need_update_rect_for_auto_resize_ = true; |
| 1423 } | 1424 } |
| 1424 } | 1425 } |
| 1425 | 1426 |
| 1426 void RenderWidget::AutoResizeCompositor() { | 1427 void RenderWidget::AutoResizeCompositor() { |
| 1427 physical_backing_size_ = gfx::ToCeiledSize(gfx::ScaleSize(size_, | 1428 physical_backing_size_ = gfx::ToCeiledSize(gfx::ScaleSize(size_, |
| 1428 device_scale_factor_)); | 1429 device_scale_factor_)); |
| 1429 if (compositor_) | 1430 if (compositor_) |
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |