OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |