From c26e94d76aaa4298065cca2994045377ba4ed6c5 Mon Sep 17 00:00:00 2001 From: Leszek Syroka Date: Thu, 21 Jan 2016 16:00:01 +0100 Subject: [PATCH] Remove warnings from MemoryPurger Refactoring of MemoryPurger class. Warnings, unused includes and dead code have been removed. Erased code contained helper class calling non-existent memory purging methods of ProxyService. MemomoryPurger was marked in previous commits as obsolete https://code.google.com/p/chromium/issues/detail?id=350455. MemoryPurger has not been removed from code base due to existing references to its interface. Currently only EWebContext::NotifyLowMemory invokes MemoryPurger methods. Original beta/m47 patch: http://165.213.202.130/gerrit/#/c/104842/ Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=4822 Reviewed by: a1.gomes Change-Id: Ib77e5d2983c38fa1281f37902370d2d1ad387748 Signed-off-by: Leszek Syroka (cherry picked from commit f776a5291d3af1bea61497155cb3724cf0ef3aa9) --- tizen_src/ewk/efl_integration/memory_purger.cc | 75 -------------------------- 1 file changed, 75 deletions(-) diff --git a/tizen_src/ewk/efl_integration/memory_purger.cc b/tizen_src/ewk/efl_integration/memory_purger.cc index 1f79b4d..fafd3e3 100644 --- a/tizen_src/ewk/efl_integration/memory_purger.cc +++ b/tizen_src/ewk/efl_integration/memory_purger.cc @@ -5,68 +5,10 @@ #include "memory_purger.h" -#include - #include "base/allocator/allocator_extension.h" -#include "base/bind.h" -#include "base/threading/thread.h" -#include "content/common/render_messages_efl.h" #include "content/public/browser/render_process_host.h" -#include "content/public/browser/render_widget_host.h" -#include "content/public/browser/browser_thread.h" -#include "net/proxy/proxy_resolver.h" -#include "net/proxy/proxy_service.h" -#include "net/url_request/url_request_context.h" -#include "net/url_request/url_request_context_getter.h" using content::BrowserContext; -using content::BrowserThread; - -// PurgeMemoryHelper ----------------------------------------------------------- - -// This is a small helper class used to ensure that the objects we want to use -// on multiple threads are properly refed, so they don't get deleted out from -// under us. -class PurgeMemoryIOHelper - : public base::RefCountedThreadSafe { - public: - PurgeMemoryIOHelper() { - } - - void AddRequestContextGetter( - scoped_refptr request_context_getter); - - void PurgeMemoryOnIOThread(); - - private: - friend class base::RefCountedThreadSafe; - - virtual ~PurgeMemoryIOHelper() {} - - typedef scoped_refptr RequestContextGetter; - std::vector request_context_getters_; - - DISALLOW_COPY_AND_ASSIGN(PurgeMemoryIOHelper); -}; - -void PurgeMemoryIOHelper::AddRequestContextGetter( - scoped_refptr request_context_getter) { - request_context_getters_.push_back(request_context_getter); -} - -void PurgeMemoryIOHelper::PurgeMemoryOnIOThread() { - // Ask ProxyServices to purge any memory they can (generally garbage in the - // wrapped ProxyResolver's JS engine). -#pragma message "[M37] Fix memory purge" -#if 0 - for (size_t i = 0; i < request_context_getters_.size(); ++i) { - request_context_getters_[i]->GetURLRequestContext()->proxy_service()-> - PurgeMemory(); - } -#endif -} - -// ----------------------------------------------------------------------------- // static void MemoryPurger::PurgeAll(BrowserContext* browser_context) { @@ -79,24 +21,7 @@ void MemoryPurger::PurgeAll(BrowserContext* browser_context) { // static void MemoryPurger::PurgeBrowser(BrowserContext* browser_context) { - // Dump the backing stores. -#pragma message "[M37] backing stores were removed, so the code below is probably safe to remove, check this." - //content::RenderWidgetHost::RemoveAllBackingStores(); - scoped_refptr purge_memory_io_helper( - new PurgeMemoryIOHelper()); - purge_memory_io_helper->AddRequestContextGetter( - make_scoped_refptr(browser_context->GetRequestContext())); -#pragma message "[M37] Another non existing function" - //BrowserContext::PurgeMemory(browser_context); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&PurgeMemoryIOHelper::PurgeMemoryOnIOThread, - purge_memory_io_helper.get())); // Tell our allocator to release any free pages it's still holding. - // - // TODO(pk): A lot of the above calls kick off actions on other threads. - // Maybe we should find a way to avoid calling this until those actions - // complete? base::allocator::ReleaseFreeMemory(); } -- 2.7.4