Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / task_manager / renderer_resource.h
blobc83ed3ccd647366d4e5fd1b05a736b0023d5b806
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_TASK_MANAGER_RENDERER_RESOURCE_H_
6 #define CHROME_BROWSER_TASK_MANAGER_RENDERER_RESOURCE_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/task_manager/resource_provider.h"
12 class ProcessResourceUsage;
14 namespace content {
15 class RenderViewHost;
18 namespace task_manager {
20 // Base class for various types of render process resources that provides common
21 // functionality like stats tracking.
22 class RendererResource : public Resource {
23 public:
24 RendererResource(base::ProcessHandle process,
25 content::RenderViewHost* render_view_host);
26 ~RendererResource() override;
28 // Resource methods:
29 base::string16 GetProfileName() const override;
30 base::ProcessHandle GetProcess() const override;
31 int GetUniqueChildProcessId() const override;
32 Type GetType() const override;
33 int GetRoutingID() const override;
35 bool ReportsCacheStats() const override;
36 blink::WebCache::ResourceTypeStats GetWebCoreCacheStats() const override;
37 bool ReportsV8MemoryStats() const override;
38 size_t GetV8MemoryAllocated() const override;
39 size_t GetV8MemoryUsed() const override;
41 // RenderResources always provide the network usage.
42 bool SupportNetworkUsage() const override;
43 void SetSupportNetworkUsage() override {}
45 void Refresh() override;
47 content::RenderViewHost* render_view_host() const {
48 return render_view_host_;
51 private:
52 base::ProcessHandle process_;
53 int unique_process_id_;
55 // RenderViewHost we use to fetch stats.
56 content::RenderViewHost* render_view_host_;
58 scoped_ptr<ProcessResourceUsage> process_resource_usage_;
60 DISALLOW_COPY_AND_ASSIGN(RendererResource);
63 } // namespace task_manager
65 #endif // CHROME_BROWSER_TASK_MANAGER_RENDERER_RESOURCE_H_