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

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

Issue 2401863003: Move synthetic gesture input to be aligned with BeginFrame. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.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/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 <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <OpenGL/gl.h> 8 #include <OpenGL/gl.h>
9 #include <QuartzCore/QuartzCore.h> 9 #include <QuartzCore/QuartzCore.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 render_widget_host_->GetRoutingID(), compositor_frame_sink_id, 408 render_widget_host_->GetRoutingID(), compositor_frame_sink_id,
409 is_swap_ack, resources)); 409 is_swap_ack, resources));
410 } 410 }
411 411
412 void RenderWidgetHostViewMac::BrowserCompositorMacOnLostCompositorResources() { 412 void RenderWidgetHostViewMac::BrowserCompositorMacOnLostCompositorResources() {
413 render_widget_host_->ScheduleComposite(); 413 render_widget_host_->ScheduleComposite();
414 } 414 }
415 415
416 void RenderWidgetHostViewMac::BrowserCompositorMacSendBeginFrame( 416 void RenderWidgetHostViewMac::BrowserCompositorMacSendBeginFrame(
417 const cc::BeginFrameArgs& args) { 417 const cc::BeginFrameArgs& args) {
418 needs_flush_input_ = false;
419 render_widget_host_->FlushInput();
420 UpdateNeedsBeginFramesInternal();
418 render_widget_host_->Send( 421 render_widget_host_->Send(
419 new ViewMsg_BeginFrame(render_widget_host_->GetRoutingID(), args)); 422 new ViewMsg_BeginFrame(render_widget_host_->GetRoutingID(), args));
420 } 423 }
421 424
422 //////////////////////////////////////////////////////////////////////////////// 425 ////////////////////////////////////////////////////////////////////////////////
423 // AcceleratedWidgetMacNSView, public: 426 // AcceleratedWidgetMacNSView, public:
424 427
425 NSView* RenderWidgetHostViewMac::AcceleratedWidgetGetNSView() const { 428 NSView* RenderWidgetHostViewMac::AcceleratedWidgetGetNSView() const {
426 return cocoa_view_; 429 return cocoa_view_;
427 } 430 }
(...skipping 16 matching lines...) Expand all
444 // RenderWidgetHostViewMac, public: 447 // RenderWidgetHostViewMac, public:
445 448
446 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget, 449 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,
447 bool is_guest_view_hack) 450 bool is_guest_view_hack)
448 : render_widget_host_(RenderWidgetHostImpl::From(widget)), 451 : render_widget_host_(RenderWidgetHostImpl::From(widget)),
449 page_at_minimum_scale_(true), 452 page_at_minimum_scale_(true),
450 is_loading_(false), 453 is_loading_(false),
451 allow_pause_for_resize_or_repaint_(true), 454 allow_pause_for_resize_or_repaint_(true),
452 is_guest_view_hack_(is_guest_view_hack), 455 is_guest_view_hack_(is_guest_view_hack),
453 fullscreen_parent_host_view_(nullptr), 456 fullscreen_parent_host_view_(nullptr),
457 needs_begin_frames_(false),
458 needs_flush_input_(false),
454 weak_factory_(this) { 459 weak_factory_(this) {
455 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| 460 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_|
456 // goes away. Since we autorelease it, our caller must put 461 // goes away. Since we autorelease it, our caller must put
457 // |GetNativeView()| into the view hierarchy right after calling us. 462 // |GetNativeView()| into the view hierarchy right after calling us.
458 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] 463 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc]
459 initWithRenderWidgetHostViewMac:this] autorelease]; 464 initWithRenderWidgetHostViewMac:this] autorelease];
460 465
461 // Paint this view host with |background_color_| when there is no content 466 // Paint this view host with |background_color_| when there is no content
462 // ready to draw. 467 // ready to draw.
463 background_layer_.reset([[CALayer alloc] init]); 468 background_layer_.reset([[CALayer alloc] init]);
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 if (render_widget_host_) 1185 if (render_widget_host_)
1181 render_widget_host_->ForwardMouseEvent(event); 1186 render_widget_host_->ForwardMouseEvent(event);
1182 1187
1183 if (event.type == WebInputEvent::MouseLeave) { 1188 if (event.type == WebInputEvent::MouseLeave) {
1184 [cocoa_view_ setToolTipAtMousePoint:nil]; 1189 [cocoa_view_ setToolTipAtMousePoint:nil];
1185 tooltip_text_.clear(); 1190 tooltip_text_.clear();
1186 } 1191 }
1187 } 1192 }
1188 1193
1189 void RenderWidgetHostViewMac::SetNeedsBeginFrames(bool needs_begin_frames) { 1194 void RenderWidgetHostViewMac::SetNeedsBeginFrames(bool needs_begin_frames) {
1190 browser_compositor_->SetNeedsBeginFrames(needs_begin_frames); 1195 needs_begin_frames_ = needs_begin_frames;
1196 UpdateNeedsBeginFramesInternal();
1197 }
1198
1199 void RenderWidgetHostViewMac::OnSetNeedsFlushInput() {
1200 needs_flush_input_ = true;
1201 UpdateNeedsBeginFramesInternal();
1202 }
1203
1204 void RenderWidgetHostViewMac::UpdateNeedsBeginFramesInternal() {
1205 browser_compositor_->SetNeedsBeginFrames(needs_begin_frames_ ||
1206 needs_flush_input_);
1191 } 1207 }
1192 1208
1193 void RenderWidgetHostViewMac::KillSelf() { 1209 void RenderWidgetHostViewMac::KillSelf() {
1194 if (!weak_factory_.HasWeakPtrs()) { 1210 if (!weak_factory_.HasWeakPtrs()) {
1195 [cocoa_view_ setHidden:YES]; 1211 [cocoa_view_ setHidden:YES];
1196 base::ThreadTaskRunnerHandle::Get()->PostTask( 1212 base::ThreadTaskRunnerHandle::Get()->PostTask(
1197 FROM_HERE, base::Bind(&RenderWidgetHostViewMac::ShutdownHost, 1213 FROM_HERE, base::Bind(&RenderWidgetHostViewMac::ShutdownHost,
1198 weak_factory_.GetWeakPtr())); 1214 weak_factory_.GetWeakPtr()));
1199 } 1215 }
1200 } 1216 }
(...skipping 2162 matching lines...) Expand 10 before | Expand all | Expand 10 after
3363 3379
3364 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3380 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3365 // regions that are not draggable. (See ControlRegionView in 3381 // regions that are not draggable. (See ControlRegionView in
3366 // native_app_window_cocoa.mm). This requires the render host view to be 3382 // native_app_window_cocoa.mm). This requires the render host view to be
3367 // draggable by default. 3383 // draggable by default.
3368 - (BOOL)mouseDownCanMoveWindow { 3384 - (BOOL)mouseDownCanMoveWindow {
3369 return YES; 3385 return YES;
3370 } 3386 }
3371 3387
3372 @end 3388 @end
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698