Rewrite most Foo* field_ pointer fields to raw_ptr<Foo> field_ II
Follow the lead of upstream and rewrite most raw pointers to using raw_ptr<T> instead, making also sure that they are initialized. We already this in the past but new raw pointers sneaked in, so this is a second pass to drop the newly added ones. This rewrite affected all *.h and *.cc files in this repository except those from the ios/, third_party/ and vendor/ directories, and it didn't touch any *.mm file either. Regular expression used for the search & replace process: Find regexp: "^\s*?(\S*?)\* (\S*?[a-zA-Z0-9]_?);" Replace with: "raw_ptr<$1> $2 = nullptr;" Chromium change: https://source.chromium.org/chromium/chromium/src/+/0e45c020c43b1a9f6d2870ff7f92b30a2f03a458 commit 0e45c020c43b1a9f6d2870ff7f92b30a2f03a458 Author: Keishi Hattori <keishi@chromium.org> Date: Sat Nov 27 09:25:52 2021 +0000 Rewrite most `Foo* field_` pointer fields to `raw_ptr<Foo> field_`. DO NOT REVERT (unless absolutely necessary)! Report build breaks to keishi@(APAC)/glazunov@(EMEA /sebmarchand@(NA) as soon as you see them. Fixes are expected to be trivial. This commit was generated automatically, by running the following script: tools/clang/rewrite_ra _ptr_fields/rewrite-multiple-platforms.sh on commit fe74bc434e5b7e92d13a328362fcb6df15d8847e For more information, see MiraclePtr One Pager [1], the PSA at chromium-dev@ [2], and the raw_pt documentation in //base/memory/raw_ptr.md. FYI This CL does not enable MiraclePtr protection and we expect no behavior change from this. [1] https://docs.google.com/document/d/1pnnOAIz_DMWDI4oIOFoMAqLnf_MZ2GsrJNb_dbQ3ZBg/edit?usp=sha ing [2] https://groups.google.com/a/chromium.org/g/chromium-dev/c/vAEeVifyf78/m/SkBUc6PhBAAJ Bug: 1272324, 1073933
This commit is contained in:
committed by
mkarolin
parent
e8a861cae3
commit
afafe0197b
@@ -13,6 +13,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/android/jni_weak_ref.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
|
||||
// namespace binance {
|
||||
@@ -98,7 +99,7 @@ class BinanceNativeWorker {
|
||||
std::vector<std::map<std::string, std::string>>>& args);
|
||||
|
||||
JavaObjectWeakGlobalRef weak_java_binance_native_worker_;
|
||||
BinanceService* binance_service_;
|
||||
raw_ptr<BinanceService> binance_service_ = nullptr;
|
||||
base::WeakPtrFactory<BinanceNativeWorker> weak_factory_;
|
||||
};
|
||||
} // namespace android
|
||||
|
||||
@@ -597,7 +597,7 @@ class BraveWalletProviderImplUnitTest : public testing::Test {
|
||||
|
||||
protected:
|
||||
content::BrowserTaskEnvironment browser_task_environment_;
|
||||
JsonRpcService* json_rpc_service_;
|
||||
raw_ptr<JsonRpcService> json_rpc_service_ = nullptr;
|
||||
raw_ptr<BraveWalletService> brave_wallet_service_ = nullptr;
|
||||
std::unique_ptr<TestEventsListener> observer_;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/test/bind.h"
|
||||
#include "brave/browser/brave_wallet/brave_wallet_service_factory.h"
|
||||
@@ -103,7 +104,7 @@ class WalletWatchAssetBrowserTest : public InProcessBrowserTest {
|
||||
}
|
||||
|
||||
protected:
|
||||
BraveWalletService* brave_wallet_service_;
|
||||
raw_ptr<BraveWalletService> brave_wallet_service_ = nullptr;
|
||||
std::vector<std::string> methods_{"request", "send1", "send2", "sendAsync"};
|
||||
std::vector<std::string> addresses_{
|
||||
"0x6B175474E89094C44Da98b954EedeAC495271d0F",
|
||||
@@ -115,7 +116,7 @@ class WalletWatchAssetBrowserTest : public InProcessBrowserTest {
|
||||
|
||||
private:
|
||||
net::test_server::EmbeddedTestServer https_server_;
|
||||
KeyringService* keyring_service_;
|
||||
raw_ptr<KeyringService> keyring_service_ = nullptr;
|
||||
};
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(WalletWatchAssetBrowserTest, UserApprovedRequest) {
|
||||
|
||||
@@ -62,7 +62,8 @@ class DomainBlockControllerClient
|
||||
const GURL request_url_;
|
||||
raw_ptr<AdBlockCustomFiltersService> ad_block_custom_filters_service_ =
|
||||
nullptr;
|
||||
ephemeral_storage::EphemeralStorageService* ephemeral_storage_service_;
|
||||
raw_ptr<ephemeral_storage::EphemeralStorageService>
|
||||
ephemeral_storage_service_ = nullptr;
|
||||
bool dont_warn_again_;
|
||||
|
||||
base::WeakPtrFactory<DomainBlockControllerClient> weak_ptr_factory_{this};
|
||||
|
||||
Reference in New Issue
Block a user