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

Side by Side Diff: components/tracing/child_memory_dump_manager_delegate_impl.h

Issue 1348613006: [tracing] Fix races in TraceLog's EnabledStateObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_ 5 #ifndef COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_
6 #define COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_ 6 #define COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_
7 7
8 #include "base/trace_event/memory_dump_manager.h" 8 #include "base/trace_event/memory_dump_manager.h"
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "base/synchronization/lock.h"
12 13
13 namespace base { 14 namespace base {
14 class SingleThreadTaskRunner; 15 class SingleThreadTaskRunner;
15 } // namespace base 16 } // namespace base
16 17
17 namespace tracing { 18 namespace tracing {
18 19
19 class ChildTraceMessageFilter; 20 class ChildTraceMessageFilter;
20 21
21 // This class is a simple proxy class between the MemoryDumpManager and the 22 // This class is a simple proxy class between the MemoryDumpManager and the
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 58
58 ChildMemoryDumpManagerDelegateImpl(); 59 ChildMemoryDumpManagerDelegateImpl();
59 ~ChildMemoryDumpManagerDelegateImpl() override; 60 ~ChildMemoryDumpManagerDelegateImpl() override;
60 61
61 ChildTraceMessageFilter* ctmf_; // Not owned. 62 ChildTraceMessageFilter* ctmf_; // Not owned.
62 63
63 // The SingleThreadTaskRunner where the |ctmf_| lives. 64 // The SingleThreadTaskRunner where the |ctmf_| lives.
64 // It is NULL iff |cmtf_| is NULL. 65 // It is NULL iff |cmtf_| is NULL.
65 scoped_refptr<base::SingleThreadTaskRunner> ctmf_task_runner_; 66 scoped_refptr<base::SingleThreadTaskRunner> ctmf_task_runner_;
66 67
68 // Protects from concurrent access to |ctmf_task_runner_| to allow
69 // RequestGlobalMemoryDump to be called from arbitrary threads.
70 base::Lock lock_;
71
67 // The unique id of the child process, created for tracing and is expected to 72 // The unique id of the child process, created for tracing and is expected to
68 // be valid only when tracing is enabled. 73 // be valid only when tracing is enabled.
69 uint64 tracing_process_id_; 74 uint64 tracing_process_id_;
70 75
71 DISALLOW_COPY_AND_ASSIGN(ChildMemoryDumpManagerDelegateImpl); 76 DISALLOW_COPY_AND_ASSIGN(ChildMemoryDumpManagerDelegateImpl);
72 }; 77 };
73 78
74 } // namespace tracing 79 } // namespace tracing
75 80
76 #endif // COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_ 81 #endif // COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698