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

Side by Side Diff: chrome/browser/ui/cocoa/task_manager_mac.h

Issue 2187993002: Remove the TableRowNSImageCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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_UI_COCOA_TASK_MANAGER_MAC_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_TASK_MANAGER_MAC_H_
6 #define CHROME_BROWSER_UI_COCOA_TASK_MANAGER_MAC_H_ 6 #define CHROME_BROWSER_UI_COCOA_TASK_MANAGER_MAC_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "chrome/browser/task_manager/task_manager.h" 13 #include "chrome/browser/task_manager/task_manager.h"
14 #include "chrome/browser/ui/cocoa/table_row_nsimage_cache.h"
15 14
16 @class WindowSizeAutosaver; 15 @class WindowSizeAutosaver;
17 class TaskManagerMac; 16 class TaskManagerMac;
18 17
19 namespace gfx { 18 namespace gfx {
20 class ImageSkia; 19 class ImageSkia;
21 } 20 }
22 21
23 // This class is responsible for loading the task manager window and for 22 // This class is responsible for loading the task manager window and for
24 // managing it. 23 // managing it.
(...skipping 29 matching lines...) Expand all
54 53
55 // Callback for double clicks on the table. 54 // Callback for double clicks on the table.
56 - (void)selectDoubleClickedTab:(id)sender; 55 - (void)selectDoubleClickedTab:(id)sender;
57 @end 56 @end
58 57
59 @interface TaskManagerWindowController (TestingAPI) 58 @interface TaskManagerWindowController (TestingAPI)
60 - (NSTableView*)tableView; 59 - (NSTableView*)tableView;
61 @end 60 @end
62 61
63 // This class listens to task changed events sent by chrome. 62 // This class listens to task changed events sent by chrome.
64 class TaskManagerMac : public TaskManagerModelObserver, 63 class TaskManagerMac : public TaskManagerModelObserver {
65 public TableRowNSImageCache::Table {
66 public: 64 public:
67 explicit TaskManagerMac(TaskManager* task_manager); 65 explicit TaskManagerMac(TaskManager* task_manager);
68 ~TaskManagerMac() override; 66 ~TaskManagerMac() override;
69 67
70 // TaskManagerModelObserver 68 // TaskManagerModelObserver
71 void OnModelChanged() override; 69 void OnModelChanged() override;
72 void OnItemsChanged(int start, int length) override; 70 void OnItemsChanged(int start, int length) override;
73 void OnItemsAdded(int start, int length) override; 71 void OnItemsAdded(int start, int length) override;
74 void OnItemsRemoved(int start, int length) override; 72 void OnItemsRemoved(int start, int length) override;
75 73
76 // Called by the cocoa window controller when its window closes and the 74 // Called by the cocoa window controller when its window closes and the
77 // controller destroyed itself. Informs the model to stop updating. 75 // controller destroyed itself. Informs the model to stop updating.
78 void WindowWasClosed(); 76 void WindowWasClosed();
79 77
80 // TableRowNSImageCache::Table
81 int RowCount() const override;
82 gfx::ImageSkia GetIcon(int r) const override;
83
84 // Creates the task manager if it doesn't exist; otherwise, it activates the 78 // Creates the task manager if it doesn't exist; otherwise, it activates the
85 // existing task manager window. 79 // existing task manager window.
86 static void Show(); 80 static void Show();
87 81
88 // Hides the task manager if it is showing. 82 // Hides the task manager if it is showing.
89 static void Hide(); 83 static void Hide();
90 84
91 // Returns the TaskManager observed by |this|. 85 // Returns the TaskManager observed by |this|.
92 TaskManager* task_manager() { return task_manager_; } 86 TaskManager* task_manager() { return task_manager_; }
93 87
94 // Lazily converts the image at the given row and caches it in |icon_cache_|. 88 // Lazily converts the image at the given row and caches it in |icon_cache_|.
95 NSImage* GetImageForRow(int row); 89 NSImage* GetImageForRow(int row);
96 90
97 // Returns the cocoa object. Used for testing. 91 // Returns the cocoa object. Used for testing.
98 TaskManagerWindowController* cocoa_controller() { return window_controller_; } 92 TaskManagerWindowController* cocoa_controller() { return window_controller_; }
99 93
100 private: 94 private:
101 // The task manager. 95 // The task manager.
102 TaskManager* const task_manager_; // weak 96 TaskManager* const task_manager_; // weak
103 97
104 // Our model. 98 // Our model.
105 TaskManagerModel* const model_; // weak 99 TaskManagerModel* const model_; // weak
106 100
107 // Controller of our window, destroys itself when the task manager window 101 // Controller of our window, destroys itself when the task manager window
108 // is closed. 102 // is closed.
109 TaskManagerWindowController* window_controller_; // weak 103 TaskManagerWindowController* window_controller_; // weak
110 104
111 // Caches favicons for all rows. Needs to be initalized after |model_|.
112 TableRowNSImageCache icon_cache_;
113
114 // An open task manager window. There can only be one open at a time. This 105 // An open task manager window. There can only be one open at a time. This
115 // is reset to NULL when the window is closed. 106 // is reset to NULL when the window is closed.
116 static TaskManagerMac* instance_; 107 static TaskManagerMac* instance_;
117 108
118 DISALLOW_COPY_AND_ASSIGN(TaskManagerMac); 109 DISALLOW_COPY_AND_ASSIGN(TaskManagerMac);
119 }; 110 };
120 111
121 #endif // CHROME_BROWSER_UI_COCOA_TASK_MANAGER_MAC_H_ 112 #endif // CHROME_BROWSER_UI_COCOA_TASK_MANAGER_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698