| 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 <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 | 10 |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 browser_compositor_->compositor()->SetHostHasTransparentBackground( | 608 browser_compositor_->compositor()->SetHostHasTransparentBackground( |
| 609 !GetBackgroundOpaque()); | 609 !GetBackgroundOpaque()); |
| 610 browser_compositor_->accelerated_widget_mac()->SetNSView(this); | 610 browser_compositor_->accelerated_widget_mac()->SetNSView(this); |
| 611 browser_compositor_state_ = BrowserCompositorSuspended; | 611 browser_compositor_state_ = BrowserCompositorSuspended; |
| 612 } | 612 } |
| 613 | 613 |
| 614 // Show the DelegatedFrameHost to transition from Suspended -> Active. | 614 // Show the DelegatedFrameHost to transition from Suspended -> Active. |
| 615 if (browser_compositor_state_ == BrowserCompositorSuspended) { | 615 if (browser_compositor_state_ == BrowserCompositorSuspended) { |
| 616 delegated_frame_host_->SetCompositor(browser_compositor_->compositor()); | 616 delegated_frame_host_->SetCompositor(browser_compositor_->compositor()); |
| 617 delegated_frame_host_->WasShown(ui::LatencyInfo()); | 617 delegated_frame_host_->WasShown(ui::LatencyInfo()); |
| 618 browser_compositor_->compositor()->SetDeferCommits(false); |
| 618 browser_compositor_state_ = BrowserCompositorActive; | 619 browser_compositor_state_ = BrowserCompositorActive; |
| 619 } | 620 } |
| 620 } | 621 } |
| 621 | 622 |
| 622 void RenderWidgetHostViewMac::SuspendBrowserCompositorView() { | 623 void RenderWidgetHostViewMac::SuspendBrowserCompositorView() { |
| 623 TRACE_EVENT0("browser", | 624 TRACE_EVENT0("browser", |
| 624 "RenderWidgetHostViewMac::SuspendBrowserCompositorView"); | 625 "RenderWidgetHostViewMac::SuspendBrowserCompositorView"); |
| 625 | 626 |
| 626 // Hide the DelegatedFrameHost to transition from Active -> Suspended. | 627 // Hide the DelegatedFrameHost to transition from Active -> Suspended. |
| 627 if (browser_compositor_state_ == BrowserCompositorActive) { | 628 if (browser_compositor_state_ == BrowserCompositorActive) { |
| 629 // Ensure that any changes made to the ui::Compositor do not result in new |
| 630 // frames being produced. Note that this does not ensure that |
| 631 // already-in-flight frames will be aborted. |
| 632 browser_compositor_->compositor()->SetDeferCommits(true); |
| 628 // Marking the DelegatedFrameHost as removed from the window hierarchy is | 633 // Marking the DelegatedFrameHost as removed from the window hierarchy is |
| 629 // necessary to remove all connections to its old ui::Compositor. | 634 // necessary to remove all connections to its old ui::Compositor. |
| 630 delegated_frame_host_->WasHidden(); | 635 delegated_frame_host_->WasHidden(); |
| 631 delegated_frame_host_->ResetCompositor(); | 636 delegated_frame_host_->ResetCompositor(); |
| 632 browser_compositor_state_ = BrowserCompositorSuspended; | 637 browser_compositor_state_ = BrowserCompositorSuspended; |
| 633 } | 638 } |
| 634 } | 639 } |
| 635 | 640 |
| 636 void RenderWidgetHostViewMac::DestroyBrowserCompositorView() { | 641 void RenderWidgetHostViewMac::DestroyBrowserCompositorView() { |
| 637 TRACE_EVENT0("browser", | 642 TRACE_EVENT0("browser", |
| (...skipping 2795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3433 | 3438 |
| 3434 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3439 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3435 // regions that are not draggable. (See ControlRegionView in | 3440 // regions that are not draggable. (See ControlRegionView in |
| 3436 // native_app_window_cocoa.mm). This requires the render host view to be | 3441 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3437 // draggable by default. | 3442 // draggable by default. |
| 3438 - (BOOL)mouseDownCanMoveWindow { | 3443 - (BOOL)mouseDownCanMoveWindow { |
| 3439 return YES; | 3444 return YES; |
| 3440 } | 3445 } |
| 3441 | 3446 |
| 3442 @end | 3447 @end |
| OLD | NEW |