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

Unified Diff: chrome/browser/ui/cocoa/dev_tools_controller.mm

Issue 171973004: NSView cleanup for CoreAnimation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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: chrome/browser/ui/cocoa/dev_tools_controller.mm
diff --git a/chrome/browser/ui/cocoa/dev_tools_controller.mm b/chrome/browser/ui/cocoa/dev_tools_controller.mm
index f2bff7a4005650564f216b7bff9db6cce08f37ce..03f3bf4b0b5f117bf89f737d5ca6610bb1cdc200 100644
--- a/chrome/browser/ui/cocoa/dev_tools_controller.mm
+++ b/chrome/browser/ui/cocoa/dev_tools_controller.mm
@@ -9,6 +9,7 @@
#include <Cocoa/Cocoa.h>
+#include "base/command_line.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
@@ -16,10 +17,22 @@
#include "chrome/common/pref_names.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
+#include "content/public/common/content_switches.h"
#include "ui/base/cocoa/base_view.h"
#include "ui/base/cocoa/focus_tracker.h"
+#include "ui/gfx/mac/scoped_ns_disable_screen_updates.h"
#include "ui/gfx/size_conversions.h"
+namespace {
+
+bool CoreAnimationIsEnabled() {
+ static bool is_enabled = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kUseCoreAnimation);
+ return is_enabled;
+}
+
+}
+
using content::WebContents;
@interface DevToolsContainerView : BaseView {
@@ -55,13 +68,27 @@ using content::WebContents;
DCHECK_EQ(1u, [subviews count]);
contentsView_ = [subviews objectAtIndex:0];
devToolsView_ = devToolsView;
- // Place DevTools under contents.
- [self addSubview:devToolsView positioned:NSWindowBelow relativeTo:nil];
+ if (CoreAnimationIsEnabled()) {
dgozman 2014/02/20 21:29:51 Do you plan to discard the old without-core-animat
ccameron 2014/02/20 21:31:10 Yes, hopefully all non-CA code will be deleted bef
+ // Make sure we do not draw any transient arrangements of views.
+ gfx::ScopedNSDisableScreenUpdates disabler;
+ [self replaceSubview:contentsView_ with:devToolsView_];
+ [devToolsView_ addSubview:contentsView_];
+ } else {
+ // Place DevTools under contents.
+ [self addSubview:devToolsView positioned:NSWindowBelow relativeTo:nil];
+ }
}
- (void)hideDevTools {
DCHECK_EQ(2u, [[self subviews] count]);
- [devToolsView_ removeFromSuperview];
+ if (CoreAnimationIsEnabled()) {
+ // Make sure we do not draw any transient arrangements of views.
+ gfx::ScopedNSDisableScreenUpdates disabler;
+ [contentsView_ removeFromSuperview];
+ [self replaceSubview:devToolsView_ with:contentsView_];
+ } else {
+ [devToolsView_ removeFromSuperview];
+ }
contentsView_ = nil;
devToolsView_ = nil;
}
@@ -118,6 +145,8 @@ using content::WebContents;
DevToolsWindow* newDevToolsWindow = contents ?
DevToolsWindow::GetDockedInstanceForInspectedTab(contents) : NULL;
+ // Make sure we do not draw any transient arrangements of views.
+ gfx::ScopedNSDisableScreenUpdates disabler;
bool shouldHide = devToolsWindow_ && devToolsWindow_ != newDevToolsWindow;
bool shouldShow = newDevToolsWindow && devToolsWindow_ != newDevToolsWindow;
@@ -141,8 +170,6 @@ using content::WebContents;
[self showDevToolsView];
[devToolsContainerView_ adjustSubviews];
- if (shouldHide || shouldShow)
- [[devToolsContainerView_ window] disableScreenUpdatesUntilFlush];
}
- (void)showDevToolsView {
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698