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

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

Issue 500118: Fix cpu/memory measurements on OS X. (Closed)
Patch Set: foobar Created 11 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
« base/process_util_mac.mm ('K') | « chrome/test/chrome_process_util.h ('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) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "webkit/glue/webkitclient_impl.h" 5 #include "webkit/glue/webkitclient_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 unsigned key_size_index, 311 unsigned key_size_index,
312 const WebKit::WebString& challenge, 312 const WebKit::WebString& challenge,
313 const WebKit::WebURL& url) { 313 const WebKit::WebURL& url) {
314 NOTREACHED(); 314 NOTREACHED();
315 return WebKit::WebString(); 315 return WebKit::WebString();
316 } 316 }
317 317
318 size_t WebKitClientImpl::memoryUsageMB() { 318 size_t WebKitClientImpl::memoryUsageMB() {
319 using base::ProcessMetrics; 319 using base::ProcessMetrics;
320 static ProcessMetrics* process_metrics = 320 static ProcessMetrics* process_metrics =
321 #if !defined(OS_MACOSX)
321 ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle()); 322 ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle());
323 #else
324 // The default port provider is sufficient to get data for the current
325 // process.
326 ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle(),
327 NULL);
328 #endif
322 DCHECK(process_metrics); 329 DCHECK(process_metrics);
323 return process_metrics->GetPagefileUsage() >> 20; 330 return process_metrics->GetPagefileUsage() >> 20;
324 } 331 }
325 332
326 bool WebKitClientImpl::fileExists(const WebKit::WebString& path) { 333 bool WebKitClientImpl::fileExists(const WebKit::WebString& path) {
327 FilePath::StringType file_path = webkit_glue::WebStringToFilePathString(path); 334 FilePath::StringType file_path = webkit_glue::WebStringToFilePathString(path);
328 return file_util::PathExists(FilePath(file_path)); 335 return file_util::PathExists(FilePath(file_path));
329 } 336 }
330 337
331 bool WebKitClientImpl::deleteFile(const WebKit::WebString& path) { 338 bool WebKitClientImpl::deleteFile(const WebKit::WebString& path) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 bool WebKitClientImpl::isDirectory(const WebKit::WebString& path) { 388 bool WebKitClientImpl::isDirectory(const WebKit::WebString& path) {
382 FilePath file_path(webkit_glue::WebStringToFilePathString(path)); 389 FilePath file_path(webkit_glue::WebStringToFilePathString(path));
383 return file_util::DirectoryExists(file_path); 390 return file_util::DirectoryExists(file_path);
384 } 391 }
385 392
386 WebKit::WebURL WebKitClientImpl::filePathToURL(const WebKit::WebString& path) { 393 WebKit::WebURL WebKitClientImpl::filePathToURL(const WebKit::WebString& path) {
387 return net::FilePathToFileURL(webkit_glue::WebStringToFilePath(path)); 394 return net::FilePathToFileURL(webkit_glue::WebStringToFilePath(path));
388 } 395 }
389 396
390 } // namespace webkit_glue 397 } // namespace webkit_glue
OLDNEW
« base/process_util_mac.mm ('K') | « chrome/test/chrome_process_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698