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

Side by Side Diff: chrome/browser/ui/views/auto_keep_alive.cc

Issue 1708343002: Add ScopedKeepAlive to c/b/lifetime (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ui/views/auto_keep_alive.h" 5 #include "chrome/browser/ui/views/auto_keep_alive.h"
6 6
7 #include "chrome/browser/lifetime/application_lifetime.h" 7 #include "chrome/browser/lifetime/scoped_keep_alive.h"
8 #include "chrome/browser/ui/host_desktop.h" 8 #include "chrome/browser/ui/host_desktop.h"
9 9
10 AutoKeepAlive::AutoKeepAlive(gfx::NativeWindow window) 10 scoped_ptr<ScopedKeepAlive> AutoKeepAlive(gfx::NativeWindow window) {
11 : keep_alive_available_(false) {
12 // In case of aura we want default to be keep alive not available for ash
13 // because ash has keep alive set and we don't want additional keep alive
14 // count.
15 chrome::HostDesktopType desktop_type = 11 chrome::HostDesktopType desktop_type =
sky 2016/02/19 21:02:49 desktop_type is effectively dead and in the proces
dgn 2016/02/22 18:01:20 Chrome OS doesn't require it because it always inc
16 window ? chrome::GetHostDesktopTypeForNativeWindow(window) 12 window ? chrome::GetHostDesktopTypeForNativeWindow(window)
17 : chrome::GetActiveDesktop(); 13 : chrome::GetActiveDesktop();
18 if (desktop_type != chrome::HOST_DESKTOP_TYPE_ASH) { 14
19 keep_alive_available_ = true; 15 if (desktop_type == chrome::HOST_DESKTOP_TYPE_ASH)
20 chrome::IncrementKeepAliveCount(); 16 return scoped_ptr<ScopedKeepAlive>();
21 } 17
18 return make_scoped_ptr(new ScopedKeepAlive("AutoView"));
22 } 19 }
23
24 AutoKeepAlive::~AutoKeepAlive() {
25 if (keep_alive_available_)
26 chrome::DecrementKeepAliveCount();
27 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698