Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 15:56:59
So, when is this null? I got as far RenderViewHost
erikchen
2016/12/15 16:51:11
I agree that I don't see how rvh could be nullptr.
| |
| 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 // |
| 502 // at true here to avoid startup raciness and decrease latency. | 504 // A renderer wants begin frames initially if and only if |
|
danakj
2016/12/15 15:56:59
IsNeverVisible should not change, thats why its na
erikchen
2016/12/15 16:51:11
Done.
| |
| 503 needs_begin_frames_ = true; | 505 // |rvh->GetDelegate()->IsNeverVisible()| evalutes to false. If this statement |
| 506 // becomes false, then we will need to update this logic to ensure that | |
| 507 // |needs_begin_frames_| stays synchronized between the browser and the | |
| 508 // renderer. The benefit of starting it as true is that it reduces startup | |
| 509 // raciness and decreases latency. | |
| 510 needs_begin_frames_ = needs_begin_frames; | |
| 504 UpdateNeedsBeginFramesInternal(); | 511 UpdateNeedsBeginFramesInternal(); |
| 505 } | 512 } |
| 506 | 513 |
| 507 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() { | 514 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() { |
| 508 display::Screen::GetScreen()->RemoveObserver(this); | 515 display::Screen::GetScreen()->RemoveObserver(this); |
| 509 | 516 |
| 510 // This is being called from |cocoa_view_|'s destructor, so invalidate the | 517 // This is being called from |cocoa_view_|'s destructor, so invalidate the |
| 511 // pointer. | 518 // pointer. |
| 512 cocoa_view_ = nil; | 519 cocoa_view_ = nil; |
| 513 | 520 |
| (...skipping 2929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3443 | 3450 |
| 3444 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3451 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3445 // regions that are not draggable. (See ControlRegionView in | 3452 // regions that are not draggable. (See ControlRegionView in |
| 3446 // native_app_window_cocoa.mm). This requires the render host view to be | 3453 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3447 // draggable by default. | 3454 // draggable by default. |
| 3448 - (BOOL)mouseDownCanMoveWindow { | 3455 - (BOOL)mouseDownCanMoveWindow { |
| 3449 return YES; | 3456 return YES; |
| 3450 } | 3457 } |
| 3451 | 3458 |
| 3452 @end | 3459 @end |
| OLD | NEW |