summaryrefslogtreecommitdiffstats
path: root/chrome/browser/memory_purger.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-24 18:10:36 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-24 18:10:36 +0000
commit6e2d3d229024a3a0038c8a5c169bfd948a5c4939 (patch)
treeb9f37d0c4fc5758e2c0d4b4c407c3059ca59dd68 /chrome/browser/memory_purger.cc
parentaee7b0822009cda31b7aea2922263a0b5adc6c9a (diff)
downloadchromium_src-6e2d3d229024a3a0038c8a5c169bfd948a5c4939.zip
chromium_src-6e2d3d229024a3a0038c8a5c169bfd948a5c4939.tar.gz
chromium_src-6e2d3d229024a3a0038c8a5c169bfd948a5c4939.tar.bz2
Remove usage of WebKitContext from chrome. This also cleans up the chrome code so that it only calls profile-wide operations (i.e. saving session/purging memory/clearing local state on exit) on the BrowserContext. The content layer takes care of calling the necessary objects on the right thread.
WebKitContext now does almost nothing and I'll remove it completely in the next change. BUG=98716 Review URL: https://chromiumcodereview.appspot.com/9462007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123509 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/memory_purger.cc')
-rw-r--r--chrome/browser/memory_purger.cc20
1 files changed, 1 insertions, 19 deletions
diff --git a/chrome/browser/memory_purger.cc b/chrome/browser/memory_purger.cc
index 1401651..2222d81 100644
--- a/chrome/browser/memory_purger.cc
+++ b/chrome/browser/memory_purger.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/render_messages.h"
-#include "content/browser/in_process_webkit/webkit_context.h"
#include "content/browser/renderer_host/backing_store_manager.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/resource_context.h"
@@ -24,7 +23,6 @@
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "third_party/tcmalloc/chromium/src/google/malloc_extension.h"
-#include "webkit/appcache/appcache_service.h"
using content::BrowserContext;
using content::BrowserThread;
@@ -45,15 +43,12 @@ class PurgeMemoryIOHelper
void AddRequestContextGetter(
scoped_refptr<net::URLRequestContextGetter> request_context_getter);
- void AddResourceContext(content::ResourceContext* resource_context);
-
void PurgeMemoryOnIOThread();
private:
typedef scoped_refptr<net::URLRequestContextGetter> RequestContextGetter;
std::vector<RequestContextGetter> request_context_getters_;
- std::vector<content::ResourceContext*> resource_contexts_;
scoped_refptr<SafeBrowsingService> safe_browsing_service_;
DISALLOW_COPY_AND_ASSIGN(PurgeMemoryIOHelper);
@@ -64,11 +59,6 @@ void PurgeMemoryIOHelper::AddRequestContextGetter(
request_context_getters_.push_back(request_context_getter);
}
-void PurgeMemoryIOHelper::AddResourceContext(
- content::ResourceContext* resource_context) {
- resource_contexts_.push_back(resource_context);
-}
-
void PurgeMemoryIOHelper::PurgeMemoryOnIOThread() {
// Ask ProxyServices to purge any memory they can (generally garbage in the
// wrapped ProxyResolver's JS engine).
@@ -77,9 +67,6 @@ void PurgeMemoryIOHelper::PurgeMemoryOnIOThread() {
PurgeMemory();
}
- for (size_t i = 0; i < resource_contexts_.size(); ++i)
- ResourceContext::GetAppCacheService(resource_contexts_[i])->PurgeMemory();
-
safe_browsing_service_->PurgeMemory();
}
@@ -108,8 +95,6 @@ void MemoryPurger::PurgeBrowser() {
for (size_t i = 0; i < profiles.size(); ++i) {
purge_memory_io_helper->AddRequestContextGetter(
make_scoped_refptr(profiles[i]->GetRequestContext()));
- purge_memory_io_helper->AddResourceContext(
- profiles[i]->GetResourceContext());
// NOTE: Some objects below may be duplicates across profiles. We could
// conceivably put all these in sets and then iterate over the sets.
@@ -128,10 +113,7 @@ void MemoryPurger::PurgeBrowser() {
if (web_data_service)
web_data_service->UnloadDatabase();
- // Ask all WebKitContexts to purge memory (freeing memory used to cache
- // the LocalStorage sqlite DB). WebKitContext creation is basically free so
- // we don't bother with a "...WithoutCreating()" function.
- BrowserContext::GetWebKitContext(profiles[i])->PurgeMemory();
+ BrowserContext::PurgeMemory(profiles[i]);
}
BrowserThread::PostTask(