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

Issue 2675433002: profiler: decouple ThreadHeapUsageTracker from allocator shim internals (Closed)

Created:
3 years, 10 months ago by Primiano Tucci (use gerrit)
Modified:
3 years, 10 months ago
CC:
chromium-reviews, vmpstr+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

profiler: decouple ThreadHeapUsageTracker from allocator shim internals Background: ----------- Until crrev.com/2658723007, the allocator shim was initialized at compile time and hence always ready to be used. After that CL, the shim requires a run-time initialization. The code in ThreadHeapUsageTracker currently assumes that the shim is initialized by directly calling into the shim chain even before a malloc/free call is intercepted. There are two possible solutions to this: 1. Initialize the shim before ThreadHeapUsageTracker is initialized. 2. Prevent ThreadHeapUsageTracker from directly entering the shim. (more discussion in https://codereview.chromium.org/2658723007/#msg53). 1. is a one liner but not particularly clean. ThreadHeapUsageTracker is lazily initialized when a Thread (the main thread) is created (in the TrackedObject construction). This would mean, in practice, putting the shim initialization in tracked_objects.cc which is quite obscure. This CL: -------- The approach used here is 2. The existing code had already the right sentinel logic to detect and prevent re-entrancy. This CL is just extending that to the dtor and just using new/delete to create the TLS object. This allows to initialize the shim in a less obscure place (e.g. content_main_runner). BUG=665567, 644385 TEST=Build with use_experimental_allocator_shim=true on Mac, run base_unittests Review-Url: https://codereview.chromium.org/2675433002 Cr-Commit-Position: refs/heads/master@{#448360} Committed: https://chromium.googlesource.com/chromium/src/+/e9ffc9c6104f4cc7ff5e62a94869f111c645106a

Patch Set 1 #

Patch Set 2 : typo in comment #

Total comments: 9

Patch Set 3 : Use two sentinels and add comment #

Patch Set 4 : rebase #

Total comments: 2

Patch Set 5 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+28 lines, -19 lines) Patch
M base/debug/thread_heap_usage_tracker.cc View 1 2 4 4 chunks +28 lines, -19 lines 0 comments Download

Messages

Total messages: 37 (25 generated)
Primiano Tucci (use gerrit)
3 years, 10 months ago (2017-02-01 21:53:24 UTC) #6
Sigurður Ásgeirsson
lgtm with a nit. Feel free to address or not. https://codereview.chromium.org/2675433002/diff/20001/base/debug/thread_heap_usage_tracker.cc File base/debug/thread_heap_usage_tracker.cc (right): https://codereview.chromium.org/2675433002/diff/20001/base/debug/thread_heap_usage_tracker.cc#newcode33 ...
3 years, 10 months ago (2017-02-01 22:21:27 UTC) #9
Primiano Tucci (use gerrit)
https://codereview.chromium.org/2675433002/diff/20001/base/debug/thread_heap_usage_tracker.cc File base/debug/thread_heap_usage_tracker.cc (right): https://codereview.chromium.org/2675433002/diff/20001/base/debug/thread_heap_usage_tracker.cc#newcode33 base/debug/thread_heap_usage_tracker.cc:33: ThreadHeapUsage* const kInitializationOrTeardownSentinel = On 2017/02/01 22:21:27, Sigurður Ásgeirsson ...
3 years, 10 months ago (2017-02-01 22:39:05 UTC) #10
Sigurður Ásgeirsson
https://codereview.chromium.org/2675433002/diff/20001/base/debug/thread_heap_usage_tracker.cc File base/debug/thread_heap_usage_tracker.cc (right): https://codereview.chromium.org/2675433002/diff/20001/base/debug/thread_heap_usage_tracker.cc#newcode184 base/debug/thread_heap_usage_tracker.cc:184: allocator_usage = new ThreadHeapUsage(); On 2017/02/01 22:39:05, Primiano Tucci ...
3 years, 10 months ago (2017-02-01 22:46:16 UTC) #11
Primiano Tucci (use gerrit)
https://codereview.chromium.org/2675433002/diff/20001/base/debug/thread_heap_usage_tracker.cc File base/debug/thread_heap_usage_tracker.cc (right): https://codereview.chromium.org/2675433002/diff/20001/base/debug/thread_heap_usage_tracker.cc#newcode299 base/debug/thread_heap_usage_tracker.cc:299: if (thread_heap_usage == kInitializationOrTeardownSentinel) On 2017/02/01 22:46:16, Sigurður Ásgeirsson ...
3 years, 10 months ago (2017-02-02 00:38:27 UTC) #18
Primiano Tucci (use gerrit)
+dcheng for base OWNERS
3 years, 10 months ago (2017-02-02 01:09:08 UTC) #22
dcheng
LGTM https://codereview.chromium.org/2675433002/diff/60001/base/debug/thread_heap_usage_tracker.cc File base/debug/thread_heap_usage_tracker.cc (right): https://codereview.chromium.org/2675433002/diff/60001/base/debug/thread_heap_usage_tracker.cc#newcode272 base/debug/thread_heap_usage_tracker.cc:272: DCHECK(thread_heap_usage != kInitializationSentinel); Minor nit: DCHECK_NE?
3 years, 10 months ago (2017-02-03 06:57:16 UTC) #25
Primiano Tucci (use gerrit)
https://codereview.chromium.org/2675433002/diff/60001/base/debug/thread_heap_usage_tracker.cc File base/debug/thread_heap_usage_tracker.cc (right): https://codereview.chromium.org/2675433002/diff/60001/base/debug/thread_heap_usage_tracker.cc#newcode272 base/debug/thread_heap_usage_tracker.cc:272: DCHECK(thread_heap_usage != kInitializationSentinel); On 2017/02/03 06:57:16, dcheng wrote: > ...
3 years, 10 months ago (2017-02-03 14:50:24 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2675433002/60001
3 years, 10 months ago (2017-02-03 14:50:47 UTC) #29
commit-bot: I haz the power
Failed to apply patch for base/debug/thread_heap_usage_tracker.cc: While running git apply --index -p1; error: patch failed: ...
3 years, 10 months ago (2017-02-03 16:45:29 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2675433002/80001
3 years, 10 months ago (2017-02-06 18:43:08 UTC) #34
commit-bot: I haz the power
3 years, 10 months ago (2017-02-06 19:53:28 UTC) #37
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as
https://chromium.googlesource.com/chromium/src/+/e9ffc9c6104f4cc7ff5e62a94869...

Powered by Google App Engine
This is Rietveld 408576698