Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(877)

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 83483007: Expose synthetic delays through the GPU benchmarking extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Forward delays in RenderWidgetHostImpl properly. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
(...skipping 21 matching lines...) Expand all
32 #include "content/browser/renderer_host/dip_util.h" 32 #include "content/browser/renderer_host/dip_util.h"
33 #include "content/browser/renderer_host/input/immediate_input_router.h" 33 #include "content/browser/renderer_host/input/immediate_input_router.h"
34 #include "content/browser/renderer_host/input/synthetic_gesture.h" 34 #include "content/browser/renderer_host/input/synthetic_gesture.h"
35 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" 35 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h"
36 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" 36 #include "content/browser/renderer_host/input/synthetic_gesture_target.h"
37 #include "content/browser/renderer_host/overscroll_controller.h" 37 #include "content/browser/renderer_host/overscroll_controller.h"
38 #include "content/browser/renderer_host/render_process_host_impl.h" 38 #include "content/browser/renderer_host/render_process_host_impl.h"
39 #include "content/browser/renderer_host/render_view_host_impl.h" 39 #include "content/browser/renderer_host/render_view_host_impl.h"
40 #include "content/browser/renderer_host/render_widget_helper.h" 40 #include "content/browser/renderer_host/render_widget_helper.h"
41 #include "content/browser/renderer_host/render_widget_host_delegate.h" 41 #include "content/browser/renderer_host/render_widget_host_delegate.h"
42 #include "content/browser/tracing/tracing_controller_impl.h"
42 #include "content/common/accessibility_messages.h" 43 #include "content/common/accessibility_messages.h"
43 #include "content/common/content_constants_internal.h" 44 #include "content/common/content_constants_internal.h"
44 #include "content/common/gpu/gpu_messages.h" 45 #include "content/common/gpu/gpu_messages.h"
45 #include "content/common/input_messages.h" 46 #include "content/common/input_messages.h"
46 #include "content/common/view_messages.h" 47 #include "content/common/view_messages.h"
47 #include "content/port/browser/render_widget_host_view_port.h" 48 #include "content/port/browser/render_widget_host_view_port.h"
48 #include "content/public/browser/native_web_keyboard_event.h" 49 #include "content/public/browser/native_web_keyboard_event.h"
49 #include "content/public/browser/notification_service.h" 50 #include "content/public/browser/notification_service.h"
50 #include "content/public/browser/notification_types.h" 51 #include "content/public/browser/notification_types.h"
51 #include "content/public/browser/render_widget_host_iterator.h" 52 #include "content/public/browser/render_widget_host_iterator.h"
53 #include "content/public/browser/tracing_synthetic_delay_configuration.h"
52 #include "content/public/browser/user_metrics.h" 54 #include "content/public/browser/user_metrics.h"
53 #include "content/public/common/content_constants.h" 55 #include "content/public/common/content_constants.h"
54 #include "content/public/common/content_switches.h" 56 #include "content/public/common/content_switches.h"
55 #include "content/public/common/result_codes.h" 57 #include "content/public/common/result_codes.h"
56 #include "skia/ext/image_operations.h" 58 #include "skia/ext/image_operations.h"
57 #include "skia/ext/platform_canvas.h" 59 #include "skia/ext/platform_canvas.h"
58 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" 60 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
59 #include "ui/events/event.h" 61 #include "ui/events/event.h"
60 #include "ui/events/keycodes/keyboard_codes.h" 62 #include "ui/events/keycodes/keyboard_codes.h"
61 #include "ui/gfx/size_conversions.h" 63 #include "ui/gfx/size_conversions.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnPaintAtSizeAck) 464 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnPaintAtSizeAck)
463 #if defined(OS_MACOSX) 465 #if defined(OS_MACOSX)
464 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, 466 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped,
465 OnCompositorSurfaceBuffersSwapped) 467 OnCompositorSurfaceBuffersSwapped)
466 #endif 468 #endif
467 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, 469 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame,
468 msg_is_ok = OnSwapCompositorFrame(msg)) 470 msg_is_ok = OnSwapCompositorFrame(msg))
469 IPC_MESSAGE_HANDLER(ViewHostMsg_DidOverscroll, OnOverscrolled) 471 IPC_MESSAGE_HANDLER(ViewHostMsg_DidOverscroll, OnOverscrolled)
470 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) 472 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect)
471 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed) 473 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed)
474 IPC_MESSAGE_HANDLER(ViewHostMsg_ConfigureSyntheticDelays,
475 OnConfigureSyntheticDelays)
472 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnFocus) 476 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnFocus)
473 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnBlur) 477 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnBlur)
474 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) 478 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor)
475 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputTypeChanged, 479 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputTypeChanged,
476 OnTextInputTypeChanged) 480 OnTextInputTypeChanged)
477 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, 481 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition,
478 OnImeCancelComposition) 482 OnImeCancelComposition)
479 IPC_MESSAGE_HANDLER(ViewHostMsg_DidActivateAcceleratedCompositing, 483 IPC_MESSAGE_HANDLER(ViewHostMsg_DidActivateAcceleratedCompositing,
480 OnDidActivateAcceleratedCompositing) 484 OnDidActivateAcceleratedCompositing)
481 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse) 485 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse)
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 return; 1727 return;
1724 synthetic_gesture_controller_.reset( 1728 synthetic_gesture_controller_.reset(
1725 new SyntheticGestureController( 1729 new SyntheticGestureController(
1726 view_->CreateSyntheticGestureTarget().Pass())); 1730 view_->CreateSyntheticGestureTarget().Pass()));
1727 } 1731 }
1728 1732
1729 synthetic_gesture_controller_->QueueSyntheticGesture( 1733 synthetic_gesture_controller_->QueueSyntheticGesture(
1730 SyntheticGesture::Create(*gesture_packet.gesture_params())); 1734 SyntheticGesture::Create(*gesture_packet.gesture_params()));
1731 } 1735 }
1732 1736
1737 void RenderWidgetHostImpl::OnConfigureSyntheticDelays(
1738 const std::vector<content::SyntheticDelayConfiguration>& delays) {
1739 std::vector<content::TracingSyntheticDelayConfiguration> tracing_delays;
1740 for (size_t i = 0; i < delays.size(); i++) {
1741 content::TracingSyntheticDelayConfiguration delay;
1742 delay.name = delays[i].name;
1743 delay.target_duration = delays[i].target_duration;
1744 delay.mode =
1745 static_cast<base::debug::TraceEventSyntheticDelay::Mode>(
1746 delays[i].mode);
1747 tracing_delays.push_back(delay);
1748 }
1749 TracingControllerImpl::GetInstance()->ConfigureSyntheticDelays(
1750 tracing_delays,
1751 base::Bind(&RenderWidgetHostImpl::DidConfigureSyntheticDelays,
1752 weak_factory_.GetWeakPtr()));
1753 }
1754
1733 void RenderWidgetHostImpl::OnFocus() { 1755 void RenderWidgetHostImpl::OnFocus() {
1734 // Only RenderViewHost can deal with that message. 1756 // Only RenderViewHost can deal with that message.
1735 RecordAction(UserMetricsAction("BadMessageTerminate_RWH4")); 1757 RecordAction(UserMetricsAction("BadMessageTerminate_RWH4"));
1736 GetProcess()->ReceivedBadMessage(); 1758 GetProcess()->ReceivedBadMessage();
1737 } 1759 }
1738 1760
1739 void RenderWidgetHostImpl::OnBlur() { 1761 void RenderWidgetHostImpl::OnBlur() {
1740 // Only RenderViewHost can deal with that message. 1762 // Only RenderViewHost can deal with that message.
1741 RecordAction(UserMetricsAction("BadMessageTerminate_RWH5")); 1763 RecordAction(UserMetricsAction("BadMessageTerminate_RWH5"));
1742 GetProcess()->ReceivedBadMessage(); 1764 GetProcess()->ReceivedBadMessage();
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
2457 Send(new ViewMsg_WindowSnapshotCompleted( 2479 Send(new ViewMsg_WindowSnapshotCompleted(
2458 GetRoutingID(), snapshot_id, snapshot_size, png)); 2480 GetRoutingID(), snapshot_id, snapshot_size, png));
2459 return; 2481 return;
2460 } 2482 }
2461 } 2483 }
2462 2484
2463 Send(new ViewMsg_WindowSnapshotCompleted( 2485 Send(new ViewMsg_WindowSnapshotCompleted(
2464 GetRoutingID(), snapshot_id, gfx::Size(), png)); 2486 GetRoutingID(), snapshot_id, gfx::Size(), png));
2465 } 2487 }
2466 2488
2489 void RenderWidgetHostImpl::DidConfigureSyntheticDelays() {
2490 Send(new ViewMsg_ConfigureSyntheticDelaysAck(GetRoutingID()));
2491 }
2492
2467 // static 2493 // static
2468 void RenderWidgetHostImpl::CompositorFrameDrawn( 2494 void RenderWidgetHostImpl::CompositorFrameDrawn(
2469 const ui::LatencyInfo& latency_info) { 2495 const ui::LatencyInfo& latency_info) {
2470 std::set<RenderWidgetHostImpl*> rwhi_set; 2496 std::set<RenderWidgetHostImpl*> rwhi_set;
2471 2497
2472 for (ui::LatencyInfo::LatencyMap::const_iterator b = 2498 for (ui::LatencyInfo::LatencyMap::const_iterator b =
2473 latency_info.latency_components.begin(); 2499 latency_info.latency_components.begin();
2474 b != latency_info.latency_components.end(); 2500 b != latency_info.latency_components.end();
2475 ++b) { 2501 ++b) {
2476 if (b->first.first == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT || 2502 if (b->first.first == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT ||
2477 b->first.first == ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT) { 2503 b->first.first == ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT) {
2478 // Matches with GetLatencyComponentId 2504 // Matches with GetLatencyComponentId
2479 int routing_id = b->first.second & 0xffffffff; 2505 int routing_id = b->first.second & 0xffffffff;
2480 int process_id = (b->first.second >> 32) & 0xffffffff; 2506 int process_id = (b->first.second >> 32) & 0xffffffff;
2481 RenderWidgetHost* rwh = 2507 RenderWidgetHost* rwh =
2482 RenderWidgetHost::FromID(process_id, routing_id); 2508 RenderWidgetHost::FromID(process_id, routing_id);
2483 if (!rwh) { 2509 if (!rwh) {
2484 continue; 2510 continue;
2485 } 2511 }
2486 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); 2512 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh);
2487 if (rwhi_set.insert(rwhi).second) 2513 if (rwhi_set.insert(rwhi).second)
2488 rwhi->FrameSwapped(latency_info); 2514 rwhi->FrameSwapped(latency_info);
2489 } 2515 }
2490 } 2516 }
2491 } 2517 }
2492 2518
2493 } // namespace content 2519 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/common/synthetic_delay_configuration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698