| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_PROCESS_RESOURCE_USAGE_H_ | 5 #ifndef CHROME_BROWSER_PROCESS_RESOURCE_USAGE_H_ |
| 6 #define CHROME_BROWSER_PROCESS_RESOURCE_USAGE_H_ | 6 #define CHROME_BROWSER_PROCESS_RESOURCE_USAGE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 15 #include "chrome/common/resource_usage_reporter.mojom.h" | 15 #include "chrome/common/resource_usage_reporter.mojom.h" |
| 16 #include "third_party/WebKit/public/web/WebCache.h" | 16 #include "third_party/WebKit/public/web/WebCache.h" |
| 17 | 17 |
| 18 // Provides resource usage information about a child process. | 18 // Provides resource usage information about a child process. |
| 19 // | 19 // |
| 20 // This is a wrapper around the ResourceUsageReporter Mojo service that exposes | 20 // This is a wrapper around the ResourceUsageReporter Mojo service that exposes |
| 21 // information about resources used by a child process. Currently, this is only | 21 // information about resources used by a child process. Currently, this is only |
| 22 // V8 memory and Blink resource cache usage, but could be expanded to include | 22 // V8 memory and Blink resource cache usage, but could be expanded to include |
| 23 // other resources. This is intended for status viewers such as the task | 23 // other resources. This is intended for status viewers such as the task |
| 24 // manager and about://memory-internals. | 24 // manager. |
| 25 // | 25 // |
| 26 // To create: | 26 // To create: |
| 27 // 1. Create a ResourceUsageReporterPtr and obtain an InterfaceRequest<> using | 27 // 1. Create a ResourceUsageReporterPtr and obtain an InterfaceRequest<> using |
| 28 // mojo::GetProxy. | 28 // mojo::GetProxy. |
| 29 // 2. Use the child process's service registry to connect to the service using | 29 // 2. Use the child process's service registry to connect to the service using |
| 30 // the InterfaceRequest<>. Note, ServiceRegistry is thread hostile and | 30 // the InterfaceRequest<>. Note, ServiceRegistry is thread hostile and |
| 31 // must always be accessed from the same thread. However, InterfaceRequest<> | 31 // must always be accessed from the same thread. However, InterfaceRequest<> |
| 32 // can be passed safely between threads, and therefore a task can be posted | 32 // can be passed safely between threads, and therefore a task can be posted |
| 33 // to the ServiceRegistry thread to connect to the remote service. | 33 // to the ServiceRegistry thread to connect to the remote service. |
| 34 // 3. Pass the ResourceUsageReporterPtr to the constructor. | 34 // 3. Pass the ResourceUsageReporterPtr to the constructor. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 std::deque<base::Closure> refresh_callbacks_; | 81 std::deque<base::Closure> refresh_callbacks_; |
| 82 | 82 |
| 83 ResourceUsageDataPtr stats_; | 83 ResourceUsageDataPtr stats_; |
| 84 | 84 |
| 85 base::ThreadChecker thread_checker_; | 85 base::ThreadChecker thread_checker_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(ProcessResourceUsage); | 87 DISALLOW_COPY_AND_ASSIGN(ProcessResourceUsage); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 #endif // CHROME_BROWSER_PROCESS_RESOURCE_USAGE_H_ | 90 #endif // CHROME_BROWSER_PROCESS_RESOURCE_USAGE_H_ |
| OLD | NEW |