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 |
(...skipping 30 matching lines...) Expand all Loading... | |
41 #include "ui/base/layout.h" | 41 #include "ui/base/layout.h" |
42 #include "webkit/glue/webkit_glue.h" | 42 #include "webkit/glue/webkit_glue.h" |
43 #include "webkit/glue/websocketstreamhandle_impl.h" | 43 #include "webkit/glue/websocketstreamhandle_impl.h" |
44 #include "webkit/glue/webthread_impl.h" | 44 #include "webkit/glue/webthread_impl.h" |
45 #include "webkit/glue/weburlloader_impl.h" | 45 #include "webkit/glue/weburlloader_impl.h" |
46 #include "webkit/glue/worker_task_runner.h" | 46 #include "webkit/glue/worker_task_runner.h" |
47 #include "webkit/media/audio_decoder.h" | 47 #include "webkit/media/audio_decoder.h" |
48 #include "webkit/plugins/npapi/plugin_instance.h" | 48 #include "webkit/plugins/npapi/plugin_instance.h" |
49 #include "webkit/plugins/webplugininfo.h" | 49 #include "webkit/plugins/webplugininfo.h" |
50 | 50 |
51 #if defined(USE_TCMALLOC) | |
52 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" | |
53 #endif | |
54 | |
51 #if defined(OS_LINUX) | 55 #if defined(OS_LINUX) |
52 #include "v8/include/v8.h" | 56 #include "v8/include/v8.h" |
53 #endif | 57 #endif |
54 | 58 |
55 using WebKit::WebAudioBus; | 59 using WebKit::WebAudioBus; |
56 using WebKit::WebCookie; | 60 using WebKit::WebCookie; |
57 using WebKit::WebData; | 61 using WebKit::WebData; |
58 using WebKit::WebLocalizedString; | 62 using WebKit::WebLocalizedString; |
59 using WebKit::WebPluginListBuilder; | 63 using WebKit::WebPluginListBuilder; |
60 using WebKit::WebString; | 64 using WebKit::WebString; |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
751 return base::SysInfo::DalvikHeapSizeMB() / 8; | 755 return base::SysInfo::DalvikHeapSizeMB() / 8; |
752 } | 756 } |
753 #endif | 757 #endif |
754 | 758 |
755 bool WebKitPlatformSupportImpl::processMemorySizesInBytes( | 759 bool WebKitPlatformSupportImpl::processMemorySizesInBytes( |
756 size_t* private_bytes, | 760 size_t* private_bytes, |
757 size_t* shared_bytes) { | 761 size_t* shared_bytes) { |
758 return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes); | 762 return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes); |
759 } | 763 } |
760 | 764 |
765 bool WebKitPlatformSupportImpl::memoryAllocatorWasteInBytes(size_t* psize) { | |
darin (slow to review)
2012/08/07 22:06:14
nit: avoid Hungarian notation... psize -> size
alexeif
2012/08/08 17:18:36
Done.
| |
766 #if defined(USE_TCMALLOC) | |
jamesr
2012/08/07 22:15:59
having defined(USE_TCMALLOC) set does not mean tha
alexeif
2012/08/08 17:18:36
done it in a separate CL https://chromiumcoderevie
| |
767 MallocExtension* malloc_ext = MallocExtension::instance(); | |
darin (slow to review)
2012/08/07 22:06:14
nit: indentation
alexeif
2012/08/08 17:18:36
Done.
| |
768 DCHECK(malloc_ext); | |
769 std::vector<MallocExtension::FreeListInfo> free_list_info; | |
770 malloc_ext->GetFreeListSizes(&free_list_info); | |
771 size_t size = 0; | |
772 std::vector<MallocExtension::FreeListInfo>::iterator it; | |
773 for (it = free_list_info.begin(); it != free_list_info.end(); ++it) { | |
774 #ifdef NDEBUG | |
775 if (it->total_bytes_free == 0) | |
776 continue; | |
777 #endif | |
778 if (strcmp(it->type, "tcmalloc.central") == 0 || | |
779 strcmp(it->type, "tcmalloc.transfer") == 0 || | |
780 strcmp(it->type, "tcmalloc.thread") == 0 || | |
781 strcmp(it->type, "tcmalloc.large") == 0 || | |
782 strcmp(it->type, "tcmalloc.page") == 0) { | |
783 size += it->total_bytes_free; | |
784 continue; | |
785 } | |
786 DCHECK(strcmp(it->type, "tcmalloc.large_unmapped") == 0 || | |
787 strcmp(it->type, "tcmalloc.page_unmapped") == 0); | |
788 } | |
789 *psize = size; | |
790 return true; | |
791 #else | |
792 return false; | |
793 #endif | |
794 } | |
795 | |
761 void WebKitPlatformSupportImpl::SuspendSharedTimer() { | 796 void WebKitPlatformSupportImpl::SuspendSharedTimer() { |
762 ++shared_timer_suspended_; | 797 ++shared_timer_suspended_; |
763 } | 798 } |
764 | 799 |
765 void WebKitPlatformSupportImpl::ResumeSharedTimer() { | 800 void WebKitPlatformSupportImpl::ResumeSharedTimer() { |
766 // The shared timer may have fired or been adjusted while we were suspended. | 801 // The shared timer may have fired or been adjusted while we were suspended. |
767 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) { | 802 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) { |
768 setSharedTimerFireInterval( | 803 setSharedTimerFireInterval( |
769 shared_timer_fire_time_ - monotonicallyIncreasingTime()); | 804 shared_timer_fire_time_ - monotonicallyIncreasingTime()); |
770 } | 805 } |
(...skipping 12 matching lines...) Expand all Loading... | |
783 worker_task_runner->OnWorkerRunLoopStarted(runLoop); | 818 worker_task_runner->OnWorkerRunLoopStarted(runLoop); |
784 } | 819 } |
785 | 820 |
786 void WebKitPlatformSupportImpl::didStopWorkerRunLoop( | 821 void WebKitPlatformSupportImpl::didStopWorkerRunLoop( |
787 const WebKit::WebWorkerRunLoop& runLoop) { | 822 const WebKit::WebWorkerRunLoop& runLoop) { |
788 WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance(); | 823 WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance(); |
789 worker_task_runner->OnWorkerRunLoopStopped(runLoop); | 824 worker_task_runner->OnWorkerRunLoopStopped(runLoop); |
790 } | 825 } |
791 | 826 |
792 } // namespace webkit_glue | 827 } // namespace webkit_glue |
OLD | NEW |