Chromium Code Reviews| 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/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1394 | 1394 |
| 1395 bool was_async = false; | 1395 bool was_async = false; |
| 1396 | 1396 |
| 1397 // If this is a GPU UpdateRect, params.bitmap is invalid and dib will be NULL. | 1397 // If this is a GPU UpdateRect, params.bitmap is invalid and dib will be NULL. |
| 1398 TransportDIB* dib = process_->GetTransportDIB(params.bitmap); | 1398 TransportDIB* dib = process_->GetTransportDIB(params.bitmap); |
| 1399 | 1399 |
| 1400 // If gpu process does painting, scroll_rect and copy_rects are always empty | 1400 // If gpu process does painting, scroll_rect and copy_rects are always empty |
| 1401 // and backing store is never used. | 1401 // and backing store is never used. |
| 1402 if (dib) { | 1402 if (dib) { |
| 1403 DCHECK(!params.bitmap_rect.IsEmpty()); | 1403 DCHECK(!params.bitmap_rect.IsEmpty()); |
| 1404 const size_t size = params.bitmap_rect.height() * | 1404 gfx::Size pixel_size = params.bitmap_rect.size().Scale(params.scale_factor); |
| 1405 params.bitmap_rect.width() * 4; | 1405 const size_t size = pixel_size.height() * pixel_size.width() * 4; |
| 1406 if (dib->size() < size) { | 1406 if (dib->size() < size) { |
|
Nico
2012/08/31 19:46:07
How was this not broken previously?
sail
2012/08/31 19:53:52
This only breaks when:
1. The plugin scale facto
| |
| 1407 DLOG(WARNING) << "Transport DIB too small for given rectangle"; | 1407 DLOG(WARNING) << "Transport DIB too small for given rectangle"; |
| 1408 RecordAction(UserMetricsAction("BadMessageTerminate_RWH1")); | 1408 RecordAction(UserMetricsAction("BadMessageTerminate_RWH1")); |
| 1409 GetProcess()->ReceivedBadMessage(); | 1409 GetProcess()->ReceivedBadMessage(); |
| 1410 } else { | 1410 } else { |
| 1411 UNSHIPPED_TRACE_EVENT_INSTANT2("test_latency", "UpdateRect", | 1411 UNSHIPPED_TRACE_EVENT_INSTANT2("test_latency", "UpdateRect", |
| 1412 "x+y", params.bitmap_rect.x() + params.bitmap_rect.y(), | 1412 "x+y", params.bitmap_rect.x() + params.bitmap_rect.y(), |
| 1413 "color", 0xffffff & *static_cast<uint32*>(dib->memory())); | 1413 "color", 0xffffff & *static_cast<uint32*>(dib->memory())); |
| 1414 UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectWidth", | 1414 UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectWidth", |
| 1415 "width", params.bitmap_rect.width()); | 1415 "width", params.bitmap_rect.width()); |
| 1416 | 1416 |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2038 // indicate that no callback is in progress (i.e. without this line | 2038 // indicate that no callback is in progress (i.e. without this line |
| 2039 // DelayedAutoResized will not get called again). | 2039 // DelayedAutoResized will not get called again). |
| 2040 new_auto_size_.SetSize(0, 0); | 2040 new_auto_size_.SetSize(0, 0); |
| 2041 if (!should_auto_resize_) | 2041 if (!should_auto_resize_) |
| 2042 return; | 2042 return; |
| 2043 | 2043 |
| 2044 OnRenderAutoResized(new_size); | 2044 OnRenderAutoResized(new_size); |
| 2045 } | 2045 } |
| 2046 | 2046 |
| 2047 } // namespace content | 2047 } // namespace content |
| OLD | NEW |