Remove warnings from MemoryPurger
authorLeszek Syroka <l.syroka@partner.samsung.com>
Thu, 21 Jan 2016 15:00:01 +0000 (16:00 +0100)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 07:55:23 +0000 (07:55 +0000)
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 <l.syroka@partner.samsung.com>
(cherry picked from commit f776a5291d3af1bea61497155cb3724cf0ef3aa9)

tizen_src/ewk/efl_integration/memory_purger.cc

index 1f79b4d..fafd3e3 100644 (file)
@@ -5,68 +5,10 @@
 
 #include "memory_purger.h"
 
-#include <set>
-
 #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<PurgeMemoryIOHelper> {
- public:
-  PurgeMemoryIOHelper() {
-  }
-
-  void AddRequestContextGetter(
-      scoped_refptr<net::URLRequestContextGetter> request_context_getter);
-
-  void PurgeMemoryOnIOThread();
-
- private:
-  friend class base::RefCountedThreadSafe<PurgeMemoryIOHelper>;
-
-  virtual ~PurgeMemoryIOHelper() {}
-
-  typedef scoped_refptr<net::URLRequestContextGetter> RequestContextGetter;
-  std::vector<RequestContextGetter> request_context_getters_;
-
-  DISALLOW_COPY_AND_ASSIGN(PurgeMemoryIOHelper);
-};
-
-void PurgeMemoryIOHelper::AddRequestContextGetter(
-    scoped_refptr<net::URLRequestContextGetter> 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<PurgeMemoryIOHelper> 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();
 }