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

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: Moved to async extension functions and generated docs. 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..866b075534a1c01e0469f265cf02d435e0058e22 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,9 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> {
void StartUpdating();
void StopUpdating();
+ void StartListening();
Charlie Reis 2012/04/27 22:01:56 These should have comments to explain what they're
nasko 2012/04/30 18:05:19 Done.
+ void StopListening();
+
void Clear(); // Removes all items.
// Sends OnModelChanged() to all observers to inform them of significant
@@ -430,6 +443,11 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> {
STOPPING // A update task is pending and it should stop the update.
};
+ enum ListenState {
Charlie Reis 2012/04/27 22:01:56 Why not a is_listeneing_ boolean? With UpdateStat
nasko 2012/04/30 18:05:19 I initially started with different states. You are
+ LISTEN_OFF = 0,
+ LISTEN_ON
+ };
+
// This struct is used to exchange information between the io and ui threads.
struct BytesReadParam {
BytesReadParam(int origin_pid,
@@ -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.
+ ListenState listen_state_;
+
// A salt lick for the goats.
uint64 goat_salt_;

Powered by Google App Engine
This is Rietveld 408576698