| OLD | NEW |
| 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 "chrome/renderer/chrome_render_process_observer.h" | 5 #include "chrome/renderer/chrome_render_process_observer.h" |
| 6 | 6 |
| 7 #include "base/allocator/allocator_extension.h" |
| 7 #include "base/bind.h" | 8 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 10 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
| 13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 14 #include "base/native_library.h" | 15 #include "base/native_library.h" |
| 15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 16 #include "base/process_util.h" | 17 #include "base/process_util.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 28 #include "content/public/common/resource_dispatcher_delegate.h" | 29 #include "content/public/common/resource_dispatcher_delegate.h" |
| 29 #include "content/public/renderer/render_thread.h" | 30 #include "content/public/renderer/render_thread.h" |
| 30 #include "content/public/renderer/render_view_visitor.h" | 31 #include "content/public/renderer/render_view_visitor.h" |
| 31 #include "content/public/renderer/render_view.h" | 32 #include "content/public/renderer/render_view.h" |
| 32 #include "crypto/nss_util.h" | 33 #include "crypto/nss_util.h" |
| 33 #include "media/base/media_switches.h" | 34 #include "media/base/media_switches.h" |
| 34 #include "net/base/net_errors.h" | 35 #include "net/base/net_errors.h" |
| 35 #include "net/base/net_module.h" | 36 #include "net/base/net_module.h" |
| 36 #include "third_party/sqlite/sqlite3.h" | 37 #include "third_party/sqlite/sqlite3.h" |
| 37 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" | 38 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" |
| 38 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" | |
| 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" | 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" |
| 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCrossOriginPreflig
htResultCache.h" | 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCrossOriginPreflig
htResultCache.h" |
| 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFontCache.h" | 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFontCache.h" |
| 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" |
| 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 46 #include "v8/include/v8.h" | 46 #include "v8/include/v8.h" |
| 47 | 47 |
| 48 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 // Clear the Cross-Origin Preflight cache. | 322 // Clear the Cross-Origin Preflight cache. |
| 323 WebCrossOriginPreflightResultCache::clear(); | 323 WebCrossOriginPreflightResultCache::clear(); |
| 324 | 324 |
| 325 // Release all freeable memory from the SQLite process-global page cache (a | 325 // Release all freeable memory from the SQLite process-global page cache (a |
| 326 // low-level object which backs the Connection-specific page caches). | 326 // low-level object which backs the Connection-specific page caches). |
| 327 while (sqlite3_release_memory(std::numeric_limits<int>::max()) > 0) { | 327 while (sqlite3_release_memory(std::numeric_limits<int>::max()) > 0) { |
| 328 } | 328 } |
| 329 | 329 |
| 330 v8::V8::LowMemoryNotification(); | 330 v8::V8::LowMemoryNotification(); |
| 331 | 331 |
| 332 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) | 332 // Tell our allocator to release any free pages it's still holding. |
| 333 // Tell tcmalloc to release any free pages it's still holding. | 333 base::allocator::ReleaseFreeMemory(); |
| 334 MallocExtension::instance()->ReleaseFreeMemory(); | |
| 335 #endif | |
| 336 | 334 |
| 337 if (client_) | 335 if (client_) |
| 338 client_->OnPurgeMemory(); | 336 client_->OnPurgeMemory(); |
| 339 } | 337 } |
| 340 | 338 |
| 341 void ChromeRenderProcessObserver::ExecutePendingClearCache() { | 339 void ChromeRenderProcessObserver::ExecutePendingClearCache() { |
| 342 if (clear_cache_pending_) { | 340 if (clear_cache_pending_) { |
| 343 clear_cache_pending_ = false; | 341 clear_cache_pending_ = false; |
| 344 WebCache::clear(); | 342 WebCache::clear(); |
| 345 } | 343 } |
| 346 } | 344 } |
| 347 | 345 |
| 348 const RendererContentSettingRules* | 346 const RendererContentSettingRules* |
| 349 ChromeRenderProcessObserver::content_setting_rules() const { | 347 ChromeRenderProcessObserver::content_setting_rules() const { |
| 350 return &content_setting_rules_; | 348 return &content_setting_rules_; |
| 351 } | 349 } |
| OLD | NEW |