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

Side by Side Diff: webkit/glue/webkitclient_impl.cc

Issue 5685007: Rename all methods accessing Singleton<T> as GetInstance(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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
« no previous file with comments | « webkit/appcache/appcache_interceptor.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "webkit/glue/webkitclient_impl.h" 5 #include "webkit/glue/webkitclient_impl.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <malloc.h> 8 #include <malloc.h>
9 #endif 9 #endif
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 using WebKit::WebURL; 54 using WebKit::WebURL;
55 using WebKit::WebURLLoader; 55 using WebKit::WebURLLoader;
56 using WebKit::WebVector; 56 using WebKit::WebVector;
57 57
58 namespace { 58 namespace {
59 59
60 // A simple class to cache the memory usage for a given amount of time. 60 // A simple class to cache the memory usage for a given amount of time.
61 class MemoryUsageCache { 61 class MemoryUsageCache {
62 public: 62 public:
63 // Retrieves the Singleton. 63 // Retrieves the Singleton.
64 static MemoryUsageCache* Get() { 64 static MemoryUsageCache* GetInstance() {
65 return Singleton<MemoryUsageCache>::get(); 65 return Singleton<MemoryUsageCache>::get();
66 } 66 }
67 67
68 MemoryUsageCache() : memory_value_(0) { Init(); } 68 MemoryUsageCache() : memory_value_(0) { Init(); }
69 ~MemoryUsageCache() {} 69 ~MemoryUsageCache() {}
70 70
71 void Init() { 71 void Init() {
72 const unsigned int kCacheSeconds = 1; 72 const unsigned int kCacheSeconds = 1;
73 cache_valid_time_ = base::TimeDelta::FromSeconds(kCacheSeconds); 73 cache_valid_time_ = base::TimeDelta::FromSeconds(kCacheSeconds);
74 } 74 }
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 using base::ProcessMetrics; 492 using base::ProcessMetrics;
493 static ProcessMetrics* process_metrics = 493 static ProcessMetrics* process_metrics =
494 ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle()); 494 ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle());
495 DCHECK(process_metrics); 495 DCHECK(process_metrics);
496 return process_metrics->GetPagefileUsage() >> 20; 496 return process_metrics->GetPagefileUsage() >> 20;
497 } 497 }
498 #endif 498 #endif
499 499
500 static size_t getMemoryUsageMB(bool bypass_cache) { 500 static size_t getMemoryUsageMB(bool bypass_cache) {
501 size_t current_mem_usage = 0; 501 size_t current_mem_usage = 0;
502 MemoryUsageCache* mem_usage_cache_singleton = MemoryUsageCache::Get(); 502 MemoryUsageCache* mem_usage_cache_singleton = MemoryUsageCache::GetInstance();
503 if (!bypass_cache && 503 if (!bypass_cache &&
504 mem_usage_cache_singleton->IsCachedValueValid(&current_mem_usage)) 504 mem_usage_cache_singleton->IsCachedValueValid(&current_mem_usage))
505 return current_mem_usage; 505 return current_mem_usage;
506 506
507 current_mem_usage = 507 current_mem_usage =
508 #if defined(OS_LINUX) 508 #if defined(OS_LINUX)
509 memoryUsageMBLinux(); 509 memoryUsageMBLinux();
510 #elif defined(OS_MACOSX) 510 #elif defined(OS_MACOSX)
511 memoryUsageMBMac(); 511 memoryUsageMBMac();
512 #else 512 #else
(...skipping 15 matching lines...) Expand all
528 ++shared_timer_suspended_; 528 ++shared_timer_suspended_;
529 } 529 }
530 530
531 void WebKitClientImpl::ResumeSharedTimer() { 531 void WebKitClientImpl::ResumeSharedTimer() {
532 // The shared timer may have fired or been adjusted while we were suspended. 532 // The shared timer may have fired or been adjusted while we were suspended.
533 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) 533 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning())
534 setSharedTimerFireTime(shared_timer_fire_time_); 534 setSharedTimerFireTime(shared_timer_fire_time_);
535 } 535 }
536 536
537 } // namespace webkit_glue 537 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_interceptor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698