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

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

Issue 13931009: Add latency info to input events sent to RenderWidget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/logging.h" 10 #include "base/logging.h"
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 if (!animation_update_pending_ && !paint_aggregator_.HasPendingUpdate()) { 696 if (!animation_update_pending_ && !paint_aggregator_.HasPendingUpdate()) {
697 TRACE_EVENT0("renderer", "EarlyOut_NoPendingUpdate"); 697 TRACE_EVENT0("renderer", "EarlyOut_NoPendingUpdate");
698 return; 698 return;
699 } 699 }
700 700
701 // Continue painting if necessary... 701 // Continue painting if necessary...
702 DoDeferredUpdateAndSendInputAck(); 702 DoDeferredUpdateAndSendInputAck();
703 } 703 }
704 704
705 void RenderWidget::OnHandleInputEvent(const WebKit::WebInputEvent* input_event, 705 void RenderWidget::OnHandleInputEvent(const WebKit::WebInputEvent* input_event,
706 const cc::LatencyInfo& latency_info,
706 bool is_keyboard_shortcut) { 707 bool is_keyboard_shortcut) {
707 TRACE_EVENT0("renderer", "RenderWidget::OnHandleInputEvent"); 708 TRACE_EVENT0("renderer", "RenderWidget::OnHandleInputEvent");
708 709
709 handling_input_event_ = true; 710 handling_input_event_ = true;
710 if (!input_event) { 711 if (!input_event) {
711 handling_input_event_ = false; 712 handling_input_event_ = false;
712 return; 713 return;
713 } 714 }
714 715
716 if (compositor_)
717 compositor_->SetLatencyInfo(latency_info);
718
715 base::TimeDelta now = base::TimeDelta::FromInternalValue( 719 base::TimeDelta now = base::TimeDelta::FromInternalValue(
716 base::TimeTicks::Now().ToInternalValue()); 720 base::TimeTicks::Now().ToInternalValue());
717 721
718 int64 delta = static_cast<int64>( 722 int64 delta = static_cast<int64>(
719 (now.InSecondsF() - input_event->timeStampSeconds) * 723 (now.InSecondsF() - input_event->timeStampSeconds) *
720 base::Time::kMicrosecondsPerSecond); 724 base::Time::kMicrosecondsPerSecond);
721 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Renderer", delta, 0, 1000000, 100); 725 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Renderer", delta, 0, 1000000, 100);
722 std::string name_for_event = 726 std::string name_for_event =
723 base::StringPrintf("Event.Latency.Renderer.%s", 727 base::StringPrintf("Event.Latency.Renderer.%s",
724 GetEventName(input_event->type)); 728 GetEventName(input_event->type));
(...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after
2343 2347
2344 if (!context->Initialize( 2348 if (!context->Initialize(
2345 attributes, 2349 attributes,
2346 false /* bind generates resources */, 2350 false /* bind generates resources */,
2347 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ) 2351 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) )
2348 return NULL; 2352 return NULL;
2349 return context.release(); 2353 return context.release();
2350 } 2354 }
2351 2355
2352 } // namespace content 2356 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698