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

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

Issue 2577953002: Fix a bug where an infinite stream of BeginFrame messages are sent to extensions. (Closed)
Patch Set: Comments from danakj. Created 4 years 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 | 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 <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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 477
478 // Let the page-level input event router know about our surface ID 478 // Let the page-level input event router know about our surface ID
479 // namespace for surface-based hit testing. 479 // namespace for surface-based hit testing.
480 if (render_widget_host_->delegate() && 480 if (render_widget_host_->delegate() &&
481 render_widget_host_->delegate()->GetInputEventRouter()) { 481 render_widget_host_->delegate()->GetInputEventRouter()) {
482 render_widget_host_->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner( 482 render_widget_host_->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner(
483 GetFrameSinkId(), this); 483 GetFrameSinkId(), this);
484 } 484 }
485 485
486 RenderViewHost* rvh = RenderViewHost::From(render_widget_host_); 486 RenderViewHost* rvh = RenderViewHost::From(render_widget_host_);
487 bool needs_begin_frames = true;
487 if (rvh) { 488 if (rvh) {
danakj 2016/12/15 17:30:10 Can you add a TODO to remove this condition?
erikchen 2016/12/15 19:28:22 Done.
488 // TODO(mostynb): actually use prefs. Landing this as a separate CL 489 // TODO(mostynb): actually use prefs. Landing this as a separate CL
489 // first to rebaseline some unreliable layout tests. 490 // first to rebaseline some unreliable layout tests.
490 ignore_result(rvh->GetWebkitPreferences()); 491 ignore_result(rvh->GetWebkitPreferences());
492 needs_begin_frames = !rvh->GetDelegate()->IsNeverVisible();
491 } 493 }
492 494
493 if (GetTextInputManager()) 495 if (GetTextInputManager())
494 GetTextInputManager()->AddObserver(this); 496 GetTextInputManager()->AddObserver(this);
495 497
496 // Because of the way Mac pumps messages during resize, (see the code 498 // Because of the way Mac pumps messages during resize, (see the code
497 // in RenderMessageFilter::OnMessageReceived), SetNeedsBeginFrame 499 // in RenderMessageFilter::OnMessageReceived), SetNeedsBeginFrame
498 // messages are not delayed on Mac. This leads to creation-time 500 // messages are not delayed on Mac. This leads to creation-time
499 // raciness where renderer sends a SetNeedsBeginFrame(true) before 501 // raciness where renderer sends a SetNeedsBeginFrame(true) before
500 // the renderer host is created to recieve it. In general, all 502 // the renderer host is created to recieve it.
501 // renderers want begin frames initially anyway, so start this value 503 //
danakj 2016/12/15 17:30:10 nit: just one line between paragraphs
erikchen 2016/12/15 19:28:22 Done.
502 // at true here to avoid startup raciness and decrease latency. 504 //
503 needs_begin_frames_ = true; 505 // Any renderer that will produce frames needs to have begin frames sent to
506 // it. So unless it is never visible, start this value at true here to avoid
507 // startup raciness and decrease latency.
508 needs_begin_frames_ = needs_begin_frames;
504 UpdateNeedsBeginFramesInternal(); 509 UpdateNeedsBeginFramesInternal();
505 } 510 }
506 511
507 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() { 512 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() {
508 display::Screen::GetScreen()->RemoveObserver(this); 513 display::Screen::GetScreen()->RemoveObserver(this);
509 514
510 // This is being called from |cocoa_view_|'s destructor, so invalidate the 515 // This is being called from |cocoa_view_|'s destructor, so invalidate the
511 // pointer. 516 // pointer.
512 cocoa_view_ = nil; 517 cocoa_view_ = nil;
513 518
(...skipping 2929 matching lines...) Expand 10 before | Expand all | Expand 10 after
3443 3448
3444 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3449 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3445 // regions that are not draggable. (See ControlRegionView in 3450 // regions that are not draggable. (See ControlRegionView in
3446 // native_app_window_cocoa.mm). This requires the render host view to be 3451 // native_app_window_cocoa.mm). This requires the render host view to be
3447 // draggable by default. 3452 // draggable by default.
3448 - (BOOL)mouseDownCanMoveWindow { 3453 - (BOOL)mouseDownCanMoveWindow {
3449 return YES; 3454 return YES;
3450 } 3455 }
3451 3456
3452 @end 3457 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698