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

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: Rebase Created 3 years, 5 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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 } 744 }
745 745
746 void RenderWidgetHostViewMac::Show() { 746 void RenderWidgetHostViewMac::Show() {
747 ScopedCAActionDisabler disabler; 747 ScopedCAActionDisabler disabler;
748 [cocoa_view_ setHidden:NO]; 748 [cocoa_view_ setHidden:NO];
749 749
750 browser_compositor_->SetRenderWidgetHostIsHidden(false); 750 browser_compositor_->SetRenderWidgetHostIsHidden(false);
751 751
752 ui::LatencyInfo renderer_latency_info; 752 ui::LatencyInfo renderer_latency_info;
753 renderer_latency_info.AddLatencyNumber( 753 renderer_latency_info.AddLatencyNumber(
754 ui::TAB_SHOW_COMPONENT, render_widget_host_->GetLatencyComponentId(), 0); 754 ui::TAB_SHOW_COMPONENT, render_widget_host_->GetLatencyComponentId());
755 render_widget_host_->WasShown(renderer_latency_info); 755 render_widget_host_->WasShown(renderer_latency_info);
756 756
757 // If there is not a frame being currently drawn, kick one, so that the below 757 // If there is not a frame being currently drawn, kick one, so that the below
758 // pause will have a frame to wait on. 758 // pause will have a frame to wait on.
759 render_widget_host_->ScheduleComposite(); 759 render_widget_host_->ScheduleComposite();
760 PauseForPendingResizeOrRepaintsAndDraw(); 760 PauseForPendingResizeOrRepaintsAndDraw();
761 } 761 }
762 762
763 void RenderWidgetHostViewMac::Hide() { 763 void RenderWidgetHostViewMac::Hide() {
764 ScopedCAActionDisabler disabler; 764 ScopedCAActionDisabler disabler;
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 1947
1948 if (mouseEventWasIgnored_) { 1948 if (mouseEventWasIgnored_) {
1949 // If this is the first mouse event after a previous event that was ignored 1949 // If this is the first mouse event after a previous event that was ignored
1950 // due to the hitTest, send a mouse enter event to the host view. 1950 // due to the hitTest, send a mouse enter event to the host view.
1951 if (renderWidgetHostView_->render_widget_host_) { 1951 if (renderWidgetHostView_->render_widget_host_) {
1952 WebMouseEvent enterEvent = 1952 WebMouseEvent enterEvent =
1953 WebMouseEventBuilder::Build(theEvent, self, pointerType_); 1953 WebMouseEventBuilder::Build(theEvent, self, pointerType_);
1954 enterEvent.SetType(WebInputEvent::kMouseMove); 1954 enterEvent.SetType(WebInputEvent::kMouseMove);
1955 enterEvent.button = WebMouseEvent::Button::kNoButton; 1955 enterEvent.button = WebMouseEvent::Button::kNoButton;
1956 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER); 1956 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER);
1957 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 1957 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0);
1958 if (renderWidgetHostView_->ShouldRouteEvent(enterEvent)) { 1958 if (renderWidgetHostView_->ShouldRouteEvent(enterEvent)) {
1959 renderWidgetHostView_->render_widget_host_->delegate() 1959 renderWidgetHostView_->render_widget_host_->delegate()
1960 ->GetInputEventRouter() 1960 ->GetInputEventRouter()
1961 ->RouteMouseEvent(renderWidgetHostView_.get(), &enterEvent, 1961 ->RouteMouseEvent(renderWidgetHostView_.get(), &enterEvent,
1962 latency_info); 1962 latency_info);
1963 } else { 1963 } else {
1964 renderWidgetHostView_->ProcessMouseEvent(enterEvent, latency_info); 1964 renderWidgetHostView_->ProcessMouseEvent(enterEvent, latency_info);
1965 } 1965 }
1966 } 1966 }
1967 } 1967 }
(...skipping 16 matching lines...) Expand all
1984 // Instead of sending mouse events to the input method first, we now just 1984 // Instead of sending mouse events to the input method first, we now just
1985 // simply confirm all ongoing composition here. 1985 // simply confirm all ongoing composition here.
1986 if (type == NSLeftMouseDown || type == NSRightMouseDown || 1986 if (type == NSLeftMouseDown || type == NSRightMouseDown ||
1987 type == NSOtherMouseDown) { 1987 type == NSOtherMouseDown) {
1988 [self finishComposingText]; 1988 [self finishComposingText];
1989 } 1989 }
1990 1990
1991 WebMouseEvent event = 1991 WebMouseEvent event =
1992 WebMouseEventBuilder::Build(theEvent, self, pointerType_); 1992 WebMouseEventBuilder::Build(theEvent, self, pointerType_);
1993 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER); 1993 ui::LatencyInfo latency_info(ui::SourceEventType::OTHER);
1994 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 1994 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0);
1995 if (renderWidgetHostView_->ShouldRouteEvent(event)) { 1995 if (renderWidgetHostView_->ShouldRouteEvent(event)) {
1996 renderWidgetHostView_->render_widget_host_->delegate() 1996 renderWidgetHostView_->render_widget_host_->delegate()
1997 ->GetInputEventRouter() 1997 ->GetInputEventRouter()
1998 ->RouteMouseEvent(renderWidgetHostView_.get(), &event, latency_info); 1998 ->RouteMouseEvent(renderWidgetHostView_.get(), &event, latency_info);
1999 } else { 1999 } else {
2000 renderWidgetHostView_->ProcessMouseEvent(event, latency_info); 2000 renderWidgetHostView_->ProcessMouseEvent(event, latency_info);
2001 } 2001 }
2002 } 2002 }
2003 2003
2004 - (void)tabletEvent:(NSEvent*)theEvent { 2004 - (void)tabletEvent:(NSEvent*)theEvent {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 RenderWidgetHostImpl* widgetHost = renderWidgetHostView_->render_widget_host_; 2105 RenderWidgetHostImpl* widgetHost = renderWidgetHostView_->render_widget_host_;
2106 DCHECK(widgetHost); 2106 DCHECK(widgetHost);
2107 2107
2108 NativeWebKeyboardEvent event(theEvent); 2108 NativeWebKeyboardEvent event(theEvent);
2109 ui::LatencyInfo latency_info; 2109 ui::LatencyInfo latency_info;
2110 if (event.GetType() == blink::WebInputEvent::kRawKeyDown || 2110 if (event.GetType() == blink::WebInputEvent::kRawKeyDown ||
2111 event.GetType() == blink::WebInputEvent::kChar) { 2111 event.GetType() == blink::WebInputEvent::kChar) {
2112 latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS); 2112 latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS);
2113 } 2113 }
2114 2114
2115 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 2115 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0);
2116 2116
2117 // Force fullscreen windows to close on Escape so they won't keep the keyboard 2117 // Force fullscreen windows to close on Escape so they won't keep the keyboard
2118 // grabbed or be stuck onscreen if the renderer is hanging. 2118 // grabbed or be stuck onscreen if the renderer is hanging.
2119 if (event.GetType() == NativeWebKeyboardEvent::kRawKeyDown && 2119 if (event.GetType() == NativeWebKeyboardEvent::kRawKeyDown &&
2120 event.windows_key_code == ui::VKEY_ESCAPE && 2120 event.windows_key_code == ui::VKEY_ESCAPE &&
2121 renderWidgetHostView_->pepper_fullscreen_window()) { 2121 renderWidgetHostView_->pepper_fullscreen_window()) {
2122 RenderWidgetHostViewMac* parent = 2122 RenderWidgetHostViewMac* parent =
2123 renderWidgetHostView_->fullscreen_parent_host_view(); 2123 renderWidgetHostView_->fullscreen_parent_host_view();
2124 if (parent) 2124 if (parent)
2125 parent->cocoa_view()->suppressNextEscapeKeyUp_ = YES; 2125 parent->cocoa_view()->suppressNextEscapeKeyUp_ = YES;
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2343 if (renderWidgetHostView_->render_widget_host_) { 2343 if (renderWidgetHostView_->render_widget_host_) {
2344 // History-swiping is not possible if the logic reaches this point. 2344 // History-swiping is not possible if the logic reaches this point.
2345 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build( 2345 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build(
2346 event, self); 2346 event, self);
2347 webEvent.rails_mode = mouseWheelFilter_.UpdateRailsMode(webEvent); 2347 webEvent.rails_mode = mouseWheelFilter_.UpdateRailsMode(webEvent);
2348 if (renderWidgetHostView_->wheel_scroll_latching_enabled()) { 2348 if (renderWidgetHostView_->wheel_scroll_latching_enabled()) {
2349 renderWidgetHostView_->mouse_wheel_phase_handler_ 2349 renderWidgetHostView_->mouse_wheel_phase_handler_
2350 .AddPhaseIfNeededAndScheduleEndEvent(webEvent, false); 2350 .AddPhaseIfNeededAndScheduleEndEvent(webEvent, false);
2351 } else { 2351 } else {
2352 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); 2352 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL);
2353 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 2353 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0);
2354 renderWidgetHostView_->render_widget_host_ 2354 renderWidgetHostView_->render_widget_host_
2355 ->ForwardWheelEventWithLatencyInfo(webEvent, latency_info); 2355 ->ForwardWheelEventWithLatencyInfo(webEvent, latency_info);
2356 } 2356 }
2357 } 2357 }
2358 2358
2359 if (endWheelMonitor_) { 2359 if (endWheelMonitor_) {
2360 [NSEvent removeMonitor:endWheelMonitor_]; 2360 [NSEvent removeMonitor:endWheelMonitor_];
2361 endWheelMonitor_ = nil; 2361 endWheelMonitor_ = nil;
2362 } 2362 }
2363 } 2363 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2551 [self shortCircuitScrollWheelEvent:blockEvent]; 2551 [self shortCircuitScrollWheelEvent:blockEvent];
2552 return blockEvent; 2552 return blockEvent;
2553 }]; 2553 }];
2554 } 2554 }
2555 2555
2556 // This is responsible for content scrolling! 2556 // This is responsible for content scrolling!
2557 if (renderWidgetHostView_->render_widget_host_) { 2557 if (renderWidgetHostView_->render_widget_host_) {
2558 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build(event, self); 2558 WebMouseWheelEvent webEvent = WebMouseWheelEventBuilder::Build(event, self);
2559 webEvent.rails_mode = mouseWheelFilter_.UpdateRailsMode(webEvent); 2559 webEvent.rails_mode = mouseWheelFilter_.UpdateRailsMode(webEvent);
2560 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); 2560 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL);
2561 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 2561 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0);
2562 if (renderWidgetHostView_->wheel_scroll_latching_enabled()) { 2562 if (renderWidgetHostView_->wheel_scroll_latching_enabled()) {
2563 renderWidgetHostView_->mouse_wheel_phase_handler_ 2563 renderWidgetHostView_->mouse_wheel_phase_handler_
2564 .AddPhaseIfNeededAndScheduleEndEvent( 2564 .AddPhaseIfNeededAndScheduleEndEvent(
2565 webEvent, renderWidgetHostView_->ShouldRouteEvent(webEvent)); 2565 webEvent, renderWidgetHostView_->ShouldRouteEvent(webEvent));
2566 if (webEvent.phase == blink::WebMouseWheelEvent::kPhaseEnded) { 2566 if (webEvent.phase == blink::WebMouseWheelEvent::kPhaseEnded) {
2567 // A wheel end event is scheduled and will get dispatched if momentum 2567 // A wheel end event is scheduled and will get dispatched if momentum
2568 // phase doesn't start in 100ms. Don't sent the wheel end event 2568 // phase doesn't start in 100ms. Don't sent the wheel end event
2569 // immediately. 2569 // immediately.
2570 return; 2570 return;
2571 } 2571 }
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
3513 3513
3514 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3514 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3515 // regions that are not draggable. (See ControlRegionView in 3515 // regions that are not draggable. (See ControlRegionView in
3516 // native_app_window_cocoa.mm). This requires the render host view to be 3516 // native_app_window_cocoa.mm). This requires the render host view to be
3517 // draggable by default. 3517 // draggable by default.
3518 - (BOOL)mouseDownCanMoveWindow { 3518 - (BOOL)mouseDownCanMoveWindow {
3519 return YES; 3519 return YES;
3520 } 3520 }
3521 3521
3522 @end 3522 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698