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) | |
322 ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle()); | 321 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 | |
329 DCHECK(process_metrics); | 322 DCHECK(process_metrics); |
330 return process_metrics->GetPagefileUsage() >> 20; | 323 return process_metrics->GetPagefileUsage() >> 20; |
331 } | 324 } |
332 | 325 |
333 bool WebKitClientImpl::fileExists(const WebKit::WebString& path) { | 326 bool WebKitClientImpl::fileExists(const WebKit::WebString& path) { |
334 FilePath::StringType file_path = webkit_glue::WebStringToFilePathString(path); | 327 FilePath::StringType file_path = webkit_glue::WebStringToFilePathString(path); |
335 return file_util::PathExists(FilePath(file_path)); | 328 return file_util::PathExists(FilePath(file_path)); |
336 } | 329 } |
337 | 330 |
338 bool WebKitClientImpl::deleteFile(const WebKit::WebString& path) { | 331 bool WebKitClientImpl::deleteFile(const WebKit::WebString& path) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 bool WebKitClientImpl::isDirectory(const WebKit::WebString& path) { | 381 bool WebKitClientImpl::isDirectory(const WebKit::WebString& path) { |
389 FilePath file_path(webkit_glue::WebStringToFilePathString(path)); | 382 FilePath file_path(webkit_glue::WebStringToFilePathString(path)); |
390 return file_util::DirectoryExists(file_path); | 383 return file_util::DirectoryExists(file_path); |
391 } | 384 } |
392 | 385 |
393 WebKit::WebURL WebKitClientImpl::filePathToURL(const WebKit::WebString& path) { | 386 WebKit::WebURL WebKitClientImpl::filePathToURL(const WebKit::WebString& path) { |
394 return net::FilePathToFileURL(webkit_glue::WebStringToFilePath(path)); | 387 return net::FilePathToFileURL(webkit_glue::WebStringToFilePath(path)); |
395 } | 388 } |
396 | 389 |
397 } // namespace webkit_glue | 390 } // namespace webkit_glue |
OLD | NEW |