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 SetUpdatingByteCount(bool is_updating); |
| 455 |
453 // Returns the network usage (in byte per second) that should be displayed for | 456 // 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 | 457 // the passed |resource|. -1 means the information is not available for that |
455 // resource. | 458 // resource. |
456 int64 GetNetworkUsage(task_manager::Resource* resource) const; | 459 int64 GetNetworkUsage(task_manager::Resource* resource) const; |
457 | 460 |
458 // Returns the CPU usage (in %) that should be displayed for the passed | 461 // Returns the CPU usage (in %) that should be displayed for the passed |
459 // |resource|. | 462 // |resource|. |
460 double GetCPUUsage(task_manager::Resource* resource) const; | 463 double GetCPUUsage(task_manager::Resource* resource) const; |
461 | 464 |
462 // Returns the idle wakeups that should be displayed for the passed | 465 // 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. | 529 // StopUpdating. |
527 int update_requests_; | 530 int update_requests_; |
528 | 531 |
529 // How many calls to StartListening have been made without matching calls to | 532 // How many calls to StartListening have been made without matching calls to |
530 // StopListening. | 533 // StopListening. |
531 int listen_requests_; | 534 int listen_requests_; |
532 | 535 |
533 // Whether we are currently in the process of updating. | 536 // Whether we are currently in the process of updating. |
534 UpdateState update_state_; | 537 UpdateState update_state_; |
535 | 538 |
| 539 // Whether the IO thread is currently in the process of updating; accessed |
| 540 // only on the IO thread. |
| 541 bool is_updating_byte_count_; |
| 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 |