Chromium Code Reviews| 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 <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 443 void BytesRead(BytesReadParam param); | 443 void BytesRead(BytesReadParam param); |
| 444 | 444 |
| 445 void MultipleBytesRead(const std::vector<BytesReadParam>* params); | 445 void MultipleBytesRead(const std::vector<BytesReadParam>* params); |
| 446 | 446 |
| 447 // Notifies the UI thread about all the bytes read. Allows for coalescing | 447 // Notifies the UI thread about all the bytes read. Allows for coalescing |
| 448 // multiple bytes read into a single task for the UI thread. This is important | 448 // multiple bytes read into a single task for the UI thread. This is important |
| 449 // for when downloading a lot of data on the IO thread, since posting a Task | 449 // for when downloading a lot of data on the IO thread, since posting a Task |
| 450 // for each one is expensive. | 450 // for each one is expensive. |
| 451 void NotifyMultipleBytesRead(); | 451 void NotifyMultipleBytesRead(); |
| 452 | 452 |
| 453 // Called on the IO thread to start/stop updating byte counts. | |
| 454 void StartUpdatingByteCount(); | |
| 455 void StopUpdatingByteCount(); | |
| 456 | |
| 453 // Returns the network usage (in byte per second) that should be displayed for | 457 // Returns the network usage (in byte per second) that should be displayed for |
| 454 // the passed |resource|. -1 means the information is not available for that | 458 // the passed |resource|. -1 means the information is not available for that |
| 455 // resource. | 459 // resource. |
| 456 int64 GetNetworkUsage(task_manager::Resource* resource) const; | 460 int64 GetNetworkUsage(task_manager::Resource* resource) const; |
| 457 | 461 |
| 458 // Returns the CPU usage (in %) that should be displayed for the passed | 462 // Returns the CPU usage (in %) that should be displayed for the passed |
| 459 // |resource|. | 463 // |resource|. |
| 460 double GetCPUUsage(task_manager::Resource* resource) const; | 464 double GetCPUUsage(task_manager::Resource* resource) const; |
| 461 | 465 |
| 462 // Returns the idle wakeups that should be displayed for the passed | 466 // Returns the idle wakeups that should be displayed for the passed |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 526 // StopUpdating. | 530 // StopUpdating. |
| 527 int update_requests_; | 531 int update_requests_; |
| 528 | 532 |
| 529 // How many calls to StartListening have been made without matching calls to | 533 // How many calls to StartListening have been made without matching calls to |
| 530 // StopListening. | 534 // StopListening. |
| 531 int listen_requests_; | 535 int listen_requests_; |
| 532 | 536 |
| 533 // Whether we are currently in the process of updating. | 537 // Whether we are currently in the process of updating. |
| 534 UpdateState update_state_; | 538 UpdateState update_state_; |
| 535 | 539 |
| 540 // Whether the IO thread is currently in the process of updating. | |
| 541 bool is_updating_byte_count_; | |
|
Lei Zhang
2014/09/06 06:17:47
nit: Mention this is only accessed on the IO threa
tonyg
2014/09/08 18:59:38
Done.
| |
| 542 | |
| 536 // A salt lick for the goats. | 543 // A salt lick for the goats. |
| 537 uint64 goat_salt_; | 544 uint64 goat_salt_; |
| 538 | 545 |
| 539 // Buffer for coalescing BytesReadParam so we don't have to post a task on | 546 // Buffer for coalescing BytesReadParam so we don't have to post a task on |
| 540 // each NotifyBytesRead() call. | 547 // each NotifyBytesRead() call. |
| 541 std::vector<BytesReadParam> bytes_read_buffer_; | 548 std::vector<BytesReadParam> bytes_read_buffer_; |
| 542 | 549 |
| 543 std::vector<base::Closure> on_data_ready_callbacks_; | 550 std::vector<base::Closure> on_data_ready_callbacks_; |
| 544 | 551 |
| 545 // All per-Resource values are stored here. | 552 // All per-Resource values are stored here. |
| 546 mutable PerResourceCache per_resource_cache_; | 553 mutable PerResourceCache per_resource_cache_; |
| 547 | 554 |
| 548 // All per-Process values are stored here. | 555 // All per-Process values are stored here. |
| 549 mutable PerProcessCache per_process_cache_; | 556 mutable PerProcessCache per_process_cache_; |
| 550 | 557 |
| 551 DISALLOW_COPY_AND_ASSIGN(TaskManagerModel); | 558 DISALLOW_COPY_AND_ASSIGN(TaskManagerModel); |
| 552 }; | 559 }; |
| 553 | 560 |
| 554 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ | 561 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ |
| OLD | NEW |