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

Side by Side Diff: athena/resource_manager/resource_manager_impl.cc

Issue 596623005: Do not show the activity widget in ActivityManager::AddActivity (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: rebase Created 6 years, 3 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 | « athena/main/url_search_provider.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "athena/resource_manager/public/resource_manager.h" 5 #include "athena/resource_manager/public/resource_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "athena/activity/public/activity.h" 10 #include "athena/activity/public/activity.h"
11 #include "athena/activity/public/activity_manager.h" 11 #include "athena/activity/public/activity_manager.h"
12 #include "athena/activity/public/activity_manager_observer.h" 12 #include "athena/activity/public/activity_manager_observer.h"
13 #include "athena/resource_manager/memory_pressure_notifier.h" 13 #include "athena/resource_manager/memory_pressure_notifier.h"
14 #include "athena/resource_manager/public/resource_manager_delegate.h" 14 #include "athena/resource_manager/public/resource_manager_delegate.h"
15 #include "athena/wm/public/window_list_provider.h" 15 #include "athena/wm/public/window_list_provider.h"
16 #include "athena/wm/public/window_list_provider_observer.h" 16 #include "athena/wm/public/window_list_provider_observer.h"
17 #include "athena/wm/public/window_manager.h" 17 #include "athena/wm/public/window_manager.h"
18 #include "athena/wm/public/window_manager_observer.h" 18 #include "athena/wm/public/window_manager_observer.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
23 23
24 namespace athena { 24 namespace athena {
25 namespace {
25 26
26 class ResourceManagerImpl : public ResourceManager, 27 class ResourceManagerImpl : public ResourceManager,
27 public WindowManagerObserver, 28 public WindowManagerObserver,
28 public ActivityManagerObserver, 29 public ActivityManagerObserver,
29 public MemoryPressureObserver, 30 public MemoryPressureObserver,
30 public WindowListProviderObserver { 31 public WindowListProviderObserver {
31 public: 32 public:
32 ResourceManagerImpl(ResourceManagerDelegate* delegate); 33 ResourceManagerImpl(ResourceManagerDelegate* delegate);
33 virtual ~ResourceManagerImpl(); 34 virtual ~ResourceManagerImpl();
34 35
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 void ResourceManagerImpl::OnMemoryPressureIncreased() { 453 void ResourceManagerImpl::OnMemoryPressureIncreased() {
453 // By setting the timer to Now, the next call will immediately be performed. 454 // By setting the timer to Now, the next call will immediately be performed.
454 next_resource_management_time_ = base::Time::Now(); 455 next_resource_management_time_ = base::Time::Now();
455 } 456 }
456 457
457 bool ResourceManagerImpl::AllowedToUnloadActivity() { 458 bool ResourceManagerImpl::AllowedToUnloadActivity() {
458 return current_memory_pressure_ != MEMORY_PRESSURE_LOW && 459 return current_memory_pressure_ != MEMORY_PRESSURE_LOW &&
459 base::Time::Now() >= next_resource_management_time_; 460 base::Time::Now() >= next_resource_management_time_;
460 } 461 }
461 462
463 } // namespace
464
462 // static 465 // static
463 void ResourceManager::Create() { 466 void ResourceManager::Create() {
464 DCHECK(!instance); 467 DCHECK(!instance);
465 instance = new ResourceManagerImpl( 468 instance = new ResourceManagerImpl(
466 ResourceManagerDelegate::CreateResourceManagerDelegate()); 469 ResourceManagerDelegate::CreateResourceManagerDelegate());
467 } 470 }
468 471
469 // static 472 // static
470 ResourceManager* ResourceManager::Get() { 473 ResourceManager* ResourceManager::Get() {
471 return instance; 474 return instance;
472 } 475 }
473 476
474 // static 477 // static
475 void ResourceManager::Shutdown() { 478 void ResourceManager::Shutdown() {
476 DCHECK(instance); 479 DCHECK(instance);
477 delete instance; 480 delete instance;
478 instance = NULL; 481 instance = NULL;
479 } 482 }
480 483
481 ResourceManager::ResourceManager() {} 484 ResourceManager::ResourceManager() {}
482 485
483 ResourceManager::~ResourceManager() { 486 ResourceManager::~ResourceManager() {
484 DCHECK(instance); 487 DCHECK(instance);
485 instance = NULL; 488 instance = NULL;
486 } 489 }
487 490
488 } // namespace athena 491 } // namespace athena
OLDNEW
« no previous file with comments | « athena/main/url_search_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698