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

Side by Side Diff: chrome/browser/task_manager_resource_providers.h

Issue 2856091: Fix some problems with TaskManagerBrowserTest.PopulateWebCacheFields: (Closed)
Patch Set: memset Created 10 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_RESOURCE_PROVIDERS_H_ 5 #ifndef CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H_
6 #define CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ 6 #define CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 17 matching lines...) Expand all
28 public: 28 public:
29 explicit TaskManagerTabContentsResource(TabContents* tab_contents); 29 explicit TaskManagerTabContentsResource(TabContents* tab_contents);
30 ~TaskManagerTabContentsResource(); 30 ~TaskManagerTabContentsResource();
31 31
32 // TaskManagerResource methods: 32 // TaskManagerResource methods:
33 std::wstring GetTitle() const; 33 std::wstring GetTitle() const;
34 SkBitmap GetIcon() const; 34 SkBitmap GetIcon() const;
35 base::ProcessHandle GetProcess() const; 35 base::ProcessHandle GetProcess() const;
36 TabContents* GetTabContents() const; 36 TabContents* GetTabContents() const;
37 37
38 virtual bool ReportsCacheStats() const { return true; } 38 virtual bool HasCacheStats() const { return had_stats_update_; }
39 virtual WebKit::WebCache::ResourceTypeStats GetWebCoreCacheStats() const; 39 virtual WebKit::WebCache::ResourceTypeStats GetWebCoreCacheStats() const;
40 40
41 virtual bool ReportsV8MemoryStats() const { return true; } 41 virtual bool ReportsV8MemoryStats() const { return true; }
42 virtual size_t GetV8MemoryAllocated() const; 42 virtual size_t GetV8MemoryAllocated() const;
43 virtual size_t GetV8MemoryUsed() const; 43 virtual size_t GetV8MemoryUsed() const;
44 44
45 // TabContents always provide the network usage. 45 // TabContents always provide the network usage.
46 bool SupportNetworkUsage() const { return true; } 46 bool SupportNetworkUsage() const { return true; }
47 void SetSupportNetworkUsage() { } 47 void SetSupportNetworkUsage() { }
48 48
49 virtual void Refresh(); 49 virtual void Refresh();
50 50
51 virtual void NotifyResourceTypeStats( 51 virtual void NotifyResourceTypeStats(
52 const WebKit::WebCache::ResourceTypeStats& stats); 52 const WebKit::WebCache::ResourceTypeStats& stats);
53 53
54 virtual void NotifyV8HeapStats(size_t v8_memory_allocated, 54 virtual void NotifyV8HeapStats(size_t v8_memory_allocated,
55 size_t v8_memory_used); 55 size_t v8_memory_used);
56 56
57 private: 57 private:
58 TabContents* tab_contents_; 58 TabContents* tab_contents_;
59 base::ProcessHandle process_; 59 base::ProcessHandle process_;
60 int pid_; 60 int pid_;
61
61 // The stats_ field holds information about resource usage in the renderer 62 // The stats_ field holds information about resource usage in the renderer
62 // process and so it is updated asynchronously by the Refresh() call. 63 // process and so it is updated asynchronously by the Refresh() call.
63 WebKit::WebCache::ResourceTypeStats stats_; 64 WebKit::WebCache::ResourceTypeStats stats_;
65
64 // This flag is true if we are waiting for the renderer to report its stats. 66 // This flag is true if we are waiting for the renderer to report its stats.
65 bool pending_stats_update_; 67 bool pending_stats_update_;
66 68
69 // This flag is true after we received at least one stats report
70 // from the renderer.
71 bool had_stats_update_;
72
67 // We do a similar dance to gather the V8 memory usage in a process. 73 // We do a similar dance to gather the V8 memory usage in a process.
68 size_t v8_memory_allocated_; 74 size_t v8_memory_allocated_;
69 size_t v8_memory_used_; 75 size_t v8_memory_used_;
70 bool pending_v8_memory_allocated_update_; 76 bool pending_v8_memory_allocated_update_;
71 77
72 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResource); 78 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResource);
73 }; 79 };
74 80
75 class TaskManagerTabContentsResourceProvider 81 class TaskManagerTabContentsResourceProvider
76 : public TaskManager::ResourceProvider, 82 : public TaskManager::ResourceProvider,
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 393
388 void AddToTaskManager(ChildProcessInfo child_process_info); 394 void AddToTaskManager(ChildProcessInfo child_process_info);
389 395
390 TaskManager* task_manager_; 396 TaskManager* task_manager_;
391 TaskManagerBrowserProcessResource resource_; 397 TaskManagerBrowserProcessResource resource_;
392 398
393 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); 399 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider);
394 }; 400 };
395 401
396 #endif // CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ 402 #endif // CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H_
OLDNEW
« no previous file with comments | « chrome/browser/task_manager_browsertest.cc ('k') | chrome/browser/task_manager_resource_providers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698