OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/webkitplatformsupport_impl.h" | 5 #include "webkit/glue/webkitplatformsupport_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 |
11 #include <math.h> | 11 #include <math.h> |
12 | 12 |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/allocator/allocator_extension.h" | |
15 #include "base/bind.h" | 16 #include "base/bind.h" |
16 #include "base/debug/trace_event.h" | 17 #include "base/debug/trace_event.h" |
17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
18 #include "base/memory/singleton.h" | 19 #include "base/memory/singleton.h" |
19 #include "base/message_loop.h" | 20 #include "base/message_loop.h" |
20 #include "base/metrics/histogram.h" | 21 #include "base/metrics/histogram.h" |
21 #include "base/metrics/stats_counters.h" | 22 #include "base/metrics/stats_counters.h" |
22 #include "base/platform_file.h" | 23 #include "base/platform_file.h" |
23 #include "base/process_util.h" | 24 #include "base/process_util.h" |
24 #include "base/rand_util.h" | 25 #include "base/rand_util.h" |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
789 return base::SysInfo::DalvikHeapSizeMB() / 8; | 790 return base::SysInfo::DalvikHeapSizeMB() / 8; |
790 } | 791 } |
791 #endif | 792 #endif |
792 | 793 |
793 bool WebKitPlatformSupportImpl::processMemorySizesInBytes( | 794 bool WebKitPlatformSupportImpl::processMemorySizesInBytes( |
794 size_t* private_bytes, | 795 size_t* private_bytes, |
795 size_t* shared_bytes) { | 796 size_t* shared_bytes) { |
796 return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes); | 797 return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes); |
797 } | 798 } |
798 | 799 |
800 bool WebKitPlatformSupportImpl::memoryAllocatorInternalsInBytes(size_t* size) { | |
801 size_t heap_size, allocated_bytes, unmapped_bytes; | |
802 if (base::allocator::GetProperty("generic.heap_size", &heap_size) && | |
darin (slow to review)
2012/10/18 18:02:54
nit: Shouldn't there be some named constants for t
alph-g
2012/10/22 12:19:41
Hmm, I don't see any significant benefits of a gen
| |
803 base::allocator::GetProperty("generic.current_allocated_bytes", | |
804 &allocated_bytes) && | |
805 base::allocator::GetProperty("tcmalloc.pageheap_unmapped_bytes", | |
806 &unmapped_bytes)) { | |
807 *size = heap_size - allocated_bytes - unmapped_bytes; | |
808 return true; | |
809 } | |
810 return false; | |
811 } | |
812 | |
799 void WebKitPlatformSupportImpl::SuspendSharedTimer() { | 813 void WebKitPlatformSupportImpl::SuspendSharedTimer() { |
800 ++shared_timer_suspended_; | 814 ++shared_timer_suspended_; |
801 } | 815 } |
802 | 816 |
803 void WebKitPlatformSupportImpl::ResumeSharedTimer() { | 817 void WebKitPlatformSupportImpl::ResumeSharedTimer() { |
804 // The shared timer may have fired or been adjusted while we were suspended. | 818 // The shared timer may have fired or been adjusted while we were suspended. |
805 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) { | 819 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) { |
806 setSharedTimerFireInterval( | 820 setSharedTimerFireInterval( |
807 shared_timer_fire_time_ - monotonicallyIncreasingTime()); | 821 shared_timer_fire_time_ - monotonicallyIncreasingTime()); |
808 } | 822 } |
(...skipping 18 matching lines...) Expand all Loading... | |
827 worker_task_runner->OnWorkerRunLoopStopped(runLoop); | 841 worker_task_runner->OnWorkerRunLoopStopped(runLoop); |
828 } | 842 } |
829 | 843 |
830 #if defined(OS_ANDROID) | 844 #if defined(OS_ANDROID) |
831 WebKit::WebFlingAnimator* WebKitPlatformSupportImpl::createFlingAnimator() { | 845 WebKit::WebFlingAnimator* WebKitPlatformSupportImpl::createFlingAnimator() { |
832 return new FlingAnimatorImpl(); | 846 return new FlingAnimatorImpl(); |
833 } | 847 } |
834 #endif | 848 #endif |
835 | 849 |
836 } // namespace webkit_glue | 850 } // namespace webkit_glue |
OLD | NEW |