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

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

Issue 20003004: reland crrev.com/212927 Move webkitplatformsupport_impl and related from glue to child (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & allocator dep for components_unittests in shared_library2 Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webkit_glue.h ('k') | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/webkit_glue.h" 5 #include "webkit/glue/webkit_glue.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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 WebCanvas* ToWebCanvas(skia::PlatformCanvas* canvas) { 82 WebCanvas* ToWebCanvas(skia::PlatformCanvas* canvas) {
83 return canvas; 83 return canvas;
84 } 84 }
85 85
86 int GetGlyphPageCount() { 86 int GetGlyphPageCount() {
87 return WebGlyphCache::pageCount(); 87 return WebGlyphCache::pageCount();
88 } 88 }
89 89
90 COMPILE_ASSERT(std::numeric_limits<double>::has_quiet_NaN, has_quiet_NaN); 90 COMPILE_ASSERT(std::numeric_limits<double>::has_quiet_NaN, has_quiet_NaN);
91 91
92 #if defined(OS_LINUX) || defined(OS_ANDROID)
93 size_t MemoryUsageKB() {
94 struct mallinfo minfo = mallinfo();
95 uint64_t mem_usage =
96 #if defined(USE_TCMALLOC)
97 minfo.uordblks
98 #else
99 (minfo.hblkhd + minfo.arena)
100 #endif
101 >> 10;
102
103 v8::HeapStatistics stat;
104 // TODO(svenpanne) The call below doesn't take web workers into account, this
105 // has to be done manually by iterating over all Isolates involved.
106 v8::Isolate::GetCurrent()->GetHeapStatistics(&stat);
107 return mem_usage + (static_cast<uint64_t>(stat.total_heap_size()) >> 10);
108 }
109 #elif defined(OS_MACOSX)
110 size_t MemoryUsageKB() {
111 scoped_ptr<base::ProcessMetrics> process_metrics(
112 // The default port provider is sufficient to get data for the current
113 // process.
114 base::ProcessMetrics::CreateProcessMetrics(
115 base::GetCurrentProcessHandle(), NULL));
116 return process_metrics->GetWorkingSetSize() >> 10;
117 }
118 #else
119 size_t MemoryUsageKB() {
120 scoped_ptr<base::ProcessMetrics> process_metrics(
121 base::ProcessMetrics::CreateProcessMetrics(
122 base::GetCurrentProcessHandle()));
123 return process_metrics->GetPagefileUsage() >> 10;
124 }
125 #endif
126
127 } // namespace webkit_glue 92 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/webkit_glue.h ('k') | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698