BraveWindowTracker is initialized in
BraveBrowserMainExtraParts::PreMainMessageLoopRun. It uses
base::ScopedObservation<BrowserCollection, BrowserCollectionObserver>,
which obseves browser collection which goes out of scope with
GlobalFeatures. BraveWindowTracker needs to stop observing before then.
Added HasInstance/ClearInstance to BraveWindowTracker modeling this
behavior on upstream's ChromeBrowserMainExtraPartsMetrics and
metrics::TabStatsTracker.
[33240:46492:0417/173936.000:ERROR:base\allocator\partition_alloc_support.cc:683] A freed allocation is still referenced by a dangling pointer at exit, or at test end. Leaked raw_ptr/raw_ref could cause PartitionAlloc's quarantine memory bloat.
Memory was released on:
brave_browser_tests!base::allocator::`anonymous namespace'::DanglingRawPtrDetected [0x7ff7130f09ee+3ee] (base\allocator\partition_alloc_support.cc:438)
brave_browser_tests!GlobalFeatures::~GlobalFeatures [0x7ff711aec13d+cd] (chrome\browser\global_features.cc:96)
brave_browser_tests!BraveGlobalFeatures::~BraveGlobalFeatures [0x7ff710d19780+10] (brave\browser\brave_global_features.cc:12)
brave_browser_tests!BrowserProcessImpl::~BrowserProcessImpl [0x7ff711b8ccb8+138] (chrome\browser\browser_process_impl.cc:565)
brave_browser_tests!BraveBrowserProcessImpl::~BraveBrowserProcessImpl [0x7ff711b46128+3c8] (brave\browser\brave_browser_process_impl.cc:142)
brave_browser_tests!BraveBrowserProcessImpl::~BraveBrowserProcessImpl [0x7ff711b47fa0+10] (brave\browser\brave_browser_process_impl.cc:142)
brave_browser_tests!ChromeBrowserMainParts_ChromiumImpl::PostDestroyThreads [0x7ff711b52658+168] (chrome\browser\chrome_browser_main.cc:2291)
brave_browser_tests!content::BrowserMainLoop::ShutdownThreadsAndCleanUp [0x7ff70d2638c7+7b7] (content\browser\browser_main_loop.cc:1282)
brave_browser_tests!content::BrowserMainRunnerImpl::Shutdown [0x7ff70d265b86+106] (content\browser\browser_main_runner_impl.cc:177)
ERROR:base\allocator\partition_alloc_support.cc:700] Dangling reference from:
ERROR:base\allocator\partition_alloc_support.cc:701] brave_browser_tests!partition_alloc::internal::base::debug::CollectStackTrace [0x7ff713271b82+12] (base\allocator\partition_allocator\src\partition_alloc\partition_alloc_base\debug\stack_trace_win.cc:103)
brave_browser_tests!base::internal::InstanceTracer::TraceImpl [0x7ff7132712ee+1fe] (base\allocator\partition_allocator\src\partition_alloc\pointers\instance_tracer.cc:66)
brave_browser_tests!base::ScopedObservation<brave_rewards::RewardsService,brave_rewards::RewardsServiceObserver,0>::Observe [0x7ff707af12d8+128] (base\scoped_observation.h:117)
brave_browser_tests!brave::BraveWindowTracker::BraveWindowTracker [0x7ff7119c682d+11d] (brave\browser\p3a\p3a_core_metrics.cc:60)
brave_browser_tests!brave::BraveWindowTracker::CreateInstance [0x7ff7119c6de1+21] (brave\browser\p3a\p3a_core_metrics.cc:71)
brave_browser_tests!BraveBrowserMainExtraParts::PreMainMessageLoopRun [0x7ff711a00915+185] (brave\browser\brave_browser_main_extra_parts.cc:104)
brave_browser_tests!ChromeBrowserMainParts_ChromiumImpl::PreMainMessageLoopRun [0x7ff711b4fd60+60] (chrome\browser\chrome_browser_main.cc:1465)
29 lines
1.1 KiB
C++
29 lines
1.1 KiB
C++
/* Copyright (c) 2019 The Brave Authors. All rights reserved.
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef BRAVE_BROWSER_BRAVE_BROWSER_MAIN_EXTRA_PARTS_H_
|
|
#define BRAVE_BROWSER_BRAVE_BROWSER_MAIN_EXTRA_PARTS_H_
|
|
|
|
#include "base/compiler_specific.h"
|
|
#include "chrome/browser/chrome_browser_main.h"
|
|
#include "chrome/browser/chrome_browser_main_extra_parts.h"
|
|
|
|
class BraveBrowserMainExtraParts : public ChromeBrowserMainExtraParts {
|
|
public:
|
|
BraveBrowserMainExtraParts();
|
|
BraveBrowserMainExtraParts(const BraveBrowserMainExtraParts&) = delete;
|
|
BraveBrowserMainExtraParts& operator=(const BraveBrowserMainExtraParts&) =
|
|
delete;
|
|
~BraveBrowserMainExtraParts() override;
|
|
|
|
// ChromeBrowserMainExtraParts overrides.
|
|
void PostBrowserStart() override;
|
|
void PreMainMessageLoopRun() override;
|
|
void PreProfileInit() override;
|
|
void PostDestroyThreads() override;
|
|
};
|
|
|
|
#endif // BRAVE_BROWSER_BRAVE_BROWSER_MAIN_EXTRA_PARTS_H_
|