| OLD | NEW |
| 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 #include "base/trace_event/memory_dump_manager.h" | 5 #include "base/trace_event/memory_dump_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 last_callback_success_ = false; | 1259 last_callback_success_ = false; |
| 1260 RequestGlobalDumpAndWait(MemoryDumpType::EXPLICITLY_TRIGGERED, | 1260 RequestGlobalDumpAndWait(MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 1261 MemoryDumpLevelOfDetail::DETAILED); | 1261 MemoryDumpLevelOfDetail::DETAILED); |
| 1262 EXPECT_FALSE(last_callback_success_); | 1262 EXPECT_FALSE(last_callback_success_); |
| 1263 | 1263 |
| 1264 ASSERT_TRUE(IsPeriodicDumpingEnabled()); | 1264 ASSERT_TRUE(IsPeriodicDumpingEnabled()); |
| 1265 run_loop.Run(); | 1265 run_loop.Run(); |
| 1266 DisableTracing(); | 1266 DisableTracing(); |
| 1267 } | 1267 } |
| 1268 | 1268 |
| 1269 TEST_F(MemoryDumpManagerTest, TestBlacklistedUnsafeUnregistration) { |
| 1270 InitializeMemoryDumpManager(false /* is_coordinator */); |
| 1271 MockMemoryDumpProvider mdp1; |
| 1272 RegisterDumpProvider(&mdp1, nullptr, kDefaultOptions, |
| 1273 "BlacklistTestDumpProvider"); |
| 1274 // Not calling UnregisterAndDeleteDumpProviderSoon() should not crash. |
| 1275 mdm_->UnregisterDumpProvider(&mdp1); |
| 1276 |
| 1277 Thread thread("test thread"); |
| 1278 thread.Start(); |
| 1279 RegisterDumpProvider(&mdp1, thread.task_runner(), kDefaultOptions, |
| 1280 "BlacklistTestDumpProvider"); |
| 1281 // Unregistering on wrong thread should not crash. |
| 1282 mdm_->UnregisterDumpProvider(&mdp1); |
| 1283 thread.Stop(); |
| 1284 } |
| 1285 |
| 1269 } // namespace trace_event | 1286 } // namespace trace_event |
| 1270 } // namespace base | 1287 } // namespace base |
| OLD | NEW |