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

Unified Diff: mojo/edk/system/handle_table.h

Issue 2915013006: Add a Mojo MemoryDumpProvider. (Closed)
Patch Set: compile error. Created 3 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: mojo/edk/system/handle_table.h
diff --git a/mojo/edk/system/handle_table.h b/mojo/edk/system/handle_table.h
index 882d5405cee83f4c7243a6d6706764e460324762..62c5add0d35dd92412bea7bda1f75a7ea2112996 100644
--- a/mojo/edk/system/handle_table.h
+++ b/mojo/edk/system/handle_table.h
@@ -11,16 +11,21 @@
#include "base/containers/hash_tables.h"
#include "base/macros.h"
+#include "base/synchronization/lock.h"
+#include "base/trace_event/memory_dump_provider.h"
#include "mojo/edk/system/dispatcher.h"
#include "mojo/public/c/system/types.h"
namespace mojo {
namespace edk {
-class HandleTable {
+class HandleTable : public base::trace_event::MemoryDumpProvider {
public:
HandleTable();
- ~HandleTable();
+ ~HandleTable() override;
+
+ // HandleTable is thread-hostile. All access should be gated by GetLock().
+ base::Lock& GetLock();
MojoHandle AddDispatcher(scoped_refptr<Dispatcher> dispatcher);
@@ -50,6 +55,10 @@ class HandleTable {
void GetActiveHandlesForTest(std::vector<MojoHandle> *handles);
private:
+ // MemoryDumpProvider implementation.
+ bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
+ base::trace_event::ProcessMemoryDump* pmd) override;
+
struct Entry {
Entry();
explicit Entry(scoped_refptr<Dispatcher> dispatcher);
@@ -63,6 +72,7 @@ class HandleTable {
using HandleMap = base::hash_map<MojoHandle, Entry>;
HandleMap handles_;
+ base::Lock lock_;
uint32_t next_available_handle_ = 1;

Powered by Google App Engine
This is Rietveld 408576698