| 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 #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <map> | 10 #include <map> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 12 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
| 13 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
| 16 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 17 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 // Updates the values for all rows. | 289 // Updates the values for all rows. |
| 288 void Refresh(); | 290 void Refresh(); |
| 289 | 291 |
| 290 // Do a bulk repopulation of the physical_memory data on platforms where that | 292 // Do a bulk repopulation of the physical_memory data on platforms where that |
| 291 // is faster. | 293 // is faster. |
| 292 void RefreshPhysicalMemoryFromWorkingSetSnapshot(); | 294 void RefreshPhysicalMemoryFromWorkingSetSnapshot(); |
| 293 | 295 |
| 294 void NotifyVideoMemoryUsageStats( | 296 void NotifyVideoMemoryUsageStats( |
| 295 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats); | 297 const content::GPUVideoMemoryUsageStats& video_memory_usage_stats); |
| 296 | 298 |
| 297 void NotifyBytesRead(const net::URLRequest& request, int bytes_read); | 299 void NotifyBytesRead(const net::URLRequest& request, int64_t bytes_read); |
| 298 | 300 |
| 299 void RegisterOnDataReadyCallback(const base::Closure& callback); | 301 void RegisterOnDataReadyCallback(const base::Closure& callback); |
| 300 | 302 |
| 301 void NotifyDataReady(); | 303 void NotifyDataReady(); |
| 302 | 304 |
| 303 private: | 305 private: |
| 304 friend class base::RefCountedThreadSafe<TaskManagerModel>; | 306 friend class base::RefCountedThreadSafe<TaskManagerModel>; |
| 305 friend class TaskManagerBrowserTest; | 307 friend class TaskManagerBrowserTest; |
| 306 FRIEND_TEST_ALL_PREFIXES(ExtensionApiTest, ProcessesVsTaskManager); | 308 FRIEND_TEST_ALL_PREFIXES(ExtensionApiTest, ProcessesVsTaskManager); |
| 307 FRIEND_TEST_ALL_PREFIXES(TaskManagerTest, RefreshCalled); | 309 FRIEND_TEST_ALL_PREFIXES(TaskManagerTest, RefreshCalled); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 typedef std::map<task_manager::Resource*, int64> ResourceValueMap; | 396 typedef std::map<task_manager::Resource*, int64> ResourceValueMap; |
| 395 typedef std::map<task_manager::Resource*, | 397 typedef std::map<task_manager::Resource*, |
| 396 PerResourceValues> PerResourceCache; | 398 PerResourceValues> PerResourceCache; |
| 397 typedef std::map<base::ProcessHandle, PerProcessValues> PerProcessCache; | 399 typedef std::map<base::ProcessHandle, PerProcessValues> PerProcessCache; |
| 398 | 400 |
| 399 // This struct is used to exchange information between the io and ui threads. | 401 // This struct is used to exchange information between the io and ui threads. |
| 400 struct BytesReadParam { | 402 struct BytesReadParam { |
| 401 BytesReadParam(int origin_pid, | 403 BytesReadParam(int origin_pid, |
| 402 int child_id, | 404 int child_id, |
| 403 int route_id, | 405 int route_id, |
| 404 int byte_count) | 406 int64_t byte_count) |
| 405 : origin_pid(origin_pid), | 407 : origin_pid(origin_pid), |
| 406 child_id(child_id), | 408 child_id(child_id), |
| 407 route_id(route_id), | 409 route_id(route_id), |
| 408 byte_count(byte_count) {} | 410 byte_count(byte_count) {} |
| 409 | 411 |
| 410 // The process ID that triggered the request. For plugin requests this | 412 // The process ID that triggered the request. For plugin requests this |
| 411 // will differ from the renderer process ID. | 413 // will differ from the renderer process ID. |
| 412 int origin_pid; | 414 int origin_pid; |
| 413 | 415 |
| 414 // The child ID of the process this request was routed through. | 416 // The child ID of the process this request was routed through. |
| 415 int child_id; | 417 int child_id; |
| 416 | 418 |
| 417 int route_id; | 419 int route_id; |
| 418 int byte_count; | 420 int64_t byte_count; |
| 419 }; | 421 }; |
| 420 | 422 |
| 421 ~TaskManagerModel(); | 423 ~TaskManagerModel(); |
| 422 | 424 |
| 423 // Callback from the timer to refresh. Invokes Refresh() as appropriate. | 425 // Callback from the timer to refresh. Invokes Refresh() as appropriate. |
| 424 void RefreshCallback(); | 426 void RefreshCallback(); |
| 425 | 427 |
| 426 void RefreshVideoMemoryUsageStats(); | 428 void RefreshVideoMemoryUsageStats(); |
| 427 | 429 |
| 428 // Returns the network usage (in bytes per seconds) for the specified | 430 // Returns the network usage (in bytes per seconds) for the specified |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 // All per-Resource values are stored here. | 545 // All per-Resource values are stored here. |
| 544 mutable PerResourceCache per_resource_cache_; | 546 mutable PerResourceCache per_resource_cache_; |
| 545 | 547 |
| 546 // All per-Process values are stored here. | 548 // All per-Process values are stored here. |
| 547 mutable PerProcessCache per_process_cache_; | 549 mutable PerProcessCache per_process_cache_; |
| 548 | 550 |
| 549 DISALLOW_COPY_AND_ASSIGN(TaskManagerModel); | 551 DISALLOW_COPY_AND_ASSIGN(TaskManagerModel); |
| 550 }; | 552 }; |
| 551 | 553 |
| 552 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ | 554 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ |
| OLD | NEW |