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

Side by Side Diff: content/renderer/render_widget.cc

Issue 252663002: Track plugin input event latency (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add more comments Created 6 years, 8 months 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
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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/debug/trace_event_synthetic_delay.h" 10 #include "base/debug/trace_event_synthetic_delay.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 popup_type_(popup_type), 378 popup_type_(popup_type),
379 pending_window_rect_count_(0), 379 pending_window_rect_count_(0),
380 suppress_next_char_events_(false), 380 suppress_next_char_events_(false),
381 is_accelerated_compositing_active_(false), 381 is_accelerated_compositing_active_(false),
382 was_accelerated_compositing_ever_active_(false), 382 was_accelerated_compositing_ever_active_(false),
383 animation_update_pending_(false), 383 animation_update_pending_(false),
384 invalidation_task_posted_(false), 384 invalidation_task_posted_(false),
385 screen_info_(screen_info), 385 screen_info_(screen_info),
386 device_scale_factor_(screen_info_.deviceScaleFactor), 386 device_scale_factor_(screen_info_.deviceScaleFactor),
387 is_threaded_compositing_enabled_(false), 387 is_threaded_compositing_enabled_(false),
388 current_event_latency_info_(NULL),
388 next_output_surface_id_(0), 389 next_output_surface_id_(0),
389 #if defined(OS_ANDROID) 390 #if defined(OS_ANDROID)
390 text_field_is_dirty_(false), 391 text_field_is_dirty_(false),
391 outstanding_ime_acks_(0), 392 outstanding_ime_acks_(0),
392 #endif 393 #endif
393 popup_origin_scale_for_emulation_(0.f), 394 popup_origin_scale_for_emulation_(0.f),
394 resizing_mode_selector_(new ResizingModeSelector()), 395 resizing_mode_selector_(new ResizingModeSelector()),
395 context_menu_source_type_(ui::MENU_SOURCE_MOUSE) { 396 context_menu_source_type_(ui::MENU_SOURCE_MOUSE) {
396 if (!swapped_out) 397 if (!swapped_out)
397 RenderProcess::current()->AddRefProcess(); 398 RenderProcess::current()->AddRefProcess();
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 926
926 void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event, 927 void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event,
927 const ui::LatencyInfo& latency_info, 928 const ui::LatencyInfo& latency_info,
928 bool is_keyboard_shortcut) { 929 bool is_keyboard_shortcut) {
929 handling_input_event_ = true; 930 handling_input_event_ = true;
930 if (!input_event) { 931 if (!input_event) {
931 handling_input_event_ = false; 932 handling_input_event_ = false;
932 return; 933 return;
933 } 934 }
934 935
936 current_event_latency_info_ = &latency_info;
piman 2014/04/25 01:59:43 I fear potential early outs (some could be added l
Yufeng Shen (Slow to review) 2014/04/25 20:42:42 Done.
937
935 base::TimeTicks start_time; 938 base::TimeTicks start_time;
936 if (base::TimeTicks::IsHighResNowFastAndReliable()) 939 if (base::TimeTicks::IsHighResNowFastAndReliable())
937 start_time = base::TimeTicks::HighResNow(); 940 start_time = base::TimeTicks::HighResNow();
938 941
939 const char* const event_name = 942 const char* const event_name =
940 WebInputEventTraits::GetName(input_event->type); 943 WebInputEventTraits::GetName(input_event->type);
941 TRACE_EVENT1("renderer", "RenderWidget::OnHandleInputEvent", 944 TRACE_EVENT1("renderer", "RenderWidget::OnHandleInputEvent",
942 "event", event_name); 945 "event", event_name);
943 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("blink.HandleInputEvent"); 946 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("blink.HandleInputEvent");
944 TRACE_EVENT_FLOW_STEP0( 947 TRACE_EVENT_FLOW_STEP0(
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); 1112 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME);
1110 #elif defined(USE_AURA) 1113 #elif defined(USE_AURA)
1111 // Show the virtual keyboard if enabled and a user gesture triggers a focus 1114 // Show the virtual keyboard if enabled and a user gesture triggers a focus
1112 // change. 1115 // change.
1113 if (processed && (input_event->type == WebInputEvent::TouchEnd || 1116 if (processed && (input_event->type == WebInputEvent::TouchEnd ||
1114 input_event->type == WebInputEvent::MouseUp)) 1117 input_event->type == WebInputEvent::MouseUp))
1115 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_IME); 1118 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_IME);
1116 #endif 1119 #endif
1117 1120
1118 TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent"); 1121 TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent");
1122 current_event_latency_info_ = NULL;
1119 handling_input_event_ = false; 1123 handling_input_event_ = false;
1120 1124
1121 if (!prevent_default) { 1125 if (!prevent_default) {
1122 if (WebInputEvent::isKeyboardEventType(input_event->type)) 1126 if (WebInputEvent::isKeyboardEventType(input_event->type))
1123 DidHandleKeyEvent(); 1127 DidHandleKeyEvent();
1124 if (WebInputEvent::isMouseEventType(input_event->type)) 1128 if (WebInputEvent::isMouseEventType(input_event->type))
1125 DidHandleMouseEvent(*(static_cast<const WebMouseEvent*>(input_event))); 1129 DidHandleMouseEvent(*(static_cast<const WebMouseEvent*>(input_event)));
1126 if (WebInputEvent::isTouchEventType(input_event->type)) 1130 if (WebInputEvent::isTouchEventType(input_event->type))
1127 DidHandleTouchEvent(*(static_cast<const WebTouchEvent*>(input_event))); 1131 DidHandleTouchEvent(*(static_cast<const WebTouchEvent*>(input_event)));
1128 } 1132 }
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
2368 2372
2369 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { 2373 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) {
2370 swapped_out_frames_.AddObserver(frame); 2374 swapped_out_frames_.AddObserver(frame);
2371 } 2375 }
2372 2376
2373 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { 2377 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) {
2374 swapped_out_frames_.RemoveObserver(frame); 2378 swapped_out_frames_.RemoveObserver(frame);
2375 } 2379 }
2376 2380
2377 } // namespace content 2381 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698