| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/thread.h" | 7 #include "base/thread.h" |
| 8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
| 11 #include "chrome/browser/in_process_webkit/webkit_context.h" | 11 #include "chrome/browser/in_process_webkit/webkit_context.h" |
| 12 #include "chrome/browser/net/url_request_context_getter.h" | 12 #include "chrome/browser/net/url_request_context_getter.h" |
| 13 #include "chrome/browser/profile_manager.h" | 13 #include "chrome/browser/profile_manager.h" |
| 14 #include "chrome/browser/renderer_host/backing_store_manager.h" | 14 #include "chrome/browser/renderer_host/backing_store_manager.h" |
| 15 #include "chrome/browser/renderer_host/render_process_host.h" | 15 #include "chrome/browser/renderer_host/render_process_host.h" |
| 16 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 16 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 17 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 17 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 18 #include "chrome/browser/webdata/web_data_service.h" | 18 #include "chrome/browser/webdata/web_data_service.h" |
| 19 #include "chrome/common/render_messages.h" | 19 #include "chrome/common/render_messages.h" |
| 20 #include "net/proxy/proxy_resolver.h" | 20 #include "net/proxy/proxy_resolver.h" |
| 21 #include "net/url_request/url_request_context.h" | 21 #include "net/url_request/url_request_context.h" |
| 22 #include "third_party/tcmalloc/tcmalloc/src/google/malloc_extension.h" | 22 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" |
| 23 #include "v8/include/v8.h" | 23 #include "v8/include/v8.h" |
| 24 | 24 |
| 25 // PurgeMemoryHelper ----------------------------------------------------------- | 25 // PurgeMemoryHelper ----------------------------------------------------------- |
| 26 | 26 |
| 27 // This is a small helper class used to ensure that the objects we want to use | 27 // This is a small helper class used to ensure that the objects we want to use |
| 28 // on multiple threads are properly refed, so they don't get deleted out from | 28 // on multiple threads are properly refed, so they don't get deleted out from |
| 29 // under us. | 29 // under us. |
| 30 class PurgeMemoryIOHelper | 30 class PurgeMemoryIOHelper |
| 31 : public base::RefCountedThreadSafe<PurgeMemoryIOHelper> { | 31 : public base::RefCountedThreadSafe<PurgeMemoryIOHelper> { |
| 32 public: | 32 public: |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); | 148 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); |
| 149 !i.IsAtEnd(); i.Advance()) | 149 !i.IsAtEnd(); i.Advance()) |
| 150 PurgeRendererForHost(i.GetCurrentValue()); | 150 PurgeRendererForHost(i.GetCurrentValue()); |
| 151 } | 151 } |
| 152 | 152 |
| 153 // static | 153 // static |
| 154 void MemoryPurger::PurgeRendererForHost(RenderProcessHost* host) { | 154 void MemoryPurger::PurgeRendererForHost(RenderProcessHost* host) { |
| 155 // Direct the renderer to free everything it can. | 155 // Direct the renderer to free everything it can. |
| 156 host->Send(new ViewMsg_PurgeMemory()); | 156 host->Send(new ViewMsg_PurgeMemory()); |
| 157 } | 157 } |
| OLD | NEW |