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

Unified Diff: base/allocator/allocator_interception_mac_unittest.mm

Issue 2802493002: Revert of mac: Periodically shim new malloc zones immediately after startup. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « base/allocator/allocator_interception_mac.mm ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/allocator/allocator_interception_mac_unittest.mm
diff --git a/base/allocator/allocator_interception_mac_unittest.mm b/base/allocator/allocator_interception_mac_unittest.mm
deleted file mode 100644
index a8d28f1302389094f3b69c18260631e1409aa316..0000000000000000000000000000000000000000
--- a/base/allocator/allocator_interception_mac_unittest.mm
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2017 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.
-
-#include <mach/mach.h>
-
-#include "base/allocator/allocator_interception_mac.h"
-#include "base/allocator/allocator_shim.h"
-#include "base/allocator/malloc_zone_functions_mac.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace base {
-namespace allocator {
-
-namespace {
-void ResetMallocZone(ChromeMallocZone* zone) {
- MallocZoneFunctions& functions = GetFunctionsForZone(zone);
- ReplaceZoneFunctions(zone, &functions);
-}
-
-void ResetAllMallocZones() {
- ChromeMallocZone* default_malloc_zone =
- reinterpret_cast<ChromeMallocZone*>(malloc_default_zone());
- ResetMallocZone(default_malloc_zone);
-
- vm_address_t* zones;
- unsigned int count;
- kern_return_t kr = malloc_get_all_zones(mach_task_self(), 0, &zones, &count);
- if (kr != KERN_SUCCESS)
- return;
- for (unsigned int i = 0; i < count; ++i) {
- ChromeMallocZone* zone = reinterpret_cast<ChromeMallocZone*>(zones[i]);
- ResetMallocZone(zone);
- }
-}
-} // namespace
-
-class AllocatorInterceptionTest : public testing::Test {
- protected:
- void TearDown() override {
- ResetAllMallocZones();
- ClearAllMallocZonesForTesting();
- }
-};
-
-TEST_F(AllocatorInterceptionTest, ShimNewMallocZones) {
- InitializeAllocatorShim();
- ChromeMallocZone* default_malloc_zone =
- reinterpret_cast<ChromeMallocZone*>(malloc_default_zone());
-
- malloc_zone_t new_zone;
- memset(&new_zone, 1, sizeof(malloc_zone_t));
- malloc_zone_register(&new_zone);
- EXPECT_NE(new_zone.malloc, default_malloc_zone->malloc);
- ShimNewMallocZones();
- EXPECT_EQ(new_zone.malloc, default_malloc_zone->malloc);
-
- malloc_zone_unregister(&new_zone);
-}
-
-} // namespace allocator
-} // namespace base
« no previous file with comments | « base/allocator/allocator_interception_mac.mm ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698