diff options
-rw-r--r-- | chrome/app/generated_resources.grd | 3 | ||||
-rw-r--r-- | chrome/browser/task_manager.cc | 6 | ||||
-rw-r--r-- | chrome/browser/task_manager.h | 4 | ||||
-rw-r--r-- | chrome/browser/task_manager_resource_providers.cc | 5 | ||||
-rw-r--r-- | chrome/browser/task_manager_resource_providers.h | 3 | ||||
-rw-r--r-- | chrome/browser/views/task_manager_view.cc | 10 |
6 files changed, 31 insertions, 0 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 46a2228..fe93f2e 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -2478,6 +2478,9 @@ each locale. --> <message name="IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN" desc="Task manager WebCore CSS cache size column."> CSS cache </message> + <message name="IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN" desc="Amount of memory used by SQLite."> + SQLite memory + </message> <message name="IDS_TASK_MANAGER_MEM_CELL_TEXT" desc="The value displayed in the memory usage cells."> <ph name="NUM_KILOBYTES">$1<ex>5,000</ex></ph>K </message> diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc index d74fa79..daf1f30 100644 --- a/chrome/browser/task_manager.cc +++ b/chrome/browser/task_manager.cc @@ -199,6 +199,12 @@ std::wstring TaskManagerModel::GetResourceWebCoreCSSCacheSize( return FormatStatsSize(stats.cssStyleSheets); } +std::wstring TaskManagerModel::GetResourceSqliteMemoryUsed(int index) const { + DCHECK(index < ResourceCount()); + if (!resources_[index]->ReportsSqliteMemoryUsed()) + return l10n_util::GetString(IDS_TASK_MANAGER_NA_CELL_TEXT); + return GetMemCellText(resources_[index]->SqliteMemoryUsedBytes() / 1024); +} bool TaskManagerModel::IsResourceFirstInGroup(int index) const { DCHECK(index < ResourceCount()); diff --git a/chrome/browser/task_manager.h b/chrome/browser/task_manager.h index 0bba99e..a667a78 100644 --- a/chrome/browser/task_manager.h +++ b/chrome/browser/task_manager.h @@ -52,6 +52,9 @@ class TaskManager { return WebKit::WebCache::ResourceTypeStats(); } + virtual bool ReportsSqliteMemoryUsed() const { return false; } + virtual size_t SqliteMemoryUsedBytes() const { return 0; } + // A helper function for ActivateFocusedTab. Returns NULL by default // because not all resources have an assoiciated tab. virtual TabContents* GetTabContents() const { return NULL; } @@ -191,6 +194,7 @@ class TaskManagerModel : public URLRequestJobTracker::JobObserver, std::wstring GetResourceWebCoreImageCacheSize(int index) const; std::wstring GetResourceWebCoreScriptsCacheSize(int index) const; std::wstring GetResourceWebCoreCSSCacheSize(int index) const; + std::wstring GetResourceSqliteMemoryUsed(int index) const; std::wstring GetResourceGoatsTeleported(int index) const; // Returns true if the resource is first in its group (resources diff --git a/chrome/browser/task_manager_resource_providers.cc b/chrome/browser/task_manager_resource_providers.cc index 62af8fa..931d325 100644 --- a/chrome/browser/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager_resource_providers.cc @@ -36,6 +36,7 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" +#include "chrome/common/sqlite_utils.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -701,6 +702,10 @@ SkBitmap TaskManagerBrowserProcessResource::GetIcon() const { return *default_icon_; } +size_t TaskManagerBrowserProcessResource::SqliteMemoryUsedBytes() const { + return static_cast<size_t>(sqlite3_memory_used()); +} + base::ProcessHandle TaskManagerBrowserProcessResource::GetProcess() const { return base::GetCurrentProcessHandle(); // process_; } diff --git a/chrome/browser/task_manager_resource_providers.h b/chrome/browser/task_manager_resource_providers.h index 39613fd..df84472 100644 --- a/chrome/browser/task_manager_resource_providers.h +++ b/chrome/browser/task_manager_resource_providers.h @@ -273,6 +273,9 @@ class TaskManagerBrowserProcessResource : public TaskManager::Resource { bool SupportNetworkUsage() const { return true; } void SetSupportNetworkUsage() { NOTREACHED(); } + bool ReportsSqliteMemoryUsed() const { return true; } + size_t SqliteMemoryUsedBytes() const; + // Returns the pid of the browser process. int process_id() const { return pid_; } diff --git a/chrome/browser/views/task_manager_view.cc b/chrome/browser/views/task_manager_view.cc index 36a477b..47bb74c 100644 --- a/chrome/browser/views/task_manager_view.cc +++ b/chrome/browser/views/task_manager_view.cc @@ -128,6 +128,11 @@ std::wstring TaskManagerTableModel::GetText(int row, int col_id) { return std::wstring(); return model_->GetResourceWebCoreCSSCacheSize(row); + case IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN: + if (!model_->IsResourceFirstInGroup(row)) + return std::wstring(); + return model_->GetResourceSqliteMemoryUsed(row); + default: return model_->GetResourceStatsValue(row, col_id); } @@ -322,6 +327,9 @@ void TaskManagerView::Init() { columns_.push_back(TableColumn(IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN, TableColumn::RIGHT, -1, 0)); columns_.back().sortable = true; + columns_.push_back(TableColumn(IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN, + TableColumn::RIGHT, -1, 0)); + columns_.back().sortable = true; tab_table_ = new views::GroupTableView(table_model_.get(), columns_, views::ICON_AND_TEXT, false, true, @@ -337,6 +345,8 @@ void TaskManagerView::Init() { false); tab_table_->SetColumnVisibility(IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN, false); + tab_table_->SetColumnVisibility(IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN, + false); tab_table_->SetColumnVisibility(IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN, false); |