Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: runtime/vm/cpuinfo_fuchsia.cc

Issue 2148533002: Fuchsia: Platform specific calls needed to Initialize and Cleanup VM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/cpuinfo_fuchsia.cc
diff --git a/runtime/vm/cpuinfo_fuchsia.cc b/runtime/vm/cpuinfo_fuchsia.cc
index 04fe196415eb393d4425163c157346e0c0acbe39..2af262e65840183f9b77eee536d9a8ab97642900 100644
--- a/runtime/vm/cpuinfo_fuchsia.cc
+++ b/runtime/vm/cpuinfo_fuchsia.cc
@@ -8,8 +8,7 @@
#include "vm/cpuinfo.h"
#include "platform/assert.h"
-
-// TODO(zra): Use "vm/cpuid.h"
+#include "vm/cpuid.h"
namespace dart {
@@ -17,30 +16,41 @@ CpuInfoMethod CpuInfo::method_ = kCpuInfoDefault;
const char* CpuInfo::fields_[kCpuInfoMax] = {0};
void CpuInfo::InitOnce() {
- UNIMPLEMENTED();
+ method_ = kCpuInfoCpuId;
+
+ // Initialize the CpuId information.
+ CpuId::InitOnce();
+
+ fields_[kCpuInfoProcessor] = "Processor";
+ fields_[kCpuInfoModel] = "Hardware";
+ fields_[kCpuInfoHardware] = "Hardware";
+ fields_[kCpuInfoFeatures] = "Features";
}
void CpuInfo::Cleanup() {
- UNIMPLEMENTED();
+ CpuId::Cleanup();
}
bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) {
- UNIMPLEMENTED();
- return false;
+ ASSERT(method_ != kCpuInfoDefault);
+ return strstr(CpuId::field(idx), search_string);
}
const char* CpuInfo::ExtractField(CpuInfoIndices idx) {
- UNIMPLEMENTED();
- return "<undefined>";
+ ASSERT(method_ != kCpuInfoDefault);
+ return CpuId::field(idx);
}
bool CpuInfo::HasField(const char* field) {
- UNIMPLEMENTED();
- return false;
+ ASSERT(method_ != kCpuInfoDefault);
+ return (strcmp(field, fields_[kCpuInfoProcessor]) == 0) ||
+ (strcmp(field, fields_[kCpuInfoModel]) == 0) ||
+ (strcmp(field, fields_[kCpuInfoHardware]) == 0) ||
+ (strcmp(field, fields_[kCpuInfoFeatures]) == 0);
}
} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698