summaryrefslogtreecommitdiff
path: root/chromium/components/heap_profiling
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-24 11:40:17 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-24 12:42:11 +0000
commit5d87695f37678f96492b258bbab36486c59866b4 (patch)
treebe9783bbaf04fb930c4d74ca9c00b5e7954c8bc6 /chromium/components/heap_profiling
parent6c11fb357ec39bf087b8b632e2b1e375aef1b38b (diff)
downloadqtwebengine-chromium-5d87695f37678f96492b258bbab36486c59866b4.tar.gz
BASELINE: Update Chromium to 75.0.3770.56
Change-Id: I86d2007fd27a45d5797eee06f4c9369b8b50ac4f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/components/heap_profiling')
-rw-r--r--chromium/components/heap_profiling/OWNERS1
-rw-r--r--chromium/components/heap_profiling/heap_profiling_test_shim.cc2
-rw-r--r--chromium/components/heap_profiling/heap_profiling_test_shim.h1
-rw-r--r--chromium/components/heap_profiling/javatests/src/org/chromium/components/heap_profiling/HeapProfilingTestShim.java8
-rw-r--r--chromium/components/heap_profiling/supervisor.cc35
-rw-r--r--chromium/components/heap_profiling/supervisor.h8
-rw-r--r--chromium/components/heap_profiling/test_driver.cc24
-rw-r--r--chromium/components/heap_profiling/test_driver.h9
8 files changed, 21 insertions, 67 deletions
diff --git a/chromium/components/heap_profiling/OWNERS b/chromium/components/heap_profiling/OWNERS
index 987c0c88a4a..9cc3a5e9cd2 100644
--- a/chromium/components/heap_profiling/OWNERS
+++ b/chromium/components/heap_profiling/OWNERS
@@ -1 +1,2 @@
+alph@chromium.org
erikchen@chromium.org
diff --git a/chromium/components/heap_profiling/heap_profiling_test_shim.cc b/chromium/components/heap_profiling/heap_profiling_test_shim.cc
index bae0523da62..5c952f05b43 100644
--- a/chromium/components/heap_profiling/heap_profiling_test_shim.cc
+++ b/chromium/components/heap_profiling/heap_profiling_test_shim.cc
@@ -32,7 +32,6 @@ jboolean HeapProfilingTestShim::RunTestForMode(
const base::android::JavaParamRef<jstring>& mode,
jboolean dynamically_start_profiling,
const base::android::JavaParamRef<jstring>& stack_mode,
- jboolean stream_samples,
jboolean should_sample,
jboolean sample_everything) {
heap_profiling::TestDriver driver;
@@ -42,7 +41,6 @@ jboolean HeapProfilingTestShim::RunTestForMode(
options.stack_mode = heap_profiling::ConvertStringToStackMode(
base::android::ConvertJavaStringToUTF8(stack_mode));
options.profiling_already_started = !dynamically_start_profiling;
- options.stream_samples = stream_samples;
options.should_sample = should_sample;
options.sample_everything = sample_everything;
return driver.RunTest(options);
diff --git a/chromium/components/heap_profiling/heap_profiling_test_shim.h b/chromium/components/heap_profiling/heap_profiling_test_shim.h
index 558933c99c8..134d548ed09 100644
--- a/chromium/components/heap_profiling/heap_profiling_test_shim.h
+++ b/chromium/components/heap_profiling/heap_profiling_test_shim.h
@@ -23,7 +23,6 @@ class HeapProfilingTestShim {
const base::android::JavaParamRef<jstring>& mode,
jboolean dynamically_start_profiling,
const base::android::JavaParamRef<jstring>& stack_mode,
- jboolean stream_samples,
jboolean should_sample,
jboolean sample_everything);
diff --git a/chromium/components/heap_profiling/javatests/src/org/chromium/components/heap_profiling/HeapProfilingTestShim.java b/chromium/components/heap_profiling/javatests/src/org/chromium/components/heap_profiling/HeapProfilingTestShim.java
index c7f788e5ee0..f55ceaf861a 100644
--- a/chromium/components/heap_profiling/javatests/src/org/chromium/components/heap_profiling/HeapProfilingTestShim.java
+++ b/chromium/components/heap_profiling/javatests/src/org/chromium/components/heap_profiling/HeapProfilingTestShim.java
@@ -23,9 +23,9 @@ public class HeapProfilingTestShim {
* rather than native stacks.
*/
public boolean runTestForMode(String mode, boolean dynamicallyStartProfiling, String stackMode,
- boolean streamSamples, boolean shouldSample, boolean sampleEverything) {
+ boolean shouldSample, boolean sampleEverything) {
return nativeRunTestForMode(mNativeHeapProfilingTestShim, mode, dynamicallyStartProfiling,
- stackMode, streamSamples, shouldSample, sampleEverything);
+ stackMode, shouldSample, sampleEverything);
}
/**
@@ -43,6 +43,6 @@ public class HeapProfilingTestShim {
private native long nativeInit();
private native void nativeDestroy(long nativeHeapProfilingTestShim);
private native boolean nativeRunTestForMode(long nativeHeapProfilingTestShim, String mode,
- boolean dynamicallyStartProfiling, String stackMode, boolean streamSamples,
- boolean shouldSample, boolean sampleEverything);
+ boolean dynamicallyStartProfiling, String stackMode, boolean shouldSample,
+ boolean sampleEverything);
}
diff --git a/chromium/components/heap_profiling/supervisor.cc b/chromium/components/heap_profiling/supervisor.cc
index 54d2ef0642f..8406aa786b3 100644
--- a/chromium/components/heap_profiling/supervisor.cc
+++ b/chromium/components/heap_profiling/supervisor.cc
@@ -60,26 +60,24 @@ void Supervisor::SetClientConnectionManagerConstructor(
void Supervisor::Start(content::ServiceManagerConnection* connection,
base::OnceClosure closure) {
- bool stream_samples = !IsInProcessModeEnabled();
Start(connection, GetModeForStartup(), GetStackModeForStartup(),
- stream_samples, GetSamplingRateForStartup(), std::move(closure));
+ GetSamplingRateForStartup(), std::move(closure));
}
void Supervisor::Start(content::ServiceManagerConnection* connection,
Mode mode,
mojom::StackMode stack_mode,
- bool stream_samples,
uint32_t sampling_rate,
base::OnceClosure closure) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK(!started_);
base::CreateSingleThreadTaskRunnerWithTraits({content::BrowserThread::IO})
- ->PostTask(FROM_HERE, base::BindOnce(&Supervisor::StartServiceOnIOThread,
- base::Unretained(this),
- connection->GetConnector()->Clone(),
- mode, stack_mode, stream_samples,
- sampling_rate, std::move(closure)));
+ ->PostTask(FROM_HERE,
+ base::BindOnce(&Supervisor::StartServiceOnIOThread,
+ base::Unretained(this),
+ connection->GetConnector()->Clone(), mode,
+ stack_mode, sampling_rate, std::move(closure)));
}
Mode Supervisor::GetMode() {
@@ -93,17 +91,6 @@ void Supervisor::StartManualProfiling(base::ProcessId pid) {
client_connection_manager_->StartProfilingProcess(pid);
}
-void Supervisor::SetKeepSmallAllocations(bool keep_small_allocations) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- DCHECK(HasStarted());
-
- base::CreateSingleThreadTaskRunnerWithTraits({content::BrowserThread::IO})
- ->PostTask(
- FROM_HERE,
- base::BindOnce(&Supervisor::SetKeepSmallAllocationsOnIOThread,
- base::Unretained(this), keep_small_allocations));
-}
-
void Supervisor::GetProfiledPids(GetProfiledPidsCallback callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK(HasStarted());
@@ -182,13 +169,12 @@ void Supervisor::StartServiceOnIOThread(
std::unique_ptr<service_manager::Connector> connector,
Mode mode,
mojom::StackMode stack_mode,
- bool stream_samples,
uint32_t sampling_rate,
base::OnceClosure closure) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- controller_.reset(new Controller(std::move(connector), stack_mode,
- stream_samples, sampling_rate));
+ controller_.reset(
+ new Controller(std::move(connector), stack_mode, sampling_rate));
base::WeakPtr<Controller> controller_weak_ptr = controller_->GetWeakPtr();
base::CreateSingleThreadTaskRunnerWithTraits({content::BrowserThread::UI})
@@ -232,9 +218,4 @@ void Supervisor::GetProfiledPidsOnIOThread(GetProfiledPidsCallback callback) {
controller_->GetProfiledPids(std::move(post_result_to_ui_thread));
}
-void Supervisor::SetKeepSmallAllocationsOnIOThread(
- bool keep_small_allocations) {
- controller_->SetKeepSmallAllocations(keep_small_allocations);
-}
-
} // namespace heap_profiling
diff --git a/chromium/components/heap_profiling/supervisor.h b/chromium/components/heap_profiling/supervisor.h
index 592b72e5829..4bd167caf02 100644
--- a/chromium/components/heap_profiling/supervisor.h
+++ b/chromium/components/heap_profiling/supervisor.h
@@ -72,7 +72,6 @@ class Supervisor {
void Start(content::ServiceManagerConnection* connection,
Mode mode,
mojom::StackMode stack_mode,
- bool stream_samples,
uint32_t sampling_rate,
base::OnceClosure callback);
@@ -81,10 +80,6 @@ class Supervisor {
// Starts profiling the process with the given id.
void StartManualProfiling(base::ProcessId pid);
- // Public for testing. Controls whether the profiling service keeps small
- // allocations in heap dumps.
- void SetKeepSmallAllocations(bool keep_small_allocations);
-
// Returns the pids of all profiled processes. The callback is posted on the
// UI thread.
using GetProfiledPidsCallback =
@@ -117,7 +112,6 @@ class Supervisor {
std::unique_ptr<service_manager::Connector> connector,
Mode mode,
mojom::StackMode stack_mode,
- bool stream_samples,
uint32_t sampling_rate,
base::OnceClosure callback);
@@ -129,8 +123,6 @@ class Supervisor {
void GetProfiledPidsOnIOThread(GetProfiledPidsCallback callback);
- void SetKeepSmallAllocationsOnIOThread(bool keep_small_allocations);
-
// Bound to the IO thread.
std::unique_ptr<Controller> controller_;
diff --git a/chromium/components/heap_profiling/test_driver.cc b/chromium/components/heap_profiling/test_driver.cc
index d8f146ec749..1bcedae2f18 100644
--- a/chromium/components/heap_profiling/test_driver.cc
+++ b/chromium/components/heap_profiling/test_driver.cc
@@ -591,7 +591,6 @@ bool TestDriver::RunTest(const Options& options) {
if (running_on_ui_thread_) {
if (!CheckOrStartProfilingOnUIThreadWithNestedRunLoops())
return false;
- Supervisor::GetInstance()->SetKeepSmallAllocations(true);
if (ShouldProfileRenderer())
WaitForProfilingToStartForAllRenderersUIThread();
if (ShouldProfileBrowser())
@@ -605,11 +604,6 @@ bool TestDriver::RunTest(const Options& options) {
wait_for_ui_thread_.Wait();
if (!initialization_success_)
return false;
- base::PostTaskWithTraits(
- FROM_HERE, {content::BrowserThread::UI},
- base::BindOnce(&TestDriver::SetKeepSmallAllocationsOnUIThreadAndSignal,
- base::Unretained(this)));
- wait_for_ui_thread_.Wait();
if (ShouldProfileRenderer()) {
base::PostTaskWithTraits(
FROM_HERE, {content::BrowserThread::UI},
@@ -667,12 +661,6 @@ void TestDriver::CheckOrStartProfilingOnUIThreadAndSignal() {
wait_for_ui_thread_.Signal();
}
-void TestDriver::SetKeepSmallAllocationsOnUIThreadAndSignal() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- Supervisor::GetInstance()->SetKeepSmallAllocations(true);
- wait_for_ui_thread_.Signal();
-}
-
bool TestDriver::CheckOrStartProfilingOnUIThreadWithAsyncSignalling() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
@@ -723,8 +711,8 @@ bool TestDriver::CheckOrStartProfilingOnUIThreadWithAsyncSignalling() {
? (options_.sample_everything ? 2 : kSampleRate)
: 1;
Supervisor::GetInstance()->Start(connection, options_.mode,
- options_.stack_mode, options_.stream_samples,
- sampling_rate, std::move(start_callback));
+ options_.stack_mode, sampling_rate,
+ std::move(start_callback));
return true;
}
@@ -776,8 +764,8 @@ bool TestDriver::CheckOrStartProfilingOnUIThreadWithNestedRunLoops() {
? (options_.sample_everything ? 2 : kSampleRate)
: 1;
Supervisor::GetInstance()->Start(connection, options_.mode,
- options_.stack_mode, options_.stream_samples,
- sampling_rate, std::move(start_callback));
+ options_.stack_mode, sampling_rate,
+ std::move(start_callback));
run_loop->Run();
@@ -789,6 +777,10 @@ void TestDriver::MakeTestAllocations() {
base::PlatformThread::SetName(kThreadName);
+ // Warm up the sampler. Once enabled it may need to see up to 1MB of
+ // allocations to start sampling.
+ leaks_.push_back(new char[base::PoissonAllocationSampler::kWarmupInterval]);
+
// In sampling mode, only sampling allocations are relevant.
if (!IsRecordingAllAllocations()) {
leaks_.reserve(kSamplingAllocCount);
diff --git a/chromium/components/heap_profiling/test_driver.h b/chromium/components/heap_profiling/test_driver.h
index 03e447b4e3a..ebf1363800e 100644
--- a/chromium/components/heap_profiling/test_driver.h
+++ b/chromium/components/heap_profiling/test_driver.h
@@ -49,11 +49,6 @@ class TestDriver {
// The stack profiling mode to test.
mojom::StackMode stack_mode = mojom::StackMode::NATIVE_WITHOUT_THREAD_NAMES;
- // Whether the client should stream samples as they are collected through
- // the provided pipe. When false the samples are accumulated on the client
- // side and can be retrieved later.
- bool stream_samples = true;
-
// Whether the caller has already started profiling with the given mode.
// When false, the test driver is responsible for starting profiling.
bool profiling_already_started = false;
@@ -87,10 +82,6 @@ class TestDriver {
// |RunInitializationOnUIThread|, and then signals |wait_for_ui_thread_|.
void CheckOrStartProfilingOnUIThreadAndSignal();
- // Calls Supervisor::SetKeepSmallAllocations() and then signals
- // |wait_for_ui_thread_|.
- void SetKeepSmallAllocationsOnUIThreadAndSignal();
-
// If profiling is expected to already be started, confirm it.
// Otherwise, start profiling with the given mode.
// This method must only be called on platforms that supported nested run