| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/task_manager/task_manager_resource_providers.h" | 5 #include "chrome/browser/task_manager/task_manager_resource_providers.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "content/public/browser/child_process_data.h" | 54 #include "content/public/browser/child_process_data.h" |
| 55 #include "content/public/browser/notification_service.h" | 55 #include "content/public/browser/notification_service.h" |
| 56 #include "content/public/browser/render_process_host.h" | 56 #include "content/public/browser/render_process_host.h" |
| 57 #include "content/public/browser/render_view_host.h" | 57 #include "content/public/browser/render_view_host.h" |
| 58 #include "content/public/browser/site_instance.h" | 58 #include "content/public/browser/site_instance.h" |
| 59 #include "content/public/browser/web_contents.h" | 59 #include "content/public/browser/web_contents.h" |
| 60 #include "content/public/common/process_type.h" | 60 #include "content/public/common/process_type.h" |
| 61 #include "extensions/common/constants.h" | 61 #include "extensions/common/constants.h" |
| 62 #include "grit/generated_resources.h" | 62 #include "grit/generated_resources.h" |
| 63 #include "grit/theme_resources.h" | 63 #include "grit/theme_resources.h" |
| 64 #include "net/proxy/proxy_resolver_v8.h" |
| 64 #include "third_party/sqlite/sqlite3.h" | 65 #include "third_party/sqlite/sqlite3.h" |
| 65 #include "ui/base/l10n/l10n_util.h" | 66 #include "ui/base/l10n/l10n_util.h" |
| 66 #include "ui/base/resource/resource_bundle.h" | 67 #include "ui/base/resource/resource_bundle.h" |
| 67 #include "ui/gfx/image/image_skia.h" | 68 #include "ui/gfx/image/image_skia.h" |
| 68 #include "v8/include/v8.h" | 69 #include "v8/include/v8.h" |
| 69 | 70 |
| 70 #if defined(OS_MACOSX) | 71 #if defined(OS_MACOSX) |
| 71 #include "ui/gfx/image/image_skia_util_mac.h" | 72 #include "ui/gfx/image/image_skia_util_mac.h" |
| 72 #endif | 73 #endif |
| 73 #if defined(OS_WIN) | 74 #if defined(OS_WIN) |
| (...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 bool TaskManagerBrowserProcessResource::ReportsV8MemoryStats() const { | 1681 bool TaskManagerBrowserProcessResource::ReportsV8MemoryStats() const { |
| 1681 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1682 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 1682 bool using_v8 = !command_line->HasSwitch(switches::kWinHttpProxyResolver); | 1683 bool using_v8 = !command_line->HasSwitch(switches::kWinHttpProxyResolver); |
| 1683 if (using_v8 && command_line->HasSwitch(switches::kSingleProcess)) { | 1684 if (using_v8 && command_line->HasSwitch(switches::kSingleProcess)) { |
| 1684 using_v8 = false; | 1685 using_v8 = false; |
| 1685 } | 1686 } |
| 1686 return using_v8; | 1687 return using_v8; |
| 1687 } | 1688 } |
| 1688 | 1689 |
| 1689 size_t TaskManagerBrowserProcessResource::GetV8MemoryAllocated() const { | 1690 size_t TaskManagerBrowserProcessResource::GetV8MemoryAllocated() const { |
| 1690 v8::HeapStatistics stats; | 1691 return net::ProxyResolverV8::GetTotalHeapSize(); |
| 1691 v8::V8::GetHeapStatistics(&stats); | |
| 1692 return stats.total_heap_size(); | |
| 1693 } | 1692 } |
| 1694 | 1693 |
| 1695 size_t TaskManagerBrowserProcessResource::GetV8MemoryUsed() const { | 1694 size_t TaskManagerBrowserProcessResource::GetV8MemoryUsed() const { |
| 1696 v8::HeapStatistics stats; | 1695 return net::ProxyResolverV8::GetUsedHeapSize(); |
| 1697 v8::V8::GetHeapStatistics(&stats); | |
| 1698 return stats.used_heap_size(); | |
| 1699 } | 1696 } |
| 1700 | 1697 |
| 1701 //////////////////////////////////////////////////////////////////////////////// | 1698 //////////////////////////////////////////////////////////////////////////////// |
| 1702 // TaskManagerBrowserProcessResourceProvider class | 1699 // TaskManagerBrowserProcessResourceProvider class |
| 1703 //////////////////////////////////////////////////////////////////////////////// | 1700 //////////////////////////////////////////////////////////////////////////////// |
| 1704 | 1701 |
| 1705 TaskManagerBrowserProcessResourceProvider:: | 1702 TaskManagerBrowserProcessResourceProvider:: |
| 1706 TaskManagerBrowserProcessResourceProvider(TaskManager* task_manager) | 1703 TaskManagerBrowserProcessResourceProvider(TaskManager* task_manager) |
| 1707 : updating_(false), | 1704 : updating_(false), |
| 1708 task_manager_(task_manager) { | 1705 task_manager_(task_manager) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1898 case content::NOTIFICATION_WEB_CONTENTS_CONNECTED: | 1895 case content::NOTIFICATION_WEB_CONTENTS_CONNECTED: |
| 1899 Add(web_contents->GetRenderViewHost()); | 1896 Add(web_contents->GetRenderViewHost()); |
| 1900 break; | 1897 break; |
| 1901 case content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED: | 1898 case content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED: |
| 1902 Remove(web_contents->GetRenderViewHost()); | 1899 Remove(web_contents->GetRenderViewHost()); |
| 1903 break; | 1900 break; |
| 1904 default: | 1901 default: |
| 1905 NOTREACHED() << "Unexpected notification."; | 1902 NOTREACHED() << "Unexpected notification."; |
| 1906 } | 1903 } |
| 1907 } | 1904 } |
| OLD | NEW |