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

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

Issue 2886283004: input: Fix running the completion callback for telemetry gesture. (Closed)
Patch Set: . Created 3 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
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 8
9 #include <set> 9 #include <set>
10 #include <tuple> 10 #include <tuple>
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 } 1309 }
1310 input_router_->SendKeyboardEvent(key_event_with_latency); 1310 input_router_->SendKeyboardEvent(key_event_with_latency);
1311 } 1311 }
1312 1312
1313 void RenderWidgetHostImpl::QueueSyntheticGesture( 1313 void RenderWidgetHostImpl::QueueSyntheticGesture(
1314 std::unique_ptr<SyntheticGesture> synthetic_gesture, 1314 std::unique_ptr<SyntheticGesture> synthetic_gesture,
1315 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { 1315 const base::Callback<void(SyntheticGesture::Result)>& on_complete) {
1316 if (!synthetic_gesture_controller_ && view_) { 1316 if (!synthetic_gesture_controller_ && view_) {
1317 synthetic_gesture_controller_ = 1317 synthetic_gesture_controller_ =
1318 base::MakeUnique<SyntheticGestureController>( 1318 base::MakeUnique<SyntheticGestureController>(
1319 view_->CreateSyntheticGestureTarget(), 1319 this, view_->CreateSyntheticGestureTarget());
1320 base::Bind(
1321 &RenderWidgetHostImpl::RequestBeginFrameForSynthesizedInput,
1322 base::Unretained(this)));
1323 } 1320 }
1324 if (synthetic_gesture_controller_) { 1321 if (synthetic_gesture_controller_) {
1325 synthetic_gesture_controller_->QueueSyntheticGesture( 1322 synthetic_gesture_controller_->QueueSyntheticGesture(
1326 std::move(synthetic_gesture), on_complete); 1323 std::move(synthetic_gesture), on_complete);
1327 } 1324 }
1328 } 1325 }
1329 1326
1330 void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) { 1327 void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) {
1331 if (!view_) 1328 if (!view_)
1332 return; 1329 return;
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 weak_factory_.GetWeakPtr(), sequence_number), 1854 weak_factory_.GetWeakPtr(), sequence_number),
1858 base::TimeDelta::FromSecondsD(1. / 6)); 1855 base::TimeDelta::FromSecondsD(1. / 6));
1859 #else 1856 #else
1860 WindowSnapshotReachedScreen(sequence_number); 1857 WindowSnapshotReachedScreen(sequence_number);
1861 #endif 1858 #endif
1862 } 1859 }
1863 1860
1864 latency_tracker_.OnGpuSwapBuffersCompleted(latency_info); 1861 latency_tracker_.OnGpuSwapBuffersCompleted(latency_info);
1865 } 1862 }
1866 1863
1867 void RenderWidgetHostImpl::RequestBeginFrameForSynthesizedInput(
1868 base::OnceClosure begin_frame_callback) {
1869 DCHECK(view_);
1870 begin_frame_callback_ = std::move(begin_frame_callback);
1871 view_->OnSetNeedsFlushInput();
1872 }
1873
1874 void RenderWidgetHostImpl::OnRenderProcessGone(int status, int exit_code) { 1864 void RenderWidgetHostImpl::OnRenderProcessGone(int status, int exit_code) {
1875 // RenderFrameHost owns a RenderWidgetHost when it needs one, in which case 1865 // RenderFrameHost owns a RenderWidgetHost when it needs one, in which case
1876 // it handles destruction. 1866 // it handles destruction.
1877 if (!owned_by_render_frame_host_) { 1867 if (!owned_by_render_frame_host_) {
1878 // TODO(evanm): This synchronously ends up calling "delete this". 1868 // TODO(evanm): This synchronously ends up calling "delete this".
1879 // Is that really what we want in response to this message? I'm matching 1869 // Is that really what we want in response to this message? I'm matching
1880 // previous behavior of the code here. 1870 // previous behavior of the code here.
1881 Destroy(true); 1871 Destroy(true);
1882 } else { 1872 } else {
1883 RendererExited(static_cast<base::TerminationStatus>(status), exit_code); 1873 RendererExited(static_cast<base::TerminationStatus>(status), exit_code);
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
2550 else 2540 else
2551 compositor_frame_sink_binding_.Bind(std::move(request)); 2541 compositor_frame_sink_binding_.Bind(std::move(request));
2552 #else 2542 #else
2553 compositor_frame_sink_binding_.Bind(std::move(request)); 2543 compositor_frame_sink_binding_.Bind(std::move(request));
2554 #endif 2544 #endif
2555 if (view_) 2545 if (view_)
2556 view_->DidCreateNewRendererCompositorFrameSink(client.get()); 2546 view_->DidCreateNewRendererCompositorFrameSink(client.get());
2557 renderer_compositor_frame_sink_ = std::move(client); 2547 renderer_compositor_frame_sink_ = std::move(client);
2558 } 2548 }
2559 2549
2550 void RenderWidgetHostImpl::RequestBeginFrameForSynthesizedInput(
2551 base::OnceClosure begin_frame_callback) {
2552 DCHECK(view_);
2553 begin_frame_callback_ = std::move(begin_frame_callback);
2554 view_->OnSetNeedsFlushInput();
2555 }
2556
2557 bool RenderWidgetHostImpl::HasGestureStopped() {
2558 return !input_router_->HasPendingEvents();
2559 }
2560
2560 void RenderWidgetHostImpl::SetNeedsBeginFrame(bool needs_begin_frame) { 2561 void RenderWidgetHostImpl::SetNeedsBeginFrame(bool needs_begin_frame) {
2561 OnSetNeedsBeginFrames(needs_begin_frame); 2562 OnSetNeedsBeginFrames(needs_begin_frame);
2562 } 2563 }
2563 2564
2564 void RenderWidgetHostImpl::SubmitCompositorFrame( 2565 void RenderWidgetHostImpl::SubmitCompositorFrame(
2565 const cc::LocalSurfaceId& local_surface_id, 2566 const cc::LocalSurfaceId& local_surface_id,
2566 cc::CompositorFrame frame) { 2567 cc::CompositorFrame frame) {
2567 auto new_surface_properties = 2568 auto new_surface_properties =
2568 RenderWidgetSurfaceProperties::FromCompositorFrame(frame); 2569 RenderWidgetSurfaceProperties::FromCompositorFrame(frame);
2569 2570
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2643 RenderProcessHost* rph = GetProcess(); 2644 RenderProcessHost* rph = GetProcess();
2644 for (std::vector<IPC::Message>::const_iterator i = messages.begin(); 2645 for (std::vector<IPC::Message>::const_iterator i = messages.begin();
2645 i != messages.end(); ++i) { 2646 i != messages.end(); ++i) {
2646 rph->OnMessageReceived(*i); 2647 rph->OnMessageReceived(*i);
2647 if (i->dispatch_error()) 2648 if (i->dispatch_error())
2648 rph->OnBadMessageReceived(*i); 2649 rph->OnBadMessageReceived(*i);
2649 } 2650 }
2650 } 2651 }
2651 2652
2652 } // namespace content 2653 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698