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_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 const size_t size_in_bytes = 4 * frame_size.GetArea(); | 1578 const size_t size_in_bytes = 4 * frame_size.GetArea(); |
1579 #ifdef OS_WIN | 1579 #ifdef OS_WIN |
1580 scoped_ptr<base::SharedMemory> shared_memory( | 1580 scoped_ptr<base::SharedMemory> shared_memory( |
1581 new base::SharedMemory(frame_data->handle, true, | 1581 new base::SharedMemory(frame_data->handle, true, |
1582 host_->GetProcess()->GetHandle())); | 1582 host_->GetProcess()->GetHandle())); |
1583 #else | 1583 #else |
1584 scoped_ptr<base::SharedMemory> shared_memory( | 1584 scoped_ptr<base::SharedMemory> shared_memory( |
1585 new base::SharedMemory(frame_data->handle, true)); | 1585 new base::SharedMemory(frame_data->handle, true)); |
1586 #endif | 1586 #endif |
1587 | 1587 |
1588 if (!shared_memory->Map(size_in_bytes)) { | 1588 #ifdef OS_WIN |
| 1589 if (!shared_memory->Map(0)) { |
| 1590 DLOG(ERROR) << "Unable to map renderer memory."; |
| 1591 RecordAction(UserMetricsAction("BadMessageTerminate_RWHVA1")); |
1589 host_->GetProcess()->ReceivedBadMessage(); | 1592 host_->GetProcess()->ReceivedBadMessage(); |
1590 return; | 1593 return; |
1591 } | 1594 } |
1592 | 1595 |
| 1596 if (shared_memory->mapped_size() < size_in_bytes) { |
| 1597 DLOG(ERROR) << "Shared memory too small for given rectangle"; |
| 1598 RecordAction(UserMetricsAction("BadMessageTerminate_RWHVA2")); |
| 1599 host_->GetProcess()->ReceivedBadMessage(); |
| 1600 return; |
| 1601 } |
| 1602 #else |
| 1603 if (!shared_memory->Map(size_in_bytes)) { |
| 1604 DLOG(ERROR) << "Unable to map renderer memory."; |
| 1605 RecordAction(UserMetricsAction("BadMessageTerminate_RWHVA1")); |
| 1606 host_->GetProcess()->ReceivedBadMessage(); |
| 1607 return; |
| 1608 } |
| 1609 #endif |
| 1610 |
1593 if (last_swapped_surface_size_ != frame_size) { | 1611 if (last_swapped_surface_size_ != frame_size) { |
1594 DLOG_IF(ERROR, damage_rect != gfx::Rect(frame_size)) | 1612 DLOG_IF(ERROR, damage_rect != gfx::Rect(frame_size)) |
1595 << "Expected full damage rect"; | 1613 << "Expected full damage rect"; |
1596 } | 1614 } |
1597 last_swapped_surface_size_ = frame_size; | 1615 last_swapped_surface_size_ = frame_size; |
1598 last_swapped_surface_scale_factor_ = frame_device_scale_factor; | 1616 last_swapped_surface_scale_factor_ = frame_device_scale_factor; |
1599 | 1617 |
1600 scoped_refptr<MemoryHolder> holder(new MemoryHolder( | 1618 scoped_refptr<MemoryHolder> holder(new MemoryHolder( |
1601 shared_memory.Pass(), | 1619 shared_memory.Pass(), |
1602 frame_size, | 1620 frame_size, |
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3447 RenderWidgetHost* widget) { | 3465 RenderWidgetHost* widget) { |
3448 return new RenderWidgetHostViewAura(widget); | 3466 return new RenderWidgetHostViewAura(widget); |
3449 } | 3467 } |
3450 | 3468 |
3451 // static | 3469 // static |
3452 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3470 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3453 GetScreenInfoForWindow(results, NULL); | 3471 GetScreenInfoForWindow(results, NULL); |
3454 } | 3472 } |
3455 | 3473 |
3456 } // namespace content | 3474 } // namespace content |
OLD | NEW |