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_IMPL_H_ |
| 6 #define CONTENT_BROWSER_PROCESS_RESOURCE_IMPL_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/synchronization/lock.h" |
| 11 #include "content/public/common/process_resource_service.mojom.h" |
| 12 #include "content/public/browser/process_resource.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 // This class lives on the IO thread. |
| 17 class CONTENT_EXPORT ProcessResourceImpl : public ProcessResource { |
| 18 public: |
| 19 explicit ProcessResourceImpl(ProcessResourceServicePtr service); |
| 20 |
| 21 // ProcessResource implementation. Call from any thread. |
| 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 ~ProcessResourceImpl() override; |
| 29 |
| 30 // Run on IO thread. |
| 31 void RefreshOnIOThread(); |
| 32 void OnGetResourceDataDone(ResourceDataPtr data); |
| 33 |
| 34 // Always accessed on IO thread. |
| 35 ProcessResourceServicePtr service_; |
| 36 bool update_in_progress_; |
| 37 |
| 38 // Accessed on any thread. |
| 39 mutable base::Lock lock_; |
| 40 ResourceDataPtr stats_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(ProcessResourceImpl); |
| 43 }; |
| 44 |
| 45 } // namespace content |
| 46 |
| 47 #endif // CONTENT_BROWSER_PROCESS_RESOURCE_IMPL_H_ |
OLD | NEW |