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

Side by Side Diff: net/http/http_network_session.cc

Issue 2648323005: memory coordinator: Add MemoryCoordinatorClient::OnPurgeMemory() (Closed)
Patch Set: Created 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/http/http_network_session.h" 5 #include "net/http/http_network_session.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 switch (memory_pressure_level) { 470 switch (memory_pressure_level) {
471 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE: 471 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE:
472 break; 472 break;
473 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE: 473 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE:
474 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL: 474 case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL:
475 CloseIdleConnections(); 475 CloseIdleConnections();
476 break; 476 break;
477 } 477 }
478 } 478 }
479 479
480 void HttpNetworkSession::OnMemoryStateChange(base::MemoryState state) { 480 void HttpNetworkSession::OnPurgeMemory() {
481 // TODO(hajimehoshi): When the state changes, adjust the sizes of the caches 481 CloseIdleConnections();
482 // to reduce the limits. HttpNetworkSession doesn't have the ability to limit
483 // at present.
484 switch (state) {
485 case base::MemoryState::NORMAL:
486 break;
487 case base::MemoryState::THROTTLED:
488 CloseIdleConnections();
489 break;
490 case base::MemoryState::SUSPENDED:
491 // Note: Not supported at present. Fall through.
492 case base::MemoryState::UNKNOWN:
493 NOTREACHED();
494 break;
495 }
496 } 482 }
497 483
498 } // namespace net 484 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698