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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 2914023002: Remove LatencyInfo::sequence_number. (May break metrics).
Patch Set: Fix Windows. Created 3 years, 6 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_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 #import <objc/runtime.h> 8 #import <objc/runtime.h>
9 #include <OpenGL/gl.h> 9 #include <OpenGL/gl.h>
10 #include <QuartzCore/QuartzCore.h> 10 #include <QuartzCore/QuartzCore.h>
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 } 745 }
746 746
747 void RenderWidgetHostViewMac::Show() { 747 void RenderWidgetHostViewMac::Show() {
748 ScopedCAActionDisabler disabler; 748 ScopedCAActionDisabler disabler;
749 [cocoa_view_ setHidden:NO]; 749 [cocoa_view_ setHidden:NO];
750 750
751 browser_compositor_->SetRenderWidgetHostIsHidden(false); 751 browser_compositor_->SetRenderWidgetHostIsHidden(false);
752 752
753 ui::LatencyInfo renderer_latency_info; 753 ui::LatencyInfo renderer_latency_info;
754 renderer_latency_info.AddLatencyNumber( 754 renderer_latency_info.AddLatencyNumber(
755 ui::TAB_SHOW_COMPONENT, render_widget_host_->GetLatencyComponentId(), 0); 755 ui::TAB_SHOW_COMPONENT, render_widget_host_->GetLatencyComponentId());
756 render_widget_host_->WasShown(renderer_latency_info); 756 render_widget_host_->WasShown(renderer_latency_info);
757 757
758 // If there is not a frame being currently drawn, kick one, so that the below 758 // If there is not a frame being currently drawn, kick one, so that the below
759 // pause will have a frame to wait on. 759 // pause will have a frame to wait on.
760 render_widget_host_->ScheduleComposite(); 760 render_widget_host_->ScheduleComposite();
761 PauseForPendingResizeOrRepaintsAndDraw(); 761 PauseForPendingResizeOrRepaintsAndDraw();
762 } 762 }
763 763
764 void RenderWidgetHostViewMac::Hide() { 764 void RenderWidgetHostViewMac::Hide() {
765 ScopedCAActionDisabler disabler; 765 ScopedCAActionDisabler disabler;
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 1954
1955 if (mouseEventWasIgnored_) { 1955 if (mouseEventWasIgnored_) {
1956 // If this is the first mouse event after a previous event that was ignored 1956 // If this is the first mouse event after a previous event that was ignored
1957 // due to the hitTest, send a mouse enter event to the host view. 1957 // due to the hitTest, send a mouse enter event to the host view.
1958 if (renderWidgetHostView_->render_widget_host_) { 1958 if (renderWidgetHostView_->render_widget_host_) {
1959 WebMouseEvent enterEvent = 1959 WebMouseEvent enterEvent =
1960 WebMouseEventBuilder::Build(theEvent, self, pointerType_); 1960 WebMouseEventBuilder::Build(theEvent, self, pointerType_);
1961 enterEvent.SetType(WebInputEvent::kMouseMove); 1961 enterEvent.SetType(WebInputEvent::kMouseMove);
1962 enterEvent.button = WebMouseEvent::Button::kNoButton; 1962 enterEvent.button = WebMouseEvent::Button::kNoButton;
1963 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER); 1963 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER);
1964 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 1964 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0);
1965 if (renderWidgetHostView_->ShouldRouteEvent(enterEvent)) { 1965 if (renderWidgetHostView_->ShouldRouteEvent(enterEvent)) {
1966 renderWidgetHostView_->render_widget_host_->delegate() 1966 renderWidgetHostView_->render_widget_host_->delegate()
1967 ->GetInputEventRouter() 1967 ->GetInputEventRouter()
1968 ->RouteMouseEvent(renderWidgetHostView_.get(), &enterEvent, 1968 ->RouteMouseEvent(renderWidgetHostView_.get(), &enterEvent,
1969 latency_info); 1969 latency_info);
1970 } else { 1970 } else {
1971 renderWidgetHostView_->ProcessMouseEvent(enterEvent, latency_info); 1971 renderWidgetHostView_->ProcessMouseEvent(enterEvent, latency_info);
1972 } 1972 }
1973 } 1973 }
1974 } 1974 }
(...skipping 16 matching lines...) Expand all
1991 // Instead of sending mouse events to the input method first, we now just 1991 // Instead of sending mouse events to the input method first, we now just
1992 // simply confirm all ongoing composition here. 1992 // simply confirm all ongoing composition here.
1993 if (type == NSLeftMouseDown || type == NSRightMouseDown || 1993 if (type == NSLeftMouseDown || type == NSRightMouseDown ||
1994 type == NSOtherMouseDown) { 1994 type == NSOtherMouseDown) {
1995 [self finishComposingText]; 1995 [self finishComposingText];
1996 } 1996 }
1997 1997
1998 WebMouseEvent event = 1998 WebMouseEvent event =
1999 WebMouseEventBuilder::Build(theEvent, self, pointerType_); 1999 WebMouseEventBuilder::Build(theEvent, self, pointerType_);
2000 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER); 2000 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER);
2001 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 2001 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0);
2002 if (renderWidgetHostView_->ShouldRouteEvent(event)) { 2002 if (renderWidgetHostView_->ShouldRouteEvent(event)) {
2003 renderWidgetHostView_->render_widget_host_->delegate() 2003 renderWidgetHostView_->render_widget_host_->delegate()
2004 ->GetInputEventRouter() 2004 ->GetInputEventRouter()
2005 ->RouteMouseEvent(renderWidgetHostView_.get(), &event, latency_info); 2005 ->RouteMouseEvent(renderWidgetHostView_.get(), &event, latency_info);
2006 } else { 2006 } else {
2007 renderWidgetHostView_->ProcessMouseEvent(event, latency_info); 2007 renderWidgetHostView_->ProcessMouseEvent(event, latency_info);
2008 } 2008 }
2009 } 2009 }
2010 2010
2011 - (void)tabletEvent:(NSEvent*)theEvent { 2011 - (void)tabletEvent:(NSEvent*)theEvent {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2112 RenderWidgetHostImpl* widgetHost = renderWidgetHostView_->render_widget_host_; 2112 RenderWidgetHostImpl* widgetHost = renderWidgetHostView_->render_widget_host_;
2113 DCHECK(widgetHost); 2113 DCHECK(widgetHost);
2114 2114
2115 NativeWebKeyboardEvent event(theEvent); 2115 NativeWebKeyboardEvent event(theEvent);
2116 ui::LatencyInfo latency_info; 2116 ui::LatencyInfo latency_info;
2117 if (event.GetType() == blink::WebInputEvent::kRawKeyDown || 2117 if (event.GetType() == blink::WebInputEvent::kRawKeyDown ||
2118 event.GetType() == blink::WebInputEvent::kChar) { 2118 event.GetType() == blink::WebInputEvent::kChar) {
2119 latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS); 2119 latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS);
2120 } 2120 }
2121 2121
2122 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 2122 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0);
2123 2123
2124 // Force fullscreen windows to close on Escape so they won't keep the keyboard 2124 // Force fullscreen windows to close on Escape so they won't keep the keyboard
2125 // grabbed or be stuck onscreen if the renderer is hanging. 2125 // grabbed or be stuck onscreen if the renderer is hanging.
2126 if (event.GetType() == NativeWebKeyboardEvent::kRawKeyDown && 2126 if (event.GetType() == NativeWebKeyboardEvent::kRawKeyDown &&
2127 event.windows_key_code == ui::VKEY_ESCAPE && 2127 event.windows_key_code == ui::VKEY_ESCAPE &&
2128 renderWidgetHostView_->pepper_fullscreen_window()) { 2128 renderWidgetHostView_->pepper_fullscreen_window()) {
2129 RenderWidgetHostViewMac* parent = 2129 RenderWidgetHostViewMac* parent =
2130 renderWidgetHostView_->fullscreen_parent_host_view(); 2130 renderWidgetHostView_->fullscreen_parent_host_view();
2131 if (parent) 2131 if (parent)
2132 parent->cocoa_view()->suppressNextEscapeKeyUp_ = YES; 2132 parent->cocoa_view()->suppressNextEscapeKeyUp_ = YES;
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2350 if (renderWidgetHostView_->render_widget_host_) { 2350 if (renderWidgetHostView_->render_widget_host_) {
2351 // History-swiping is not possible if the logic reaches this point. 2351 // History-swiping is not possible if the logic reaches this point.
2352 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build( 2352 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build(
2353 event, self); 2353 event, self);
2354 webEvent.rails_mode = mouseWheelFilter_.UpdateRailsMode(webEvent); 2354 webEvent.rails_mode = mouseWheelFilter_.UpdateRailsMode(webEvent);
2355 if (renderWidgetHostView_->wheel_scroll_latching_enabled()) { 2355 if (renderWidgetHostView_->wheel_scroll_latching_enabled()) {
2356 renderWidgetHostView_->mouse_wheel_phase_handler_ 2356 renderWidgetHostView_->mouse_wheel_phase_handler_
2357 .AddPhaseIfNeededAndScheduleEndEvent(webEvent, false); 2357 .AddPhaseIfNeededAndScheduleEndEvent(webEvent, false);
2358 } else { 2358 } else {
2359 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); 2359 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL);
2360 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 2360 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0);
2361 renderWidgetHostView_->render_widget_host_ 2361 renderWidgetHostView_->render_widget_host_
2362 ->ForwardWheelEventWithLatencyInfo(webEvent, latency_info); 2362 ->ForwardWheelEventWithLatencyInfo(webEvent, latency_info);
2363 } 2363 }
2364 } 2364 }
2365 2365
2366 if (endWheelMonitor_) { 2366 if (endWheelMonitor_) {
2367 [NSEvent removeMonitor:endWheelMonitor_]; 2367 [NSEvent removeMonitor:endWheelMonitor_];
2368 endWheelMonitor_ = nil; 2368 endWheelMonitor_ = nil;
2369 } 2369 }
2370 } 2370 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2558 [self shortCircuitScrollWheelEvent:blockEvent]; 2558 [self shortCircuitScrollWheelEvent:blockEvent];
2559 return blockEvent; 2559 return blockEvent;
2560 }]; 2560 }];
2561 } 2561 }
2562 2562
2563 // This is responsible for content scrolling! 2563 // This is responsible for content scrolling!
2564 if (renderWidgetHostView_->render_widget_host_) { 2564 if (renderWidgetHostView_->render_widget_host_) {
2565 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build(event, self); 2565 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build(event, self);
2566 webEvent.rails_mode = mouseWheelFilter_.UpdateRailsMode(webEvent); 2566 webEvent.rails_mode = mouseWheelFilter_.UpdateRailsMode(webEvent);
2567 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); 2567 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL);
2568 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 2568 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0);
2569 if (renderWidgetHostView_->wheel_scroll_latching_enabled()) { 2569 if (renderWidgetHostView_->wheel_scroll_latching_enabled()) {
2570 renderWidgetHostView_->mouse_wheel_phase_handler_ 2570 renderWidgetHostView_->mouse_wheel_phase_handler_
2571 .AddPhaseIfNeededAndScheduleEndEvent( 2571 .AddPhaseIfNeededAndScheduleEndEvent(
2572 webEvent, renderWidgetHostView_->ShouldRouteEvent(webEvent)); 2572 webEvent, renderWidgetHostView_->ShouldRouteEvent(webEvent));
2573 if (webEvent.phase == blink::WebMouseWheelEvent::kPhaseEnded) { 2573 if (webEvent.phase == blink::WebMouseWheelEvent::kPhaseEnded) {
2574 // A wheel end event is scheduled and will get dispatched if momentum 2574 // A wheel end event is scheduled and will get dispatched if momentum
2575 // phase doesn't start in 100ms. Don't sent the wheel end event 2575 // phase doesn't start in 100ms. Don't sent the wheel end event
2576 // immediately. 2576 // immediately.
2577 return; 2577 return;
2578 } 2578 }
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
3537 3537
3538 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3538 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3539 // regions that are not draggable. (See ControlRegionView in 3539 // regions that are not draggable. (See ControlRegionView in
3540 // native_app_window_cocoa.mm). This requires the render host view to be 3540 // native_app_window_cocoa.mm). This requires the render host view to be
3541 // draggable by default. 3541 // draggable by default.
3542 - (BOOL)mouseDownCanMoveWindow { 3542 - (BOOL)mouseDownCanMoveWindow {
3543 return YES; 3543 return YES;
3544 } 3544 }
3545 3545
3546 @end 3546 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698