OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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. | |
4 | |
5 #ifndef CONTENT_PUBLIC_BROWSER_PROCESS_RESOURCE_USAGE_H_ | |
6 #define CONTENT_PUBLIC_BROWSER_PROCESS_RESOURCE_USAGE_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "content/common/content_export.h" | |
10 #include "content/public/common/resource_usage_reporter.mojom.h" | |
11 | |
12 namespace content { | |
13 | |
14 // Provides resource usage information about a child process. | |
ncarter (slow)
2015/05/07 20:12:44
Thanks for adding these comments, they are great.
Anand Mistry (off Chromium)
2015/05/11 05:41:31
Acknowledged.
| |
15 // | |
16 // This is a wrapper around the ResourceUsageReporter Mojo service that exposes | |
17 // information about resources used by a child process. Currently, this is only | |
18 // V8 memory usage, but could be expanded to include other resources such as web | |
19 // cache. This is intended for status viewers such as the task manager and | |
20 // about://memory-internals. | |
21 // | |
22 // To create: | |
23 // 1. Obtain a ResourceUsageReporter connection using the child process's | |
24 // service registry. i.e: | |
25 // ResourceUsageReporterPtr service; | |
26 // process->GetServiceRegistry()->ConnectToRemoteService(&service); | |
27 // 2. If needed, the connection can be passed to another thread using | |
28 // ResourceUsageReporterPtr::PassInterface(). | |
29 // 3. Pass the service to Create(). | |
ncarter (slow)
2015/05/07 20:12:44
If you do change the way that the setup dance work
| |
30 // | |
31 // Note: ProcessResourceUsage is thread-hostile and must live on a single | |
32 // thread. | |
33 class CONTENT_EXPORT ProcessResourceUsage { | |
34 public: | |
35 virtual ~ProcessResourceUsage() {} | |
36 | |
37 // Creates a new resource usage reported that is connected to the given Mojo | |
38 // service. |service| must be bound to the current thread. | |
39 static scoped_ptr<ProcessResourceUsage> Create( | |
40 ResourceUsageReporterPtr service); | |
41 | |
42 // Refresh the resource usage information. | |
43 virtual void Refresh() = 0; | |
44 | |
45 // Get V8 memory usage information. | |
46 virtual bool ReportsV8MemoryStats() const = 0; | |
47 virtual size_t GetV8MemoryAllocated() const = 0; | |
48 virtual size_t GetV8MemoryUsed() const = 0; | |
49 }; | |
ncarter (slow)
2015/05/07 20:12:44
During my the first pass, I missed the pretty impo
Anand Mistry (off Chromium)
2015/05/11 05:41:31
I've thought about it and this doesn't belong in c
| |
50 | |
51 } // namespace content | |
52 | |
53 #endif // CONTENT_PUBLIC_BROWSER_PROCESS_RESOURCE_USAGE_H_ | |
OLD | NEW |