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

Unified Diff: content/child/blink_platform_impl.cc

Issue 1671383003: [Onion Soup] Remove dead memory usage code in BlinkPlatformImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | third_party/WebKit/public/platform/Platform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/blink_platform_impl.cc
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc
index 4bb755a2ae1e580e13b9044d648765ae4c364a3f..3617d94ca24ee7df8192a05b7f0ad18658ede941 100644
--- a/content/child/blink_platform_impl.cc
+++ b/content/child/blink_platform_impl.cc
@@ -109,54 +109,6 @@ class WebWaitableEventImpl : public blink::WebWaitableEvent {
DISALLOW_COPY_AND_ASSIGN(WebWaitableEventImpl);
};
-// A simple class to cache the memory usage for a given amount of time.
-class MemoryUsageCache {
- public:
- // Retrieves the Singleton.
- static MemoryUsageCache* GetInstance() {
- return base::Singleton<MemoryUsageCache>::get();
- }
-
- MemoryUsageCache() : memory_value_(0) { Init(); }
- ~MemoryUsageCache() {}
-
- void Init() {
- const unsigned int kCacheSeconds = 1;
- cache_valid_time_ = base::TimeDelta::FromSeconds(kCacheSeconds);
- }
-
- // Returns true if the cached value is fresh.
- // Returns false if the cached value is stale, or if |cached_value| is NULL.
- bool IsCachedValueValid(size_t* cached_value) {
- base::AutoLock scoped_lock(lock_);
- if (!cached_value)
- return false;
- if (base::Time::Now() - last_updated_time_ > cache_valid_time_)
- return false;
- *cached_value = memory_value_;
- return true;
- };
-
- // Setter for |memory_value_|, refreshes |last_updated_time_|.
- void SetMemoryValue(const size_t value) {
- base::AutoLock scoped_lock(lock_);
- memory_value_ = value;
- last_updated_time_ = base::Time::Now();
- }
-
- private:
- // The cached memory value.
- size_t memory_value_;
-
- // How long the cached value should remain valid.
- base::TimeDelta cache_valid_time_;
-
- // The last time the cached value was updated.
- base::Time last_updated_time_;
-
- base::Lock lock_;
-};
-
} // namespace
static int ToMessageID(WebLocalizedString::Name name) {
@@ -1105,32 +1057,8 @@ blink::WebString BlinkPlatformImpl::signedPublicKeyAndChallengeString(
return blink::WebString("");
}
-static size_t getMemoryUsageMB(bool bypass_cache) {
- size_t current_mem_usage = 0;
- MemoryUsageCache* mem_usage_cache_singleton = MemoryUsageCache::GetInstance();
- if (!bypass_cache &&
- mem_usage_cache_singleton->IsCachedValueValid(&current_mem_usage))
- return current_mem_usage;
-
- current_mem_usage = GetMemoryUsageKB() >> 10;
- mem_usage_cache_singleton->SetMemoryValue(current_mem_usage);
- return current_mem_usage;
-}
-
-size_t BlinkPlatformImpl::memoryUsageMB() {
- return getMemoryUsageMB(false);
-}
-
size_t BlinkPlatformImpl::actualMemoryUsageMB() {
- return getMemoryUsageMB(true);
-}
-
-size_t BlinkPlatformImpl::physicalMemoryMB() {
- return static_cast<size_t>(base::SysInfo::AmountOfPhysicalMemoryMB());
-}
-
-size_t BlinkPlatformImpl::virtualMemoryLimitMB() {
- return static_cast<size_t>(base::SysInfo::AmountOfVirtualMemoryMB());
+ return GetMemoryUsageKB() >> 10;
}
size_t BlinkPlatformImpl::numberOfProcessors() {
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | third_party/WebKit/public/platform/Platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698