| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "base/process_util.h" | 18 #include "base/process_util.h" |
| 19 #include "base/string16.h" | 19 #include "base/string16.h" |
| 20 #include "base/timer.h" | 20 #include "base/timer.h" |
| 21 #include "chrome/browser/renderer_host/web_cache_manager.h" | 21 #include "chrome/browser/renderer_host/web_cache_manager.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" |
| 23 | 23 |
| 24 class SkBitmap; | |
| 25 class TabContents; | 24 class TabContents; |
| 26 typedef TabContents TabContentsWrapper; | 25 typedef TabContents TabContentsWrapper; |
| 27 class TaskManagerModel; | 26 class TaskManagerModel; |
| 28 | 27 |
| 29 namespace base { | 28 namespace base { |
| 30 class ProcessMetrics; | 29 class ProcessMetrics; |
| 31 } | 30 } |
| 32 | 31 |
| 33 namespace extensions { | 32 namespace extensions { |
| 34 class Extension; | 33 class Extension; |
| 35 } | 34 } |
| 36 | 35 |
| 36 namespace gfx { |
| 37 class ImageSkia; |
| 38 } |
| 39 |
| 37 namespace net { | 40 namespace net { |
| 38 class URLRequest; | 41 class URLRequest; |
| 39 } | 42 } |
| 40 | 43 |
| 41 #define TASKMANAGER_RESOURCE_TYPE_LIST(def) \ | 44 #define TASKMANAGER_RESOURCE_TYPE_LIST(def) \ |
| 42 def(BROWSER) /* The main browser process. */ \ | 45 def(BROWSER) /* The main browser process. */ \ |
| 43 def(RENDERER) /* A normal WebContents renderer process. */ \ | 46 def(RENDERER) /* A normal WebContents renderer process. */ \ |
| 44 def(EXTENSION) /* An extension or app process. */ \ | 47 def(EXTENSION) /* An extension or app process. */ \ |
| 45 def(NOTIFICATION) /* A notification process. */ \ | 48 def(NOTIFICATION) /* A notification process. */ \ |
| 46 def(PLUGIN) /* A plugin process. */ \ | 49 def(PLUGIN) /* A plugin process. */ \ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 64 public: | 67 public: |
| 65 virtual ~Resource() {} | 68 virtual ~Resource() {} |
| 66 | 69 |
| 67 enum Type { | 70 enum Type { |
| 68 UNKNOWN = 0, | 71 UNKNOWN = 0, |
| 69 TASKMANAGER_RESOURCE_TYPE_LIST(TASKMANAGER_RESOURCE_TYPE_LIST_ENUM) | 72 TASKMANAGER_RESOURCE_TYPE_LIST(TASKMANAGER_RESOURCE_TYPE_LIST_ENUM) |
| 70 }; | 73 }; |
| 71 | 74 |
| 72 virtual string16 GetTitle() const = 0; | 75 virtual string16 GetTitle() const = 0; |
| 73 virtual string16 GetProfileName() const = 0; | 76 virtual string16 GetProfileName() const = 0; |
| 74 virtual SkBitmap GetIcon() const = 0; | 77 virtual gfx::ImageSkia GetIcon() const = 0; |
| 75 virtual base::ProcessHandle GetProcess() const = 0; | 78 virtual base::ProcessHandle GetProcess() const = 0; |
| 76 virtual int GetUniqueChildProcessId() const = 0; | 79 virtual int GetUniqueChildProcessId() const = 0; |
| 77 virtual Type GetType() const = 0; | 80 virtual Type GetType() const = 0; |
| 78 virtual int GetRoutingID() const { return 0; } | 81 virtual int GetRoutingID() const { return 0; } |
| 79 | 82 |
| 80 virtual bool ReportsCacheStats() const { return false; } | 83 virtual bool ReportsCacheStats() const { return false; } |
| 81 virtual WebKit::WebCache::ResourceTypeStats GetWebCoreCacheStats() const { | 84 virtual WebKit::WebCache::ResourceTypeStats GetWebCoreCacheStats() const { |
| 82 return WebKit::WebCache::ResourceTypeStats(); | 85 return WebKit::WebCache::ResourceTypeStats(); |
| 83 } | 86 } |
| 84 | 87 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 // Returns true if the resource is first/last in its group (resources | 368 // Returns true if the resource is first/last in its group (resources |
| 366 // rendered by the same process are groupped together). | 369 // rendered by the same process are groupped together). |
| 367 bool IsResourceFirstInGroup(int index) const; | 370 bool IsResourceFirstInGroup(int index) const; |
| 368 bool IsResourceLastInGroup(int index) const; | 371 bool IsResourceLastInGroup(int index) const; |
| 369 | 372 |
| 370 // Returns true if the resource runs in the background (not visible to the | 373 // Returns true if the resource runs in the background (not visible to the |
| 371 // user, e.g. extension background pages and BackgroundContents). | 374 // user, e.g. extension background pages and BackgroundContents). |
| 372 bool IsBackgroundResource(int index) const; | 375 bool IsBackgroundResource(int index) const; |
| 373 | 376 |
| 374 // Returns icon to be used for resource (for example a favicon). | 377 // Returns icon to be used for resource (for example a favicon). |
| 375 SkBitmap GetResourceIcon(int index) const; | 378 gfx::ImageSkia GetResourceIcon(int index) const; |
| 376 | 379 |
| 377 // Returns the group range of resource. | 380 // Returns the group range of resource. |
| 378 GroupRange GetGroupRangeForResource(int index) const; | 381 GroupRange GetGroupRangeForResource(int index) const; |
| 379 | 382 |
| 380 // Returns an index of groups to which the resource belongs. | 383 // Returns an index of groups to which the resource belongs. |
| 381 int GetGroupIndexForResource(int index) const; | 384 int GetGroupIndexForResource(int index) const; |
| 382 | 385 |
| 383 // Returns an index of resource which belongs to the |group_index|th group | 386 // Returns an index of resource which belongs to the |group_index|th group |
| 384 // and which is the |index_in_group|th resource in group. | 387 // and which is the |index_in_group|th resource in group. |
| 385 int GetResourceIndexForGroup(int group_index, int index_in_group) const; | 388 int GetResourceIndexForGroup(int group_index, int index_in_group) const; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 // A salt lick for the goats. | 578 // A salt lick for the goats. |
| 576 uint64 goat_salt_; | 579 uint64 goat_salt_; |
| 577 | 580 |
| 578 // Resource identifier that is unique within single session. | 581 // Resource identifier that is unique within single session. |
| 579 int last_unique_id_; | 582 int last_unique_id_; |
| 580 | 583 |
| 581 DISALLOW_COPY_AND_ASSIGN(TaskManagerModel); | 584 DISALLOW_COPY_AND_ASSIGN(TaskManagerModel); |
| 582 }; | 585 }; |
| 583 | 586 |
| 584 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ | 587 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ |
| OLD | NEW |