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 <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
15 #include "base/debug/trace_event.h" | 15 #include "base/debug/trace_event.h" |
16 #include "base/i18n/rtl.h" | 16 #include "base/i18n/rtl.h" |
17 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
19 #include "base/metrics/field_trial.h" | 19 #include "base/metrics/field_trial.h" |
20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
21 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
23 #include "base/thread_task_runner_handle.h" | 23 #include "base/thread_task_runner_handle.h" |
| 24 #include "cc/base/switches.h" |
24 #include "cc/output/compositor_frame.h" | 25 #include "cc/output/compositor_frame.h" |
25 #include "cc/output/compositor_frame_ack.h" | 26 #include "cc/output/compositor_frame_ack.h" |
26 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 27 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
27 #include "content/browser/gpu/compositor_util.h" | 28 #include "content/browser/gpu/compositor_util.h" |
28 #include "content/browser/gpu/gpu_process_host.h" | 29 #include "content/browser/gpu/gpu_process_host.h" |
29 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 30 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
30 #include "content/browser/gpu/gpu_surface_tracker.h" | 31 #include "content/browser/gpu/gpu_surface_tracker.h" |
31 #include "content/browser/renderer_host/backing_store.h" | 32 #include "content/browser/renderer_host/backing_store.h" |
32 #include "content/browser/renderer_host/backing_store_manager.h" | 33 #include "content/browser/renderer_host/backing_store_manager.h" |
33 #include "content/browser/renderer_host/dip_util.h" | 34 #include "content/browser/renderer_host/dip_util.h" |
(...skipping 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2469 } | 2470 } |
2470 | 2471 |
2471 void RenderWidgetHostImpl::WindowSnapshotReachedScreen(int snapshot_id) { | 2472 void RenderWidgetHostImpl::WindowSnapshotReachedScreen(int snapshot_id) { |
2472 DCHECK(base::MessageLoopForUI::IsCurrent()); | 2473 DCHECK(base::MessageLoopForUI::IsCurrent()); |
2473 | 2474 |
2474 std::vector<unsigned char> png; | 2475 std::vector<unsigned char> png; |
2475 | 2476 |
2476 // This feature is behind the kEnableGpuBenchmarking command line switch | 2477 // This feature is behind the kEnableGpuBenchmarking command line switch |
2477 // because it poses security concerns and should only be used for testing. | 2478 // because it poses security concerns and should only be used for testing. |
2478 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 2479 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
2479 if (!command_line.HasSwitch(switches::kEnableGpuBenchmarking)) { | 2480 if (!command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking)) { |
2480 Send(new ViewMsg_WindowSnapshotCompleted( | 2481 Send(new ViewMsg_WindowSnapshotCompleted( |
2481 GetRoutingID(), snapshot_id, gfx::Size(), png)); | 2482 GetRoutingID(), snapshot_id, gfx::Size(), png)); |
2482 return; | 2483 return; |
2483 } | 2484 } |
2484 | 2485 |
2485 gfx::Rect view_bounds = GetView()->GetViewBounds(); | 2486 gfx::Rect view_bounds = GetView()->GetViewBounds(); |
2486 gfx::Rect snapshot_bounds(view_bounds.size()); | 2487 gfx::Rect snapshot_bounds(view_bounds.size()); |
2487 gfx::Size snapshot_size = snapshot_bounds.size(); | 2488 gfx::Size snapshot_size = snapshot_bounds.size(); |
2488 | 2489 |
2489 if (ui::GrabViewSnapshot( | 2490 if (ui::GrabViewSnapshot( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2551 } | 2552 } |
2552 } | 2553 } |
2553 | 2554 |
2554 // Add newly generated components into the latency info | 2555 // Add newly generated components into the latency info |
2555 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { | 2556 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { |
2556 latency_info->latency_components[lc->first] = lc->second; | 2557 latency_info->latency_components[lc->first] = lc->second; |
2557 } | 2558 } |
2558 } | 2559 } |
2559 | 2560 |
2560 } // namespace content | 2561 } // namespace content |
OLD | NEW |