OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/extensions/api/processes/processes_api.h" | 5 #include "chrome/browser/extensions/api/processes/processes_api.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 namespace extensions { | 39 namespace extensions { |
40 | 40 |
41 namespace keys = processes_api_constants; | 41 namespace keys = processes_api_constants; |
42 namespace errors = processes_api_constants; | 42 namespace errors = processes_api_constants; |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 #if defined(ENABLE_TASK_MANAGER) | 46 #if defined(ENABLE_TASK_MANAGER) |
47 | 47 |
48 base::DictionaryValue* CreateCacheData( | 48 base::DictionaryValue* CreateCacheData( |
49 const WebKit::WebCache::ResourceTypeStat& stat) { | 49 const blink::WebCache::ResourceTypeStat& stat) { |
50 | 50 |
51 base::DictionaryValue* cache = new base::DictionaryValue(); | 51 base::DictionaryValue* cache = new base::DictionaryValue(); |
52 cache->SetDouble(keys::kCacheSize, static_cast<double>(stat.size)); | 52 cache->SetDouble(keys::kCacheSize, static_cast<double>(stat.size)); |
53 cache->SetDouble(keys::kCacheLiveSize, static_cast<double>(stat.liveSize)); | 53 cache->SetDouble(keys::kCacheLiveSize, static_cast<double>(stat.liveSize)); |
54 return cache; | 54 return cache; |
55 } | 55 } |
56 | 56 |
57 void SetProcessType(base::DictionaryValue* result, | 57 void SetProcessType(base::DictionaryValue* result, |
58 TaskManagerModel* model, | 58 TaskManagerModel* model, |
59 int index) { | 59 int index) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 static_cast<double>(mem)); | 162 static_cast<double>(mem)); |
163 | 163 |
164 if (model->GetV8MemoryUsed(index, &mem)) | 164 if (model->GetV8MemoryUsed(index, &mem)) |
165 result->SetDouble(keys::kJsMemoryUsedKey, | 165 result->SetDouble(keys::kJsMemoryUsedKey, |
166 static_cast<double>(mem)); | 166 static_cast<double>(mem)); |
167 | 167 |
168 if (model->GetSqliteMemoryUsedBytes(index, &mem)) | 168 if (model->GetSqliteMemoryUsedBytes(index, &mem)) |
169 result->SetDouble(keys::kSqliteMemoryKey, | 169 result->SetDouble(keys::kSqliteMemoryKey, |
170 static_cast<double>(mem)); | 170 static_cast<double>(mem)); |
171 | 171 |
172 WebKit::WebCache::ResourceTypeStats cache_stats; | 172 blink::WebCache::ResourceTypeStats cache_stats; |
173 if (model->GetWebCoreCacheStats(index, &cache_stats)) { | 173 if (model->GetWebCoreCacheStats(index, &cache_stats)) { |
174 result->Set(keys::kImageCacheKey, | 174 result->Set(keys::kImageCacheKey, |
175 CreateCacheData(cache_stats.images)); | 175 CreateCacheData(cache_stats.images)); |
176 result->Set(keys::kScriptCacheKey, | 176 result->Set(keys::kScriptCacheKey, |
177 CreateCacheData(cache_stats.scripts)); | 177 CreateCacheData(cache_stats.scripts)); |
178 result->Set(keys::kCssCacheKey, | 178 result->Set(keys::kCssCacheKey, |
179 CreateCacheData(cache_stats.cssStyleSheets)); | 179 CreateCacheData(cache_stats.cssStyleSheets)); |
180 } | 180 } |
181 | 181 |
182 // Network and FPS are reported by the TaskManager per resource (tab), not | 182 // Network and FPS are reported by the TaskManager per resource (tab), not |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 | 758 |
759 SetResult(processes); | 759 SetResult(processes); |
760 SendResponse(true); | 760 SendResponse(true); |
761 | 761 |
762 // Balance the AddRef in the RunImpl. | 762 // Balance the AddRef in the RunImpl. |
763 Release(); | 763 Release(); |
764 #endif // defined(ENABLE_TASK_MANAGER) | 764 #endif // defined(ENABLE_TASK_MANAGER) |
765 } | 765 } |
766 | 766 |
767 } // namespace extensions | 767 } // namespace extensions |
OLD | NEW |