OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "content/browser/renderer_host/render_widget_host.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/string_number_conversions.h" |
14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
15 #include "content/browser/accessibility/browser_accessibility_state.h" | 16 #include "content/browser/accessibility/browser_accessibility_state.h" |
16 #include "content/browser/gpu/gpu_process_host.h" | 17 #include "content/browser/gpu/gpu_process_host.h" |
17 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 18 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
18 #include "content/browser/renderer_host/backing_store.h" | 19 #include "content/browser/renderer_host/backing_store.h" |
19 #include "content/browser/renderer_host/backing_store_manager.h" | 20 #include "content/browser/renderer_host/backing_store_manager.h" |
20 #include "content/browser/renderer_host/render_process_host_impl.h" | 21 #include "content/browser/renderer_host/render_process_host_impl.h" |
21 #include "content/browser/renderer_host/render_widget_helper.h" | 22 #include "content/browser/renderer_host/render_widget_helper.h" |
22 #include "content/browser/renderer_host/render_widget_host_view.h" | 23 #include "content/browser/renderer_host/render_widget_host_view.h" |
23 #include "content/browser/user_metrics.h" | 24 #include "content/browser/user_metrics.h" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 const gfx::Size& page_size, | 432 const gfx::Size& page_size, |
432 const gfx::Size& desired_size) { | 433 const gfx::Size& desired_size) { |
433 // Ask the renderer to create a bitmap regardless of whether it's | 434 // Ask the renderer to create a bitmap regardless of whether it's |
434 // hidden, being resized, redrawn, etc. It resizes the web widget | 435 // hidden, being resized, redrawn, etc. It resizes the web widget |
435 // to the page_size and then scales it to the desired_size. | 436 // to the page_size and then scales it to the desired_size. |
436 Send(new ViewMsg_PaintAtSize(routing_id_, dib_handle, tag, | 437 Send(new ViewMsg_PaintAtSize(routing_id_, dib_handle, tag, |
437 page_size, desired_size)); | 438 page_size, desired_size)); |
438 } | 439 } |
439 | 440 |
440 BackingStore* RenderWidgetHost::GetBackingStore(bool force_create) { | 441 BackingStore* RenderWidgetHost::GetBackingStore(bool force_create) { |
| 442 TRACE_EVENT2("renderer_host", "RenderWidgetHost::GetBackingStore", |
| 443 "width", base::IntToString(current_size_.width()), |
| 444 "height", base::IntToString(current_size_.height())); |
| 445 |
441 // We should not be asked to paint while we are hidden. If we are hidden, | 446 // We should not be asked to paint while we are hidden. If we are hidden, |
442 // then it means that our consumer failed to call WasRestored. If we're not | 447 // then it means that our consumer failed to call WasRestored. If we're not |
443 // force creating the backing store, it's OK since we can feel free to give | 448 // force creating the backing store, it's OK since we can feel free to give |
444 // out our cached one if we have it. | 449 // out our cached one if we have it. |
445 DCHECK(!is_hidden_ || !force_create) << | 450 DCHECK(!is_hidden_ || !force_create) << |
446 "GetBackingStore called while hidden!"; | 451 "GetBackingStore called while hidden!"; |
447 | 452 |
448 // We should never be called recursively; this can theoretically lead to | 453 // We should never be called recursively; this can theoretically lead to |
449 // infinite recursion and almost certainly leads to lower performance. | 454 // infinite recursion and almost certainly leads to lower performance. |
450 DCHECK(!in_get_backing_store_) << "GetBackingStore called recursively!"; | 455 DCHECK(!in_get_backing_store_) << "GetBackingStore called recursively!"; |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1525 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); | 1530 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); |
1526 } | 1531 } |
1527 | 1532 |
1528 // static | 1533 // static |
1529 void RenderWidgetHost::AcknowledgePostSubBuffer(int32 route_id, | 1534 void RenderWidgetHost::AcknowledgePostSubBuffer(int32 route_id, |
1530 int gpu_host_id) { | 1535 int gpu_host_id) { |
1531 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1536 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
1532 if (ui_shim) | 1537 if (ui_shim) |
1533 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); | 1538 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); |
1534 } | 1539 } |
OLD | NEW |