| 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 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 ui::TAB_SHOW_COMPONENT, | 902 ui::TAB_SHOW_COMPONENT, |
| 903 render_widget_host_->GetLatencyComponentId(), | 903 render_widget_host_->GetLatencyComponentId(), |
| 904 0); | 904 0); |
| 905 render_widget_host_->WasShown(renderer_latency_info); | 905 render_widget_host_->WasShown(renderer_latency_info); |
| 906 } | 906 } |
| 907 | 907 |
| 908 void RenderWidgetHostViewMac::WasOccluded() { | 908 void RenderWidgetHostViewMac::WasOccluded() { |
| 909 if (render_widget_host_->is_hidden()) | 909 if (render_widget_host_->is_hidden()) |
| 910 return; | 910 return; |
| 911 | 911 |
| 912 // SuspendBrowserCompositorView() instructs the GPU process to free up |
| 913 // resources such as textures. WasHidden() places the renderer process in the |
| 914 // background and throttles its I/O. We're cafeful to call WasHidden() only |
| 915 // after calling SuspendBrowserCompositorView(), otherwise the backgrounded |
| 916 // and throttled renderer's communication with GPU process will take extra |
| 917 // time to complete. The delay will block the foreground renderer's |
| 918 // communication with the GPU process, resulting in longer tab switching |
| 919 // time. http://crbug.com/502502 . |
| 920 SuspendBrowserCompositorView(); |
| 912 render_widget_host_->WasHidden(); | 921 render_widget_host_->WasHidden(); |
| 913 SuspendBrowserCompositorView(); | |
| 914 } | 922 } |
| 915 | 923 |
| 916 void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) { | 924 void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) { |
| 917 gfx::Rect rect = GetViewBounds(); | 925 gfx::Rect rect = GetViewBounds(); |
| 918 rect.set_size(size); | 926 rect.set_size(size); |
| 919 SetBounds(rect); | 927 SetBounds(rect); |
| 920 } | 928 } |
| 921 | 929 |
| 922 void RenderWidgetHostViewMac::SetBounds(const gfx::Rect& rect) { | 930 void RenderWidgetHostViewMac::SetBounds(const gfx::Rect& rect) { |
| 923 // |rect.size()| is view coordinates, |rect.origin| is screen coordinates, | 931 // |rect.size()| is view coordinates, |rect.origin| is screen coordinates, |
| (...skipping 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3290 | 3298 |
| 3291 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3299 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3292 // regions that are not draggable. (See ControlRegionView in | 3300 // regions that are not draggable. (See ControlRegionView in |
| 3293 // native_app_window_cocoa.mm). This requires the render host view to be | 3301 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3294 // draggable by default. | 3302 // draggable by default. |
| 3295 - (BOOL)mouseDownCanMoveWindow { | 3303 - (BOOL)mouseDownCanMoveWindow { |
| 3296 return YES; | 3304 return YES; |
| 3297 } | 3305 } |
| 3298 | 3306 |
| 3299 @end | 3307 @end |
| OLD | NEW |