Add ICU message format support
[chromium-blink-merge.git] / extensions / browser / api / system_memory / memory_info_provider.h
blob02719c2386328286e9c8f0e949c0ad1f6e90c382
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 EXTENSIONS_BROWSER_API_SYSTEM_MEMORY_MEMORY_INFO_PROVIDER_H_
6 #define EXTENSIONS_BROWSER_API_SYSTEM_MEMORY_MEMORY_INFO_PROVIDER_H_
8 #include "base/lazy_instance.h"
9 #include "extensions/browser/api/system_info/system_info_provider.h"
10 #include "extensions/common/api/system_memory.h"
12 namespace extensions {
14 class MemoryInfoProvider : public SystemInfoProvider {
15 public:
16 static MemoryInfoProvider* Get();
18 const api::system_memory::MemoryInfo& memory_info() const { return info_; }
20 static void InitializeForTesting(scoped_refptr<MemoryInfoProvider> provider);
22 private:
23 friend class MockMemoryInfoProviderImpl;
25 MemoryInfoProvider();
26 ~MemoryInfoProvider() override;
28 // Overriden from SystemInfoProvider.
29 bool QueryInfo() override;
31 // The last information filled up by QueryInfo and is accessed on multiple
32 // threads, but the whole class is being guarded by SystemInfoProvider base
33 // class.
35 // |info_| is accessed on the UI thread while |is_waiting_for_completion_| is
36 // false and on the sequenced worker pool while |is_waiting_for_completion_|
37 // is true.
38 api::system_memory::MemoryInfo info_;
40 static base::LazyInstance<scoped_refptr<MemoryInfoProvider> > provider_;
42 DISALLOW_COPY_AND_ASSIGN(MemoryInfoProvider);
45 } // namespace extensions
47 #endif // EXTENSIONS_BROWSER_API_SYSTEM_MEMORY_MEMORY_INFO_PROVIDER_H_