forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename memory_infra_background_whitelist to allowlist
Also renaming related functions and variables. Making wording more inclusive. Bug: 842296 Change-Id: If1121d2496c151a87ecb9a517633195d8e851a7f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095841 Reviewed-by: Primiano Tucci <primiano@chromium.org> Reviewed-by: Marc Treib <treib@chromium.org> Reviewed-by: ssid <ssid@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Eugene Zemtsov <eugene@chromium.org> Cr-Commit-Position: refs/heads/master@{#749314}
- Loading branch information
Showing
14 changed files
with
118 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2016 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. | ||
|
||
#ifndef BASE_TRACE_EVENT_MEMORY_INFRA_BACKGROUND_ALLOWLIST_H_ | ||
#define BASE_TRACE_EVENT_MEMORY_INFRA_BACKGROUND_ALLOWLIST_H_ | ||
|
||
// This file contains the allowlists (aka whitelists) for background mode to | ||
// limit the tracing overhead and remove sensitive information from traces. | ||
|
||
#include <string> | ||
|
||
#include "base/base_export.h" | ||
|
||
namespace base { | ||
namespace trace_event { | ||
|
||
// Checks if the given |mdp_name| is in the allow list. | ||
bool BASE_EXPORT IsMemoryDumpProviderInAllowlist(const char* mdp_name); | ||
|
||
// Checks if the given |name| matches any of the allowed patterns. | ||
bool BASE_EXPORT IsMemoryAllocatorDumpNameInAllowlist(const std::string& name); | ||
|
||
// The allow list is replaced with the given list for tests. The last element | ||
// of the list must be nullptr. | ||
void BASE_EXPORT SetDumpProviderAllowlistForTesting(const char* const* list); | ||
void BASE_EXPORT | ||
SetAllocatorDumpNameAllowlistForTesting(const char* const* list); | ||
|
||
} // namespace trace_event | ||
} // namespace base | ||
|
||
#endif // BASE_TRACE_EVENT_MEMORY_INFRA_BACKGROUND_ALLOWLIST_H_ |
37 changes: 37 additions & 0 deletions
37
base/trace_event/memory_infra_background_allowlist_unittest.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2018 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 "base/trace_event/memory_infra_background_allowlist.h" | ||
|
||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
namespace base { | ||
|
||
namespace trace_event { | ||
|
||
TEST(MemoryInfraBackgroundAllowlist, Allowlist) { | ||
// Global dumps that are of hex digits are all allowed for background use. | ||
EXPECT_TRUE(IsMemoryAllocatorDumpNameInAllowlist("global/01234ABCDEF")); | ||
EXPECT_TRUE( | ||
IsMemoryAllocatorDumpNameInAllowlist("shared_memory/01234ABCDEF")); | ||
|
||
// Global dumps that contain non-hex digits are not in the allowlist. | ||
EXPECT_FALSE(IsMemoryAllocatorDumpNameInAllowlist("global/GHIJK")); | ||
EXPECT_FALSE(IsMemoryAllocatorDumpNameInAllowlist("shared_memory/GHIJK")); | ||
|
||
// Test a couple that contain pointer values. | ||
EXPECT_TRUE(IsMemoryAllocatorDumpNameInAllowlist("net/url_request_context")); | ||
EXPECT_TRUE(IsMemoryAllocatorDumpNameInAllowlist( | ||
"net/url_request_context/app_request/0x123/cookie_monster")); | ||
EXPECT_TRUE( | ||
IsMemoryAllocatorDumpNameInAllowlist("net/http_network_session_0x123")); | ||
EXPECT_FALSE( | ||
IsMemoryAllocatorDumpNameInAllowlist("net/http_network_session/0x123")); | ||
EXPECT_TRUE(IsMemoryAllocatorDumpNameInAllowlist( | ||
"net/http_network_session_0x123/quic_stream_factory")); | ||
} | ||
|
||
} // namespace trace_event | ||
|
||
} // namespace base |
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
base/trace_event/memory_infra_background_whitelist_unittest.cc
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.