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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 1984173002: Log First User Interaction in Page Load Metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only record user interaction after first paint Created 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index f43e3f85938712b86791115ae17e4877f1c3a7fb..02e20a13068706b0d4b3ced62b20232ba63a1db6 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -111,15 +111,13 @@ base::LazyInstance<RoutingIDWidgetMap> g_routing_id_widget_map =
// iteration (or NULL if there isn't any left).
class RenderWidgetHostIteratorImpl : public RenderWidgetHostIterator {
public:
- RenderWidgetHostIteratorImpl()
- : current_index_(0) {
- }
+ RenderWidgetHostIteratorImpl() : current_index_(0) {}
~RenderWidgetHostIteratorImpl() override {}
void Add(RenderWidgetHost* host) {
- hosts_.push_back(RenderWidgetHostID(host->GetProcess()->GetID(),
- host->GetRoutingID()));
+ hosts_.push_back(
+ RenderWidgetHostID(host->GetProcess()->GetID(), host->GetRoutingID()));
}
// RenderWidgetHostIterator:
@@ -229,9 +227,8 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
latency_tracker_.Initialize(routing_id_, GetProcess()->GetID());
- input_router_.reset(new InputRouterImpl(
- process_->GetImmediateSender(), this, this, routing_id_,
- GetInputRouterConfigForPlatform()));
+ input_router_.reset(new InputRouterImpl(process_, this, this, routing_id_,
+ GetInputRouterConfigForPlatform()));
touch_emulator_.reset();
@@ -255,20 +252,18 @@ RenderWidgetHostImpl::~RenderWidgetHostImpl() {
}
// static
-RenderWidgetHost* RenderWidgetHost::FromID(
- int32_t process_id,
- int32_t routing_id) {
+RenderWidgetHost* RenderWidgetHost::FromID(int32_t process_id,
+ int32_t routing_id) {
return RenderWidgetHostImpl::FromID(process_id, routing_id);
}
// static
-RenderWidgetHostImpl* RenderWidgetHostImpl::FromID(
- int32_t process_id,
- int32_t routing_id) {
+RenderWidgetHostImpl* RenderWidgetHostImpl::FromID(int32_t process_id,
+ int32_t routing_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
RoutingIDWidgetMap* widgets = g_routing_id_widget_map.Pointer();
- RoutingIDWidgetMap::iterator it = widgets->find(
- RenderWidgetHostID(process_id, routing_id));
+ RoutingIDWidgetMap::iterator it =
+ widgets->find(RenderWidgetHostID(process_id, routing_id));
return it == widgets->end() ? NULL : it->second;
}
@@ -341,8 +336,8 @@ RenderWidgetHostViewBase* RenderWidgetHostImpl::GetView() const {
void RenderWidgetHostImpl::ResetSizeAndRepaintPendingFlags() {
resize_ack_pending_ = false;
if (repaint_ack_pending_) {
- TRACE_EVENT_ASYNC_END0(
- "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this);
+ TRACE_EVENT_ASYNC_END0("renderer_host",
+ "RenderWidgetHostImpl::repaint_ack_pending_", this);
}
repaint_ack_pending_ = false;
if (old_resize_params_)
@@ -364,8 +359,8 @@ void RenderWidgetHostImpl::SendScreenRects() {
last_view_screen_rect_ = view_->GetViewBounds();
last_window_screen_rect_ = view_->GetBoundsInRootWindow();
- Send(new ViewMsg_UpdateScreenRects(
- GetRoutingID(), last_view_screen_rect_, last_window_screen_rect_));
+ Send(new ViewMsg_UpdateScreenRects(GetRoutingID(), last_view_screen_rect_,
+ last_window_screen_rect_));
waiting_for_screen_rects_ack_ = true;
}
@@ -424,7 +419,7 @@ bool RenderWidgetHostImpl::IsLoading() const {
return is_loading_;
}
-bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) {
+bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message& msg) {
// Only process messages if the RenderWidget is alive.
if (!renderer_initialized())
return false;
@@ -512,8 +507,7 @@ void RenderWidgetHostImpl::WasHidden() {
bool is_visible = false;
NotificationService::current()->Notify(
NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
- Source<RenderWidgetHost>(this),
- Details<bool>(&is_visible));
+ Source<RenderWidgetHost>(this), Details<bool>(&is_visible));
}
void RenderWidgetHostImpl::WasShown(const ui::LatencyInfo& latency_info) {
@@ -540,8 +534,7 @@ void RenderWidgetHostImpl::WasShown(const ui::LatencyInfo& latency_info) {
bool is_visible = true;
NotificationService::current()->Notify(
NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
- Source<RenderWidgetHost>(this),
- Details<bool>(&is_visible));
+ Source<RenderWidgetHost>(this), Details<bool>(&is_visible));
// It's possible for our size to be out of sync with the renderer. The
// following is one case that leads to this:
@@ -589,7 +582,8 @@ bool RenderWidgetHostImpl::GetResizeParams(ResizeParams* resize_params) {
old_resize_params_->new_size != resize_params->new_size ||
(old_resize_params_->physical_backing_size.IsEmpty() &&
!resize_params->physical_backing_size.IsEmpty());
- bool dirty = size_changed ||
+ bool dirty =
+ size_changed ||
old_resize_params_->screen_info != resize_params->screen_info ||
old_resize_params_->physical_backing_size !=
resize_params->physical_backing_size ||
@@ -649,17 +643,17 @@ void RenderWidgetHostImpl::WasResized() {
void RenderWidgetHostImpl::DispatchColorProfile() {
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
- static bool image_profiles = base::CommandLine::ForCurrentProcess()->
- HasSwitch(switches::kEnableImageColorProfiles);
+ static bool image_profiles =
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableImageColorProfiles);
if (!image_profiles)
return;
#if defined(OS_WIN)
// Windows will read disk to get the color profile data if needed, so
// dispatch the SendColorProfile() work off the UI thread.
BrowserThread::PostBlockingPoolTask(
- FROM_HERE,
- base::Bind(&RenderWidgetHostImpl::SendColorProfile,
- weak_factory_.GetWeakPtr()));
+ FROM_HERE, base::Bind(&RenderWidgetHostImpl::SendColorProfile,
+ weak_factory_.GetWeakPtr()));
#elif !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
// Only support desktop Mac and Linux at this time.
SendColorProfile();
@@ -763,10 +757,12 @@ void RenderWidgetHostImpl::CopyFromBackingStore(
const ReadbackRequestCallback& callback,
const SkColorType preferred_color_type) {
if (view_) {
- TRACE_EVENT0("browser",
+ TRACE_EVENT0(
+ "browser",
"RenderWidgetHostImpl::CopyFromBackingStore::FromCompositingSurface");
- gfx::Rect accelerated_copy_rect = src_subrect.IsEmpty() ?
- gfx::Rect(view_->GetViewBounds().size()) : src_subrect;
+ gfx::Rect accelerated_copy_rect =
+ src_subrect.IsEmpty() ? gfx::Rect(view_->GetViewBounds().size())
+ : src_subrect;
view_->CopyFromCompositingSurface(accelerated_copy_rect,
accelerated_dst_size, callback,
preferred_color_type);
@@ -795,7 +791,7 @@ void RenderWidgetHostImpl::UnlockBackingStore() {
#if defined(OS_MACOSX)
void RenderWidgetHostImpl::PauseForPendingResizeOrRepaints() {
TRACE_EVENT0("browser",
- "RenderWidgetHostImpl::PauseForPendingResizeOrRepaints");
+ "RenderWidgetHostImpl::PauseForPendingResizeOrRepaints");
if (!CanPauseForPendingResizeOrRepaints())
return;
@@ -836,11 +832,8 @@ void RenderWidgetHostImpl::WaitForSurface() {
view_size = view_rect.size();
}
- TRACE_EVENT2("renderer_host",
- "RenderWidgetHostImpl::WaitForSurface",
- "width",
- base::IntToString(view_size.width()),
- "height",
+ TRACE_EVENT2("renderer_host", "RenderWidgetHostImpl::WaitForSurface", "width",
+ base::IntToString(view_size.width()), "height",
base::IntToString(view_size.height()));
// We should not be asked to paint while we are hidden. If we are hidden,
@@ -850,8 +843,8 @@ void RenderWidgetHostImpl::WaitForSurface() {
// We should never be called recursively; this can theoretically lead to
// infinite recursion and almost certainly leads to lower performance.
DCHECK(!in_get_backing_store_) << "WaitForSurface called recursively!";
- base::AutoReset<bool> auto_reset_in_get_backing_store(
- &in_get_backing_store_, true);
+ base::AutoReset<bool> auto_reset_in_get_backing_store(&in_get_backing_store_,
+ true);
// We might have a surface that we can use already.
if (view_->HasAcceleratedSurface(view_size))
@@ -900,8 +893,8 @@ bool RenderWidgetHostImpl::ScheduleComposite() {
// Send out a request to the renderer to paint the view if required.
repaint_start_time_ = TimeTicks::Now();
repaint_ack_pending_ = true;
- TRACE_EVENT_ASYNC_BEGIN0(
- "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this);
+ TRACE_EVENT_ASYNC_BEGIN0("renderer_host",
+ "RenderWidgetHostImpl::repaint_ack_pending_", this);
Send(new ViewMsg_Repaint(routing_id_, current_size_));
return true;
}
@@ -957,10 +950,10 @@ void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) {
}
void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo(
- const blink::WebMouseEvent& mouse_event,
- const ui::LatencyInfo& ui_latency) {
- TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent",
- "x", mouse_event.x, "y", mouse_event.y);
+ const blink::WebMouseEvent& mouse_event,
+ const ui::LatencyInfo& ui_latency) {
+ TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", "x",
+ mouse_event.x, "y", mouse_event.y);
for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) {
if (mouse_event_callbacks_[i].Run(mouse_event))
@@ -976,6 +969,8 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo(
MouseEventWithLatencyInfo mouse_with_latency(mouse_event, ui_latency);
latency_tracker_.OnInputEvent(mouse_event, &mouse_with_latency.latency);
input_router_->SendMouseEvent(mouse_with_latency);
+ FOR_EACH_OBSERVER(InputEventObserver, input_event_observers_,
+ OnInputEvent(mouse_event));
}
void RenderWidgetHostImpl::ForwardWheelEvent(
@@ -984,10 +979,10 @@ void RenderWidgetHostImpl::ForwardWheelEvent(
}
void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo(
- const blink::WebMouseWheelEvent& wheel_event,
- const ui::LatencyInfo& ui_latency) {
- TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardWheelEvent",
- "dx", wheel_event.deltaX, "dy", wheel_event.deltaY);
+ const blink::WebMouseWheelEvent& wheel_event,
+ const ui::LatencyInfo& ui_latency) {
+ TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardWheelEvent", "dx",
+ wheel_event.deltaX, "dy", wheel_event.deltaY);
if (ShouldDropInputEvents())
return;
@@ -998,6 +993,8 @@ void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo(
MouseWheelEventWithLatencyInfo wheel_with_latency(wheel_event, ui_latency);
latency_tracker_.OnInputEvent(wheel_event, &wheel_with_latency.latency);
input_router_->SendWheelEvent(wheel_with_latency);
+ FOR_EACH_OBSERVER(InputEventObserver, input_event_observers_,
+ OnInputEvent(wheel_event));
}
void RenderWidgetHostImpl::ForwardEmulatedGestureEvent(
@@ -1054,6 +1051,8 @@ void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo(
GestureEventWithLatencyInfo gesture_with_latency(gesture_event, ui_latency);
latency_tracker_.OnInputEvent(gesture_event, &gesture_with_latency.latency);
input_router_->SendGestureEvent(gesture_with_latency);
+ FOR_EACH_OBSERVER(InputEventObserver, input_event_observers_,
+ OnInputEvent(gesture_event));
if (scroll_update_needs_wrapping) {
ForwardGestureEventWithLatencyInfo(
@@ -1062,17 +1061,19 @@ void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo(
}
void RenderWidgetHostImpl::ForwardEmulatedTouchEvent(
- const blink::WebTouchEvent& touch_event) {
+ const blink::WebTouchEvent& touch_event) {
TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardEmulatedTouchEvent");
TouchEventWithLatencyInfo touch_with_latency(touch_event);
latency_tracker_.OnInputEvent(touch_event, &touch_with_latency.latency);
input_router_->SendTouchEvent(touch_with_latency);
+ FOR_EACH_OBSERVER(InputEventObserver, input_event_observers_,
+ OnInputEvent(touch_event));
}
void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo(
- const blink::WebTouchEvent& touch_event,
- const ui::LatencyInfo& ui_latency) {
+ const blink::WebTouchEvent& touch_event,
+ const ui::LatencyInfo& ui_latency) {
TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent");
// Always forward TouchEvents for touch stream consistency. They will be
@@ -1082,14 +1083,16 @@ void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo(
if (touch_emulator_ &&
touch_emulator_->HandleTouchEvent(touch_with_latency.event)) {
if (view_) {
- view_->ProcessAckedTouchEvent(
- touch_with_latency, INPUT_EVENT_ACK_STATE_CONSUMED);
+ view_->ProcessAckedTouchEvent(touch_with_latency,
+ INPUT_EVENT_ACK_STATE_CONSUMED);
}
return;
}
latency_tracker_.OnInputEvent(touch_event, &touch_with_latency.latency);
input_router_->SendTouchEvent(touch_with_latency);
+ FOR_EACH_OBSERVER(InputEventObserver, input_event_observers_,
+ OnInputEvent(touch_event));
}
void RenderWidgetHostImpl::ForwardKeyboardEvent(
@@ -1159,6 +1162,8 @@ void RenderWidgetHostImpl::ForwardKeyboardEvent(
key_event_with_latency.event.isBrowserShortcut = is_shortcut;
latency_tracker_.OnInputEvent(key_event, &key_event_with_latency.latency);
input_router_->SendKeyboardEvent(key_event_with_latency);
+ FOR_EACH_OBSERVER(InputEventObserver, input_event_observers_,
+ OnInputEvent(key_event));
}
void RenderWidgetHostImpl::QueueSyntheticGesture(
@@ -1181,8 +1186,8 @@ void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) {
}
void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) {
- Send(new ViewMsg_ShowContextMenu(
- GetRoutingID(), ui::MENU_SOURCE_MOUSE, point));
+ Send(new ViewMsg_ShowContextMenu(GetRoutingID(), ui::MENU_SOURCE_MOUSE,
+ point));
}
void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) {
@@ -1207,8 +1212,7 @@ void RenderWidgetHostImpl::RemoveKeyPressEventCallback(
const KeyPressEventCallback& callback) {
for (size_t i = 0; i < key_press_event_callbacks_.size(); ++i) {
if (key_press_event_callbacks_[i].Equals(callback)) {
- key_press_event_callbacks_.erase(
- key_press_event_callbacks_.begin() + i);
+ key_press_event_callbacks_.erase(key_press_event_callbacks_.begin() + i);
return;
}
}
@@ -1229,6 +1233,16 @@ void RenderWidgetHostImpl::RemoveMouseEventCallback(
}
}
+void RenderWidgetHostImpl::AddInputEventObserver(
+ RenderWidgetHost::InputEventObserver* observer) {
+ input_event_observers_.AddObserver(observer);
+}
+
+void RenderWidgetHostImpl::RemoveInputEventObserver(
+ RenderWidgetHost::InputEventObserver* observer) {
+ input_event_observers_.RemoveObserver(observer);
+}
+
void RenderWidgetHostImpl::GetWebScreenInfo(blink::WebScreenInfo* result) {
TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::GetWebScreenInfo");
if (view_)
@@ -1275,8 +1289,8 @@ void RenderWidgetHostImpl::GetSnapshotFromBrowser(
Send(new ViewMsg_ForceRedraw(GetRoutingID(), id));
}
-const NativeWebKeyboardEvent*
- RenderWidgetHostImpl::GetLastKeyboardEvent() const {
+const NativeWebKeyboardEvent* RenderWidgetHostImpl::GetLastKeyboardEvent()
+ const {
return input_router_->GetLastKeyboardEvent();
}
@@ -1349,9 +1363,8 @@ void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status,
// renderer. Otherwise it may be stuck waiting for the old renderer to ack an
// event. (In particular, the above call to view_->RenderProcessGone will
// destroy the aura window, which may dispatch a synthetic mouse move.)
- input_router_.reset(new InputRouterImpl(
- process_->GetImmediateSender(), this, this, routing_id_,
- GetInputRouterConfigForPlatform()));
+ input_router_.reset(new InputRouterImpl(process_, this, this, routing_id_,
+ GetInputRouterConfigForPlatform()));
synthetic_gesture_controller_.reset();
}
@@ -1381,23 +1394,24 @@ void RenderWidgetHostImpl::ImeSetComposition(
const gfx::Range& replacement_range,
int selection_start,
int selection_end) {
- Send(new InputMsg_ImeSetComposition(
- GetRoutingID(), text, underlines, replacement_range,
- selection_start, selection_end));
+ Send(new InputMsg_ImeSetComposition(GetRoutingID(), text, underlines,
+ replacement_range, selection_start,
+ selection_end));
}
void RenderWidgetHostImpl::ImeConfirmComposition(
const base::string16& text,
const gfx::Range& replacement_range,
bool keep_selection) {
- Send(new InputMsg_ImeConfirmComposition(
- GetRoutingID(), text, replacement_range, keep_selection));
+ Send(new InputMsg_ImeConfirmComposition(GetRoutingID(), text,
+ replacement_range, keep_selection));
}
void RenderWidgetHostImpl::ImeCancelComposition() {
- Send(new InputMsg_ImeSetComposition(GetRoutingID(), base::string16(),
- std::vector<blink::WebCompositionUnderline>(),
- gfx::Range::InvalidRange(), 0, 0));
+ Send(new InputMsg_ImeSetComposition(
+ GetRoutingID(), base::string16(),
+ std::vector<blink::WebCompositionUnderline>(), gfx::Range::InvalidRange(),
+ 0, 0));
}
void RenderWidgetHostImpl::RejectMouseLockOrUnlockIfNecessary() {
@@ -1453,10 +1467,9 @@ void RenderWidgetHostImpl::Destroy(bool also_delete) {
}
void RenderWidgetHostImpl::RendererIsUnresponsive() {
- NotificationService::current()->Notify(
- NOTIFICATION_RENDER_WIDGET_HOST_HANG,
- Source<RenderWidgetHost>(this),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(NOTIFICATION_RENDER_WIDGET_HOST_HANG,
+ Source<RenderWidgetHost>(this),
+ NotificationService::NoDetails());
is_unresponsive_ = true;
if (delegate_)
delegate_->RendererUnresponsive(this);
@@ -1551,8 +1564,7 @@ void RenderWidgetHostImpl::OnRequestMove(const gfx::Rect& pos) {
}
}
-bool RenderWidgetHostImpl::OnSwapCompositorFrame(
- const IPC::Message& message) {
+bool RenderWidgetHostImpl::OnSwapCompositorFrame(const IPC::Message& message) {
// This trace event is used in
// chrome/browser/extensions/api/cast_streaming/performance_test.cc
TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame");
@@ -1588,8 +1600,7 @@ bool RenderWidgetHostImpl::OnSwapCompositorFrame(
ack.gl_frame_data->sync_token.Clear();
} else if (frame->delegated_frame_data) {
cc::TransferableResource::ReturnResources(
- frame->delegated_frame_data->resource_list,
- &ack.resources);
+ frame->delegated_frame_data->resource_list, &ack.resources);
}
SendSwapCompositorFrameAck(routing_id_, output_surface_id,
process_->GetID(), ack);
@@ -1598,8 +1609,7 @@ bool RenderWidgetHostImpl::OnSwapCompositorFrame(
RenderProcessHost* rph = GetProcess();
for (std::vector<IPC::Message>::const_iterator i =
messages_to_deliver_with_frame.begin();
- i != messages_to_deliver_with_frame.end();
- ++i) {
+ i != messages_to_deliver_with_frame.end(); ++i) {
rph->OnMessageReceived(*i);
if (i->dispatch_error())
rph->OnBadMessageReceived(*i);
@@ -1631,8 +1641,8 @@ void RenderWidgetHostImpl::OnUpdateRect(
ViewHostMsg_UpdateRect_Flags::is_repaint_ack(params.flags);
if (is_repaint_ack) {
DCHECK(repaint_ack_pending_);
- TRACE_EVENT_ASYNC_END0(
- "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this);
+ TRACE_EVENT_ASYNC_END0("renderer_host",
+ "RenderWidgetHostImpl::repaint_ack_pending_", this);
repaint_ack_pending_ = false;
TimeDelta delta = TimeTicks::Now() - repaint_start_time_;
UMA_HISTOGRAM_TIMES("MPArch.RWH_RepaintDelta", delta);
@@ -1667,8 +1677,7 @@ void RenderWidgetHostImpl::DidUpdateBackingStore(
NotificationService::current()->Notify(
NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE,
- Source<RenderWidgetHost>(this),
- NotificationService::NoDetails());
+ Source<RenderWidgetHost>(this), NotificationService::NoDetails());
// We don't need to update the view if the view is hidden. We must do this
// early return after the ACK is sent, however, or the renderer will not send
@@ -1699,9 +1708,9 @@ void RenderWidgetHostImpl::OnQueueSyntheticGesture(
}
QueueSyntheticGesture(
- SyntheticGesture::Create(*gesture_packet.gesture_params()),
- base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted,
- weak_factory_.GetWeakPtr()));
+ SyntheticGesture::Create(*gesture_packet.gesture_params()),
+ base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted,
+ weak_factory_.GetWeakPtr()));
}
void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) {
@@ -1709,7 +1718,8 @@ void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) {
}
void RenderWidgetHostImpl::SetTouchEventEmulationEnabled(
- bool enabled, ui::GestureProviderConfigType config_type) {
+ bool enabled,
+ ui::GestureProviderConfigType config_type) {
if (enabled) {
if (!touch_emulator_) {
touch_emulator_.reset(new TouchEmulator(
@@ -1831,7 +1841,8 @@ bool RenderWidgetHostImpl::KeyPressListenersHandleEvent(
}
InputEventAckState RenderWidgetHostImpl::FilterInputEvent(
- const blink::WebInputEvent& event, const ui::LatencyInfo& latency_info) {
+ const blink::WebInputEvent& event,
+ const ui::LatencyInfo& latency_info) {
// Don't ignore touch cancel events, since they may be sent while input
// events are being ignored in order to keep the renderer from getting
// confused about how many touches are active.
@@ -1889,8 +1900,8 @@ void RenderWidgetHostImpl::DidStopFlinging() {
}
void RenderWidgetHostImpl::OnKeyboardEventAck(
- const NativeWebKeyboardEventWithLatencyInfo& event,
- InputEventAckState ack_result) {
+ const NativeWebKeyboardEventWithLatencyInfo& event,
+ InputEventAckState ack_result) {
latency_tracker_.OnInputEventAck(event.event, &event.latency, ack_result);
const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result);
@@ -1921,8 +1932,8 @@ void RenderWidgetHostImpl::OnWheelEventAck(
ack_result);
if (!is_hidden() && view_) {
- if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED &&
- delegate_ && delegate_->HandleWheelEvent(wheel_event.event)) {
+ if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED && delegate_ &&
+ delegate_->HandleWheelEvent(wheel_event.event)) {
ack_result = INPUT_EVENT_ACK_STATE_CONSUMED;
}
view_->WheelEventAck(wheel_event.event, ack_result);
@@ -2005,7 +2016,7 @@ bool RenderWidgetHostImpl::GotResponseToLockMouseRequest(bool allowed) {
}
pending_mouse_lock_request_ = false;
- if (!view_ || !view_->HasFocus()|| !view_->LockMouse()) {
+ if (!view_ || !view_->HasFocus() || !view_->LockMouse()) {
Send(new ViewMsg_LockMouse_ACK(routing_id_, false));
return false;
}
@@ -2023,8 +2034,8 @@ void RenderWidgetHostImpl::SendSwapCompositorFrameAck(
RenderProcessHost* host = RenderProcessHost::FromID(renderer_host_id);
if (!host)
return;
- host->Send(new ViewMsg_SwapCompositorFrameAck(
- route_id, output_surface_id, ack));
+ host->Send(
+ new ViewMsg_SwapCompositorFrameAck(route_id, output_surface_id, ack));
}
// static
@@ -2062,8 +2073,8 @@ void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) {
if (latency_info.FindLatency(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT,
GetLatencyComponentId(),
&window_snapshot_component)) {
- int sequence_number = static_cast<int>(
- window_snapshot_component.sequence_number);
+ int sequence_number =
+ static_cast<int>(window_snapshot_component.sequence_number);
#if defined(OS_MACOSX)
// On Mac, when using CoreAnmation, there is a delay between when content
// is drawn to the screen, and when the snapshot will actually pick up
@@ -2072,8 +2083,7 @@ void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) {
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&RenderWidgetHostImpl::WindowSnapshotReachedScreen,
- weak_factory_.GetWeakPtr(),
- sequence_number),
+ weak_factory_.GetWeakPtr(), sequence_number),
base::TimeDelta::FromSecondsD(1. / 6));
#else
WindowSnapshotReachedScreen(sequence_number);
@@ -2094,19 +2104,16 @@ void RenderWidgetHostImpl::WindowSnapshotReachedScreen(int snapshot_id) {
gfx::Rect snapshot_bounds(view_bounds.size());
std::vector<unsigned char> png;
- if (ui::GrabViewSnapshot(
- GetView()->GetNativeView(), &png, snapshot_bounds)) {
+ if (ui::GrabViewSnapshot(GetView()->GetNativeView(), &png, snapshot_bounds)) {
OnSnapshotDataReceived(snapshot_id, &png.front(), png.size());
return;
}
ui::GrabViewSnapshotAsync(
- GetView()->GetNativeView(),
- snapshot_bounds,
+ GetView()->GetNativeView(), snapshot_bounds,
base::ThreadTaskRunnerHandle::Get(),
base::Bind(&RenderWidgetHostImpl::OnSnapshotDataReceivedAsync,
- weak_factory_.GetWeakPtr(),
- snapshot_id));
+ weak_factory_.GetWeakPtr(), snapshot_id));
}
void RenderWidgetHostImpl::OnSnapshotDataReceived(int snapshot_id,
@@ -2116,12 +2123,12 @@ void RenderWidgetHostImpl::OnSnapshotDataReceived(int snapshot_id,
// to be implicitly complete, and returned the same snapshot data.
PendingSnapshotMap::iterator it = pending_browser_snapshots_.begin();
while (it != pending_browser_snapshots_.end()) {
- if (it->first <= snapshot_id) {
- it->second.Run(data, size);
- pending_browser_snapshots_.erase(it++);
- } else {
- ++it;
- }
+ if (it->first <= snapshot_id) {
+ it->second.Run(data, size);
+ pending_browser_snapshots_.erase(it++);
+ } else {
+ ++it;
+ }
}
}
@@ -2160,14 +2167,14 @@ void RenderWidgetHostImpl::CompositorFrameDrawn(
}
BrowserAccessibilityManager*
- RenderWidgetHostImpl::GetRootBrowserAccessibilityManager() {
+RenderWidgetHostImpl::GetRootBrowserAccessibilityManager() {
return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL;
}
BrowserAccessibilityManager*
- RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() {
- return delegate_ ?
- delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL;
+RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() {
+ return delegate_ ? delegate_->GetOrCreateRootBrowserAccessibilityManager()
+ : NULL;
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698