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

Side by Side Diff: chrome/browser/task_manager/renderer_resource.h

Issue 1081323003: Convert renderer JS memory usage reporting to use Mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@utility-process-report-js-memory
Patch Set: Rebase and fix tests. Created 5 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_RENDERER_RESOURCE_H_ 5 #ifndef CHROME_BROWSER_TASK_MANAGER_RENDERER_RESOURCE_H_
6 #define CHROME_BROWSER_TASK_MANAGER_RENDERER_RESOURCE_H_ 6 #define CHROME_BROWSER_TASK_MANAGER_RENDERER_RESOURCE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/task_manager/resource_provider.h" 10 #include "chrome/browser/task_manager/resource_provider.h"
10 11
12 class ProcessResourceUsage;
13
11 namespace content { 14 namespace content {
12 class RenderViewHost; 15 class RenderViewHost;
13 } 16 }
14 17
15 namespace task_manager { 18 namespace task_manager {
16 19
17 // Base class for various types of render process resources that provides common 20 // Base class for various types of render process resources that provides common
18 // functionality like stats tracking. 21 // functionality like stats tracking.
19 class RendererResource : public Resource { 22 class RendererResource : public Resource {
20 public: 23 public:
(...skipping 16 matching lines...) Expand all
37 40
38 // RenderResources always provide the network usage. 41 // RenderResources always provide the network usage.
39 bool SupportNetworkUsage() const override; 42 bool SupportNetworkUsage() const override;
40 void SetSupportNetworkUsage() override {} 43 void SetSupportNetworkUsage() override {}
41 44
42 void Refresh() override; 45 void Refresh() override;
43 46
44 void NotifyResourceTypeStats( 47 void NotifyResourceTypeStats(
45 const blink::WebCache::ResourceTypeStats& stats) override; 48 const blink::WebCache::ResourceTypeStats& stats) override;
46 49
47 void NotifyV8HeapStats(size_t v8_memory_allocated,
48 size_t v8_memory_used) override;
49
50 content::RenderViewHost* render_view_host() const { 50 content::RenderViewHost* render_view_host() const {
51 return render_view_host_; 51 return render_view_host_;
52 } 52 }
53 53
54 private: 54 private:
55 base::ProcessHandle process_; 55 base::ProcessHandle process_;
56 int pid_;
57 int unique_process_id_; 56 int unique_process_id_;
58 57
59 // RenderViewHost we use to fetch stats. 58 // RenderViewHost we use to fetch stats.
60 content::RenderViewHost* render_view_host_; 59 content::RenderViewHost* render_view_host_;
61 // The stats_ field holds information about resource usage in the renderer 60 // The stats_ field holds information about resource usage in the renderer
62 // process and so it is updated asynchronously by the Refresh() call. 61 // process and so it is updated asynchronously by the Refresh() call.
63 blink::WebCache::ResourceTypeStats stats_; 62 blink::WebCache::ResourceTypeStats stats_;
64 // This flag is true if we are waiting for the renderer to report its stats. 63 // This flag is true if we are waiting for the renderer to report its stats.
65 bool pending_stats_update_; 64 bool pending_stats_update_;
66 65
67 // We do a similar dance to gather the V8 memory usage in a process. 66 scoped_ptr<ProcessResourceUsage> process_resource_usage_;
68 size_t v8_memory_allocated_;
69 size_t v8_memory_used_;
70 bool pending_v8_memory_allocated_update_;
71 67
72 DISALLOW_COPY_AND_ASSIGN(RendererResource); 68 DISALLOW_COPY_AND_ASSIGN(RendererResource);
73 }; 69 };
74 70
75 } // namespace task_manager 71 } // namespace task_manager
76 72
77 #endif // CHROME_BROWSER_TASK_MANAGER_RENDERER_RESOURCE_H_ 73 #endif // CHROME_BROWSER_TASK_MANAGER_RENDERER_RESOURCE_H_
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/child_process_resource_provider.cc ('k') | chrome/browser/task_manager/renderer_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698