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

Unified Diff: base/trace_event/memory_allocator_attributes_type_info.h

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 years, 7 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: base/trace_event/memory_allocator_attributes_type_info.h
diff --git a/base/trace_event/memory_allocator_attributes_type_info.h b/base/trace_event/memory_allocator_attributes_type_info.h
new file mode 100644
index 0000000000000000000000000000000000000000..c3986ae2e8eda9326b97a88c28d50fd86df62314
--- /dev/null
+++ b/base/trace_event/memory_allocator_attributes_type_info.h
@@ -0,0 +1,49 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_TRACE_EVENT_MEMORY_ALLOCATOR_ATTRIBUTES_TYPE_INFO_H_
+#define BASE_TRACE_EVENT_MEMORY_ALLOCATOR_ATTRIBUTES_TYPE_INFO_H_
+
+#include <string>
+
+#include "base/base_export.h"
+#include "base/containers/hash_tables.h"
+
+namespace base {
+namespace trace_event {
+
+// A dictionary of "allocator_name/attribute_name" -> "attribute_type" which
+// supports merging and enforces duplicate checking.
+class BASE_EXPORT MemoryAllocatorAttributesTypeInfo {
+ public:
+ MemoryAllocatorAttributesTypeInfo();
+ ~MemoryAllocatorAttributesTypeInfo();
+
+ // Returns the attribute type, or an empty string if not found.
+ const std::string& Get(const std::string& allocator_name,
+ const std::string& attribute_name) const;
+
+ // Refer to tools/perf/unit-info.json for the semantics of |attribute_type|.
+ void Set(const std::string& allocator_name,
+ const std::string& attribute_name,
+ const std::string& attribute_type);
+
+ // Checks whether a given {allocator_name, attribute_name} declaration exists.
+ bool Exists(const std::string& allocator_name,
+ const std::string& attribute_name) const;
+
+ // Merges the attribute types declared in |other| into this.
+ void Update(const MemoryAllocatorAttributesTypeInfo& other);
+
+ private:
+ // "allocator_name/attribute_name" -> attribute_type.
+ hash_map<std::string, std::string> type_info_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(MemoryAllocatorAttributesTypeInfo);
+};
+
+} // namespace trace_event
+} // namespace base
+
+#endif // BASE_TRACE_EVENT_MEMORY_ALLOCATOR_ATTRIBUTES_TYPE_INFO_H_

Powered by Google App Engine
This is Rietveld 408576698