Add ICU message format support
[chromium-blink-merge.git] / extensions / browser / api / system_memory / memory_info_provider.cc
blob7d97dde390787da9fe485fe1b13541ae0b751f89
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 #include "extensions/browser/api/system_memory/memory_info_provider.h"
7 #include "base/sys_info.h"
9 namespace extensions {
11 using api::system_memory::MemoryInfo;
13 // Static member intialization.
14 base::LazyInstance<scoped_refptr<MemoryInfoProvider> >
15 MemoryInfoProvider::provider_ = LAZY_INSTANCE_INITIALIZER;
17 MemoryInfoProvider::MemoryInfoProvider() {
20 MemoryInfoProvider::~MemoryInfoProvider() {
23 void MemoryInfoProvider::InitializeForTesting(
24 scoped_refptr<MemoryInfoProvider> provider) {
25 DCHECK(provider.get() != NULL);
26 provider_.Get() = provider;
29 bool MemoryInfoProvider::QueryInfo() {
30 info_.capacity = static_cast<double>(base::SysInfo::AmountOfPhysicalMemory());
31 info_.available_capacity =
32 static_cast<double>(base::SysInfo::AmountOfAvailablePhysicalMemory());
33 return true;
36 // static
37 MemoryInfoProvider* MemoryInfoProvider::Get() {
38 if (provider_.Get().get() == NULL)
39 provider_.Get() = new MemoryInfoProvider();
40 return provider_.Get().get();
43 } // namespace extensions