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

Side by Side Diff: chrome/browser/memory_purger.cc

Issue 15984016: Call scoped_refptr<T>::get() rather than relying on implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 | Annotate | Revision Log
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 "chrome/browser/memory_purger.h" 5 #include "chrome/browser/memory_purger.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/allocator/allocator_extension.h" 9 #include "base/allocator/allocator_extension.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // hasn't been done already. 113 // hasn't been done already.
114 HistoryService* history_service = 114 HistoryService* history_service =
115 HistoryServiceFactory::GetForProfileWithoutCreating(profiles[i]); 115 HistoryServiceFactory::GetForProfileWithoutCreating(profiles[i]);
116 if (history_service) 116 if (history_service)
117 history_service->UnloadBackend(); 117 history_service->UnloadBackend();
118 118
119 // Unload all web databases (freeing memory used to cache sqlite). 119 // Unload all web databases (freeing memory used to cache sqlite).
120 WebDataServiceWrapper* wds_wrapper = 120 WebDataServiceWrapper* wds_wrapper =
121 WebDataServiceFactory::GetForProfileIfExists( 121 WebDataServiceFactory::GetForProfileIfExists(
122 profiles[i], Profile::EXPLICIT_ACCESS); 122 profiles[i], Profile::EXPLICIT_ACCESS);
123 if (wds_wrapper && wds_wrapper->GetWebData()) 123 if (wds_wrapper && wds_wrapper->GetWebData().get())
124 wds_wrapper->GetWebData()->UnloadDatabase(); 124 wds_wrapper->GetWebData()->UnloadDatabase();
125 125
126 BrowserContext::PurgeMemory(profiles[i]); 126 BrowserContext::PurgeMemory(profiles[i]);
127 } 127 }
128 128
129 BrowserThread::PostTask( 129 BrowserThread::PostTask(
130 BrowserThread::IO, FROM_HERE, 130 BrowserThread::IO, FROM_HERE,
131 base::Bind(&PurgeMemoryIOHelper::PurgeMemoryOnIOThread, 131 base::Bind(&PurgeMemoryIOHelper::PurgeMemoryOnIOThread,
132 purge_memory_io_helper.get())); 132 purge_memory_io_helper.get()));
133 133
(...skipping 20 matching lines...) Expand all
154 content::RenderProcessHost::AllHostsIterator()); 154 content::RenderProcessHost::AllHostsIterator());
155 !i.IsAtEnd(); i.Advance()) 155 !i.IsAtEnd(); i.Advance())
156 PurgeRendererForHost(i.GetCurrentValue()); 156 PurgeRendererForHost(i.GetCurrentValue());
157 } 157 }
158 158
159 // static 159 // static
160 void MemoryPurger::PurgeRendererForHost(content::RenderProcessHost* host) { 160 void MemoryPurger::PurgeRendererForHost(content::RenderProcessHost* host) {
161 // Direct the renderer to free everything it can. 161 // Direct the renderer to free everything it can.
162 host->Send(new ChromeViewMsg_PurgeMemory()); 162 host->Send(new ChromeViewMsg_PurgeMemory());
163 } 163 }
OLDNEW
« no previous file with comments | « chrome/browser/managed_mode/managed_user_service.cc ('k') | chrome/browser/metrics/metrics_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698