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

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 511923004: Simplify IOSurface CoreAnimation code: Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use accessors Created 6 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 4ebbd6291d3290e77da750fb3e2c1fffb6137e85..8f5ae95e87c546051cc1466ed875b336ce2876ca 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -30,19 +30,17 @@
#include "content/browser/accessibility/browser_accessibility_manager_mac.h"
#import "content/browser/cocoa/system_hotkey_helper_mac.h"
#import "content/browser/cocoa/system_hotkey_map.h"
+#include "content/browser/compositor/io_surface_layer_mac.h"
#include "content/browser/compositor/resize_lock.h"
+#include "content/browser/compositor/software_layer_mac.h"
#include "content/browser/frame_host/frame_tree.h"
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/gpu/compositor_util.h"
-#include "content/browser/renderer_host/compositing_iosurface_context_mac.h"
-#include "content/browser/renderer_host/compositing_iosurface_layer_mac.h"
-#include "content/browser/renderer_host/compositing_iosurface_mac.h"
#include "content/browser/renderer_host/render_widget_helper.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_helper.h"
#import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper.h"
-#import "content/browser/renderer_host/software_layer_mac.h"
#import "content/browser/renderer_host/text_input_client_mac.h"
#include "content/common/accessibility_messages.h"
#include "content/common/edit_command.h"
@@ -452,8 +450,44 @@ DelegatedFrameHost* RenderWidgetHostViewMac::GetDelegatedFrameHost() const {
bool RenderWidgetHostViewMac::BrowserCompositorViewShouldAckImmediately()
const {
- // The logic for delegated and non-delegated rendering is the same.
- return AcceleratedLayerShouldAckImmediately();
+ // If vsync is disabled, then always draw and ack frames immediately.
+ static bool is_vsync_disabled =
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableGpuVsync);
+ if (is_vsync_disabled)
+ return true;
+
+ // If the window is occluded, then this frame's display call may be severely
+ // throttled. This is a good thing, unless tab capture may be active, because
+ // the broadcast will be inappropriately throttled.
+ // http://crbug.com/350410
+
+ // If tab capture isn't active then only ack frames when we draw them.
+ if (delegated_frame_host_ && !delegated_frame_host_->HasFrameSubscriber())
+ return false;
+
+ NSWindow* window = [cocoa_view_ window];
+ // If the view isn't even in the heirarchy then frames will never be drawn,
+ // so ack them immediately.
+ if (!window)
+ return true;
+
+ // Check the window occlusion API.
+ if ([window respondsToSelector:@selector(occlusionState)]) {
+ if ([window occlusionState] & NSWindowOcclusionStateVisible) {
+ // If the window is visible then it is safe to wait until frames are
+ // drawn to ack them.
+ return false;
+ } else {
+ // If the window is occluded then frames may never be drawn, so ack them
+ // immediately.
+ return true;
+ }
+ }
+
+ // If the window occlusion API is not present then ack frames when we draw
+ // them.
+ return false;
}
void RenderWidgetHostViewMac::BrowserCompositorViewFrameSwapped(
@@ -1594,56 +1628,6 @@ SkColorType RenderWidgetHostViewMac::PreferredReadbackFormat() {
}
////////////////////////////////////////////////////////////////////////////////
-// CompositingIOSurfaceLayerClient, public:
-
-bool RenderWidgetHostViewMac::AcceleratedLayerShouldAckImmediately() const {
- // If vsync is disabled, then always draw and ack frames immediately.
- static bool is_vsync_disabled =
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableGpuVsync);
- if (is_vsync_disabled)
- return true;
-
- // If the window is occluded, then this frame's display call may be severely
- // throttled. This is a good thing, unless tab capture may be active, because
- // the broadcast will be inappropriately throttled.
- // http://crbug.com/350410
-
- // If tab capture isn't active then only ack frames when we draw them.
- if (delegated_frame_host_ && !delegated_frame_host_->HasFrameSubscriber())
- return false;
-
- NSWindow* window = [cocoa_view_ window];
- // If the view isn't even in the heirarchy then frames will never be drawn,
- // so ack them immediately.
- if (!window)
- return true;
-
- // Check the window occlusion API.
- if ([window respondsToSelector:@selector(occlusionState)]) {
- if ([window occlusionState] & NSWindowOcclusionStateVisible) {
- // If the window is visible then it is safe to wait until frames are
- // drawn to ack them.
- return false;
- } else {
- // If the window is occluded then frames may never be drawn, so ack them
- // immediately.
- return true;
- }
- }
-
- // If the window occlusion API is not present then ack frames when we draw
- // them.
- return false;
-}
-
-void RenderWidgetHostViewMac::AcceleratedLayerDidDrawFrame() {
-}
-
-void RenderWidgetHostViewMac::AcceleratedLayerHitError() {
-}
-
-////////////////////////////////////////////////////////////////////////////////
// gfx::DisplayObserver, public:
void RenderWidgetHostViewMac::OnDisplayAdded(const gfx::Display& display) {
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.h ('k') | content/browser/renderer_host/software_layer_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698