Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7349)

Unified Diff: chrome/browser/task_manager/task_manager.h

Issue 10175008: Improving the process model extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improved task manager sample and minor cleanup. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/task_manager/task_manager.h
diff --git a/chrome/browser/task_manager/task_manager.h b/chrome/browser/task_manager/task_manager.h
index fe88a0905a331b1fe9b843d6be1fdbde37c4f941..68838af7faa5bcc4f1b4373d058561f213a1ba61 100644
--- a/chrome/browser/task_manager/task_manager.h
+++ b/chrome/browser/task_manager/task_manager.h
@@ -255,6 +255,11 @@ class TaskManagerModelObserver {
// Invoked when a range of items has been removed.
virtual void OnItemsRemoved(int start, int length) = 0;
+ // Invoked when a range of items is to be immediately removed. It differs
+ // from OnItemsRemoved by the fact that the item is still in the task manager,
+ // so it can be queried for and found.
+ virtual void OnItemsToBeRemoved(int start, int length) {}
+
// Invoked when the initialization of the model has been finished and
// periodical updates is started. The first periodical update will be done
// in a few seconds. (depending on platform)
@@ -281,6 +286,7 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> {
int64 GetNetworkUsage(int index) const;
double GetCPUUsage(int index) const;
int GetProcessId(int index) const;
+ base::ProcessHandle GetProcess(int index) const;
int GetResourceUniqueId(int index) const;
// Returns the index of resource that has the given |unique_id|. Returns -1 if
// no resouce has the |unique_id|.
@@ -334,6 +340,10 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> {
// resource for the given row isn't a renderer.
bool GetV8Memory(int index, size_t* result) const;
+ // Gets the amount of memory used for javascript. Returns false if the
+ // resource for the given row isn't a renderer.
+ bool GetV8MemoryUsed(int index, size_t* result) const;
+
// Returns true if resource for the given row can be activated.
bool CanActivate(int index) const;
@@ -397,6 +407,14 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> {
void StartUpdating();
void StopUpdating();
+ // Listening involves calling StartUpdating on all resource providers. This
+ // causes all of them to subscribe to notifications and enumerate current
+ // resources. It differs from StartUpdating that it doesn't start the
+ // Refresh timer. The end result is that we have a full view of resources, but
+ // don't spend unneeded time updating, unless we have a real need to.
+ void StartListening();
+ void StopListening();
+
void Clear(); // Removes all items.
// Sends OnModelChanged() to all observers to inform them of significant
@@ -542,9 +560,17 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> {
// StopUpdating.
int update_requests_;
+ // How many calls to StartListening have been made without matching calls to
+ // StopListening.
+ int listen_requests_;
+
// Whether we are currently in the process of updating.
UpdateState update_state_;
+ // Whether we have resource managers listening for events and maintaining
+ // the TaskManagerModel resources.
+ bool is_listening_;
+
// A salt lick for the goats.
uint64 goat_salt_;

Powered by Google App Engine
This is Rietveld 408576698