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

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

Issue 2451953004: Fix mac raciness with initial needs begin frame state (Closed)
Patch Set: Fixes for ScrollWheelEndEventDelivery test Created 4 years, 1 month 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 | « no previous file | content/browser/renderer_host/render_widget_host_view_mac_unittest.mm » ('j') | 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 <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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 // RenderWidgetHostViewMac, public: 444 // RenderWidgetHostViewMac, public:
445 445
446 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget, 446 RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,
447 bool is_guest_view_hack) 447 bool is_guest_view_hack)
448 : render_widget_host_(RenderWidgetHostImpl::From(widget)), 448 : render_widget_host_(RenderWidgetHostImpl::From(widget)),
449 page_at_minimum_scale_(true), 449 page_at_minimum_scale_(true),
450 is_loading_(false), 450 is_loading_(false),
451 allow_pause_for_resize_or_repaint_(true), 451 allow_pause_for_resize_or_repaint_(true),
452 is_guest_view_hack_(is_guest_view_hack), 452 is_guest_view_hack_(is_guest_view_hack),
453 fullscreen_parent_host_view_(nullptr), 453 fullscreen_parent_host_view_(nullptr),
454 needs_begin_frames_(false),
455 needs_flush_input_(false), 454 needs_flush_input_(false),
456 weak_factory_(this) { 455 weak_factory_(this) {
457 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_| 456 // |cocoa_view_| owns us and we will be deleted when |cocoa_view_|
458 // goes away. Since we autorelease it, our caller must put 457 // goes away. Since we autorelease it, our caller must put
459 // |GetNativeView()| into the view hierarchy right after calling us. 458 // |GetNativeView()| into the view hierarchy right after calling us.
460 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc] 459 cocoa_view_ = [[[RenderWidgetHostViewCocoa alloc]
461 initWithRenderWidgetHostViewMac:this] autorelease]; 460 initWithRenderWidgetHostViewMac:this] autorelease];
462 461
463 // Paint this view host with |background_color_| when there is no content 462 // Paint this view host with |background_color_| when there is no content
464 // ready to draw. 463 // ready to draw.
(...skipping 22 matching lines...) Expand all
487 486
488 RenderViewHost* rvh = RenderViewHost::From(render_widget_host_); 487 RenderViewHost* rvh = RenderViewHost::From(render_widget_host_);
489 if (rvh) { 488 if (rvh) {
490 // TODO(mostynb): actually use prefs. Landing this as a separate CL 489 // TODO(mostynb): actually use prefs. Landing this as a separate CL
491 // first to rebaseline some unreliable layout tests. 490 // first to rebaseline some unreliable layout tests.
492 ignore_result(rvh->GetWebkitPreferences()); 491 ignore_result(rvh->GetWebkitPreferences());
493 } 492 }
494 493
495 if (GetTextInputManager()) 494 if (GetTextInputManager())
496 GetTextInputManager()->AddObserver(this); 495 GetTextInputManager()->AddObserver(this);
496
497 // Because of the way Mac pumps messages during resize, (see the code
498 // in RenderMessageFilter::OnMessageReceived), SetNeedsBeginFrame
499 // messages are not delayed on Mac. This leads to creation-time
500 // raciness where renderer sends a SetNeedsBeginFrame(true) before
501 // the renderer host is created to recieve it. In general, all
502 // renderers want begin frames initially anyway, so start this value
503 // at true here to avoid startup raciness and decrease latency.
504 needs_begin_frames_ = true;
505 UpdateNeedsBeginFramesInternal();
497 } 506 }
498 507
499 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() { 508 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() {
500 display::Screen::GetScreen()->RemoveObserver(this); 509 display::Screen::GetScreen()->RemoveObserver(this);
501 510
502 // This is being called from |cocoa_view_|'s destructor, so invalidate the 511 // This is being called from |cocoa_view_|'s destructor, so invalidate the
503 // pointer. 512 // pointer.
504 cocoa_view_ = nil; 513 cocoa_view_ = nil;
505 514
506 UnlockMouse(); 515 UnlockMouse();
(...skipping 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after
3412 3421
3413 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3422 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3414 // regions that are not draggable. (See ControlRegionView in 3423 // regions that are not draggable. (See ControlRegionView in
3415 // native_app_window_cocoa.mm). This requires the render host view to be 3424 // native_app_window_cocoa.mm). This requires the render host view to be
3416 // draggable by default. 3425 // draggable by default.
3417 - (BOOL)mouseDownCanMoveWindow { 3426 - (BOOL)mouseDownCanMoveWindow {
3418 return YES; 3427 return YES;
3419 } 3428 }
3420 3429
3421 @end 3430 @end
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698