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_BROWSER_PROCESS_RESOURCE_USAGE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_PROCESS_RESOURCE_USAGE_IMPL_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/threading/thread_checker.h" |
| 10 #include "content/public/browser/process_resource_usage.h" |
| 11 #include "content/public/common/resource_usage_reporter.mojom.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 class ProcessResourceUsageImpl : public ProcessResourceUsage { |
| 16 public: |
| 17 // Must be called from the same thread that created |service|. |
| 18 explicit ProcessResourceUsageImpl(ResourceUsageReporterPtr service); |
| 19 ~ProcessResourceUsageImpl() override; |
| 20 |
| 21 // ProcessResourceUsage implementation. |
| 22 void Refresh() override; |
| 23 bool ReportsV8MemoryStats() const override; |
| 24 size_t GetV8MemoryAllocated() const override; |
| 25 size_t GetV8MemoryUsed() const override; |
| 26 |
| 27 private: |
| 28 // Mojo IPC callback. |
| 29 void OnRefreshDone(ResourceUsageDataPtr data); |
| 30 |
| 31 ResourceUsageReporterPtr service_; |
| 32 bool update_in_progress_; |
| 33 |
| 34 ResourceUsageDataPtr stats_; |
| 35 |
| 36 base::ThreadChecker thread_checker_; |
| 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(ProcessResourceUsageImpl); |
| 39 }; |
| 40 |
| 41 } // namespace content |
| 42 |
| 43 #endif // CONTENT_BROWSER_PROCESS_RESOURCE_USAGE_IMPL_H_ |
OLD | NEW |