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

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

Issue 653563004: NULL -> nullptr under athena/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src@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
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"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // |wait_time_for_resource_deallocation_| between executed calls. 140 // |wait_time_for_resource_deallocation_| between executed calls.
141 base::Time next_resource_management_time_; 141 base::Time next_resource_management_time_;
142 142
143 // The wait time between two resource managing executions. 143 // The wait time between two resource managing executions.
144 base::TimeDelta wait_time_for_resource_deallocation_; 144 base::TimeDelta wait_time_for_resource_deallocation_;
145 145
146 DISALLOW_COPY_AND_ASSIGN(ResourceManagerImpl); 146 DISALLOW_COPY_AND_ASSIGN(ResourceManagerImpl);
147 }; 147 };
148 148
149 namespace { 149 namespace {
150 ResourceManagerImpl* instance = NULL; 150 ResourceManagerImpl* instance = nullptr;
151 151
152 // We allow this many activities to be visible. All others must be at state of 152 // We allow this many activities to be visible. All others must be at state of
153 // invisible or below. 153 // invisible or below.
154 const int kMaxVisibleActivities = 3; 154 const int kMaxVisibleActivities = 3;
155 155
156 } // namespace 156 } // namespace
157 157
158 ResourceManagerImpl::ResourceManagerImpl(ResourceManagerDelegate* delegate) 158 ResourceManagerImpl::ResourceManagerImpl(ResourceManagerDelegate* delegate)
159 : delegate_(delegate), 159 : delegate_(delegate),
160 current_memory_pressure_(MEMORY_PRESSURE_UNKNOWN), 160 current_memory_pressure_(MEMORY_PRESSURE_UNKNOWN),
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 break; 360 break;
361 case MEMORY_PRESSURE_MODERATE: 361 case MEMORY_PRESSURE_MODERATE:
362 max_running_activities = 7; 362 max_running_activities = 7;
363 break; 363 break;
364 case MEMORY_PRESSURE_LOW: 364 case MEMORY_PRESSURE_LOW:
365 NOTREACHED(); 365 NOTREACHED();
366 return; 366 return;
367 } 367 }
368 368
369 // Check if / which activity we want to unload. 369 // Check if / which activity we want to unload.
370 Activity* oldest_media_activity = NULL; 370 Activity* oldest_media_activity = nullptr;
371 std::vector<Activity*> unloadable_activities; 371 std::vector<Activity*> unloadable_activities;
372 for (std::vector<Activity*>::iterator it = activity_list_.begin(); 372 for (std::vector<Activity*>::iterator it = activity_list_.begin();
373 it != activity_list_.end(); ++it) { 373 it != activity_list_.end(); ++it) {
374 Activity::ActivityState state = (*it)->GetCurrentState(); 374 Activity::ActivityState state = (*it)->GetCurrentState();
375 // The activity should neither be unloaded nor visible. 375 // The activity should neither be unloaded nor visible.
376 if (state != Activity::ACTIVITY_UNLOADED && 376 if (state != Activity::ACTIVITY_UNLOADED &&
377 state != Activity::ACTIVITY_VISIBLE) { 377 state != Activity::ACTIVITY_VISIBLE) {
378 if ((*it)->GetMediaState() == Activity::ACTIVITY_MEDIA_STATE_NONE) { 378 if ((*it)->GetMediaState() == Activity::ACTIVITY_MEDIA_STATE_NONE) {
379 // Does not play media - so we can unload this immediately. 379 // Does not play media - so we can unload this immediately.
380 unloadable_activities.push_back(*it); 380 unloadable_activities.push_back(*it);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 469
470 // static 470 // static
471 ResourceManager* ResourceManager::Get() { 471 ResourceManager* ResourceManager::Get() {
472 return instance; 472 return instance;
473 } 473 }
474 474
475 // static 475 // static
476 void ResourceManager::Shutdown() { 476 void ResourceManager::Shutdown() {
477 DCHECK(instance); 477 DCHECK(instance);
478 delete instance; 478 delete instance;
479 instance = NULL; 479 instance = nullptr;
480 } 480 }
481 481
482 ResourceManager::ResourceManager() {} 482 ResourceManager::ResourceManager() {}
483 483
484 ResourceManager::~ResourceManager() { 484 ResourceManager::~ResourceManager() {
485 DCHECK(instance); 485 DCHECK(instance);
486 instance = NULL; 486 instance = nullptr;
487 } 487 }
488 488
489 } // namespace athena 489 } // namespace athena
OLDNEW
« no previous file with comments | « athena/resource_manager/memory_pressure_notifier_unittest.cc ('k') | athena/screen/modal_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698