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 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1864 | 1864 |
1865 const SkBitmap& bitmap = skia::GetTopDevice(*canvas)->accessBitmap(false); | 1865 const SkBitmap& bitmap = skia::GetTopDevice(*canvas)->accessBitmap(false); |
1866 if (!bitmap.copyTo(snapshot, SkBitmap::kARGB_8888_Config)) | 1866 if (!bitmap.copyTo(snapshot, SkBitmap::kARGB_8888_Config)) |
1867 return false; | 1867 return false; |
1868 | 1868 |
1869 UMA_HISTOGRAM_TIMES("Renderer4.Snapshot", | 1869 UMA_HISTOGRAM_TIMES("Renderer4.Snapshot", |
1870 base::TimeTicks::Now() - beginning_time); | 1870 base::TimeTicks::Now() - beginning_time); |
1871 return true; | 1871 return true; |
1872 } | 1872 } |
1873 | 1873 |
1874 void RenderWidget::OnRepaint(const gfx::Size& size_to_paint) { | 1874 void RenderWidget::OnRepaint(gfx::Size size_to_paint) { |
1875 // During shutdown we can just ignore this message. | 1875 // During shutdown we can just ignore this message. |
1876 if (!webwidget_) | 1876 if (!webwidget_) |
1877 return; | 1877 return; |
1878 | 1878 |
| 1879 // Even if the browser provides an empty damage rect, it's still expecting to |
| 1880 // receive a repaint ack so just damage the entire widget bounds. |
| 1881 if (size_to_paint.IsEmpty()) { |
| 1882 size_to_paint = size_; |
| 1883 } |
| 1884 |
1879 set_next_paint_is_repaint_ack(); | 1885 set_next_paint_is_repaint_ack(); |
1880 if (is_accelerated_compositing_active_) { | 1886 if (is_accelerated_compositing_active_ && compositor_) { |
1881 if (compositor_) | 1887 compositor_->SetNeedsRedrawRect(gfx::Rect(size_to_paint)); |
1882 compositor_->setNeedsRedraw(); | |
1883 scheduleComposite(); | |
1884 } else { | 1888 } else { |
1885 gfx::Rect repaint_rect(size_to_paint.width(), size_to_paint.height()); | 1889 gfx::Rect repaint_rect(size_to_paint.width(), size_to_paint.height()); |
1886 didInvalidateRect(repaint_rect); | 1890 didInvalidateRect(repaint_rect); |
1887 } | 1891 } |
1888 } | 1892 } |
1889 | 1893 |
1890 void RenderWidget::OnSmoothScrollCompleted(int gesture_id) { | 1894 void RenderWidget::OnSmoothScrollCompleted(int gesture_id) { |
1891 PendingSmoothScrollGestureMap::iterator it = | 1895 PendingSmoothScrollGestureMap::iterator it = |
1892 pending_smooth_scroll_gestures_.find(gesture_id); | 1896 pending_smooth_scroll_gestures_.find(gesture_id); |
1893 DCHECK(it != pending_smooth_scroll_gestures_.end()); | 1897 DCHECK(it != pending_smooth_scroll_gestures_.end()); |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2311 | 2315 |
2312 if (!context->Initialize( | 2316 if (!context->Initialize( |
2313 attributes, | 2317 attributes, |
2314 false /* bind generates resources */, | 2318 false /* bind generates resources */, |
2315 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2319 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
2316 return NULL; | 2320 return NULL; |
2317 return context.release(); | 2321 return context.release(); |
2318 } | 2322 } |
2319 | 2323 |
2320 } // namespace content | 2324 } // namespace content |
OLD | NEW |