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

Side by Side Diff: chrome/browser/ui/app_list/app_list_service_mac.mm

Issue 646353002: Give up on threaded animations for the Mac App Launcher NSWindow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/app_list/cocoa/apps_search_results_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #import "chrome/browser/ui/app_list/app_list_service_mac.h" 5 #import "chrome/browser/ui/app_list/app_list_service_mac.h"
6 6
7 #include <ApplicationServices/ApplicationServices.h> 7 #include <ApplicationServices/ApplicationServices.h>
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 [animation_ setDelegate:self]; 572 [animation_ setDelegate:self];
573 573
574 if (closing) { 574 if (closing) {
575 [animation_ setAnimationCurve:NSAnimationEaseIn]; 575 [animation_ setAnimationCurve:NSAnimationEaseIn];
576 window_.reset([window retain]); 576 window_.reset([window retain]);
577 } else { 577 } else {
578 [window setAlphaValue:0.0f]; 578 [window setAlphaValue:0.0f];
579 [animation_ setAnimationCurve:NSAnimationEaseOut]; 579 [animation_ setAnimationCurve:NSAnimationEaseOut];
580 window_.reset(); 580 window_.reset();
581 } 581 }
582 // Threaded animations are buggy on Snow Leopard. See http://crbug.com/335550. 582 // This once used a threaded animation, but AppKit would too often ignore
583 // Note that in the non-threaded case, the animation won't start unless the 583 // -[NSView canDrawConcurrently:] and just redraw whole view hierarchies on
584 // UI runloop has spun up, so on <= Lion the animation will only animate if 584 // the animation thread anyway, creating a minefield of race conditions.
585 // Chrome is already running. 585 // Non-threaded means the animation isn't as smooth and doesn't begin unless
586 if (base::mac::IsOSMountainLionOrLater()) 586 // the UI runloop has spun up (after profile loading).
587 [animation_ setAnimationBlockingMode:NSAnimationNonblockingThreaded]; 587 [animation_ setAnimationBlockingMode:NSAnimationNonblocking];
588 else
589 [animation_ setAnimationBlockingMode:NSAnimationNonblocking];
590 588
591 [animation_ startAnimation]; 589 [animation_ startAnimation];
592 } 590 }
593 591
594 - (void)cleanupOnUIThread { 592 - (void)cleanupOnUIThread {
595 bool closing = [self isClosing]; 593 bool closing = [self isClosing];
596 [window_ close]; 594 [window_ close];
597 window_.reset(); 595 window_.reset();
598 animation_.reset(); 596 animation_.reset();
599 597
600 if (closing) 598 if (closing)
601 apps::AppShimHandler::MaybeTerminate(); 599 apps::AppShimHandler::MaybeTerminate();
602 } 600 }
603 601
604 - (void)animationDidEnd:(NSAnimation*)animation { 602 - (void)animationDidEnd:(NSAnimation*)animation {
605 content::BrowserThread::PostTask( 603 content::BrowserThread::PostTask(
606 content::BrowserThread::UI, 604 content::BrowserThread::UI,
607 FROM_HERE, 605 FROM_HERE,
608 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, 606 base::Bind(&AppListServiceMac::WindowAnimationDidEnd,
609 base::Unretained(AppListServiceMac::GetInstance()))); 607 base::Unretained(AppListServiceMac::GetInstance())));
610 } 608 }
611 609
612 @end 610 @end
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/cocoa/apps_search_results_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698