| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
std::optional<ProcessMemoryDumpOutcome> captured_outcome;Optional nit: while you're changing this, it could use TestFuture:
```
TestFuture<ProcessMemoryDumpOutcome, uint64_t,
std::unique_ptr<ProcessMemoryDump>> future;
mdb->CreateProcessDump(request_args, future.GetSequenceBoundCallback());
ASSERT_TRUE(future.Wait());
EXPECT_EQ(future.Get<uint64_t>(), test_guid);
return future.Get<ProcessMemoryDumpOutcome>();
```
run_loop.QuitClosure()));Optional nit: this could be simplified with TestFuture.
EXPECT_EQ(outcome, mojom::MemoryDumpRequestOutcome::kSuccess);Nit: this isn't needed because EXPECT_CALL already matches only `outcome == kSuccess`.
return captured_outcome.value();Optional nit: this could be simplified further with TestFuture.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,Nit: how about adding `kMemoryInstrumentationNotAvailable` to `outcome`, so this doesn't need to change?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Outdated Votes:
Code-Review+1 by Joe Mason (copy condition: "changekind:NO_CHANGE OR changekind:NO_CODE_CHANGE OR changekind:TRIVIAL_REBASE OR (has:unchanged-files AND **uploaderin:cria/project-chromium-committers**) OR is:MIN")
If I'm reading the bolded part (which was in the original message) the account you uploaded with isn't in chromium-committers for some reason?
Optional nit: while you're changing this, it could use TestFuture:
```
TestFuture<ProcessMemoryDumpOutcome, uint64_t,
std::unique_ptr<ProcessMemoryDump>> future;
mdb->CreateProcessDump(request_args, future.GetSequenceBoundCallback());
ASSERT_TRUE(future.Wait());
EXPECT_EQ(future.Get<uint64_t>(), test_guid);
return future.Get<ProcessMemoryDumpOutcome>();
```
Done
Optional nit: this could be simplified with TestFuture.
Done
memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,Nit: how about adding `kMemoryInstrumentationNotAvailable` to `outcome`, so this doesn't need to change?
I decided not to do that, because "memory instrumentation not available" is not an error that can be returned by the memory instrumentation service, it's only an error case that exists in this specific caller. I didn't want other call sites to have to handle this error, even tough it cannot happen for them.
EXPECT_EQ(outcome, mojom::MemoryDumpRequestOutcome::kSuccess);Nit: this isn't needed because EXPECT_CALL already matches only `outcome == kSuccess`.
Done
Optional nit: this could be simplified further with TestFuture.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
thakis@: Please review changes in //chrome and //third_party/blink/renderer/core/exported/web_media_player_impl_unittest.cc
wintermelons@: Please review changes in //fuchsia_web
alexmos@: Please review changes in //content.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
thakis@: Please review changes in //chrome and //third_party/blink/renderer/core/exported/web_media_player_impl_unittest.cc
wintermelons@: Please review changes in //fuchsia_web
alexmos@: Please review changes in //content
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Owners-Override | +1 |
In the future, let's just do one thing per CL? 😊
test::TestFuture<ProcessMemoryDumpOutcome, uint64_t,unrelated refactoring
base::test::TestFuture<base::trace_event::ProcessMemoryDumpOutcome, uint64_t,likewise
std::optional<memory_instrumentation::mojom::MemoryDumpRequestOutcome>If we're adding an enum, why not make "service not available" an enum entry instead of wrapping in an optional?
memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess) {especially in this file it'd be nice if this had a shorter name somehow 😄
int failed_memory_dump_count = 0;say in cl desc that you're removing the counter in addition to changing bool to enum
base::test::TestFuture<unrelated rewrite again
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
In the future, let's just do one thing per CL? 😊
ack, sorry about that
Thanks for the review!
test::TestFuture<ProcessMemoryDumpOutcome, uint64_t,Francois Pierre Dorayunrelated refactoring
Indeed, it's unrelated. It was suggested here https://chromium-review.googlesource.com/c/chromium/src/+/7029767/12#message-ac0dd336de03cafb00e0140a6d1ade46c0b68e1e and I decided it made sense to simplify the code as part of this CL. I'll keep it as-is to avoid extra churn on this CL.
base::test::TestFuture<base::trace_event::ProcessMemoryDumpOutcome, uint64_t,Francois Pierre Doraylikewise
same
std::optional<memory_instrumentation::mojom::MemoryDumpRequestOutcome>If we're adding an enum, why not make "service not available" an enum entry instead of wrapping in an optional?
"Service not available" is not an error that can be returned by the Memory Instrumentation service, it's an error case that only exists in MemoryDetails. I decided not to add it as an enum value so that other parts of the codebase don't have to handle this error case.
memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess) {especially in this file it'd be nice if this had a shorter name somehow 😄
I shortened the name in latest patch set
int failed_memory_dump_count = 0;say in cl desc that you're removing the counter in addition to changing bool to enum
Done
base::test::TestFuture<Francois Pierre Dorayunrelated rewrite again
same
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
12 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom
Insertions: 9, Deletions: 9.
@@ -64,8 +64,8 @@
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
-// LINT.IfChange(MemoryDumpRequestOutcome)
-enum MemoryDumpRequestOutcome {
+// LINT.IfChange(RequestOutcome)
+enum RequestOutcome {
// Dump was produced successfully.
kSuccess = 0,
// Periodic dump request was made with the same level of details as an already
@@ -90,7 +90,7 @@
// base::trace_event::MemoryDumpManager::CreateProcessDump failed.
kInProcessMemoryDumpFailed = 9,
};
-// LINT.ThenChange(/tools/metrics/histograms/metadata/memory/enums.xml:MemoryDumpRequestOutcome)
+// LINT.ThenChange(/tools/metrics/histograms/metadata/memory/enums.xml:RequestOutcome)
// These structs are internal only (only for the communication between
// the service and the ClientProcess library).
@@ -317,7 +317,7 @@
// buffer of the target process and an ACK. A summary of the dump is also
// returned in case of success.
RequestChromeMemoryDump(RequestArgs args)
- => (MemoryDumpRequestOutcome outcome,
+ => (RequestOutcome outcome,
uint64 dump_id,
RawProcessMemoryDump? raw_process_memory_dump);
@@ -339,7 +339,7 @@
MemoryMapOption option,
array<MemDumpFlags> flags,
array<mojo_base.mojom.ProcessId> pids)
- => (MemoryDumpRequestOutcome outcome, map<mojo_base.mojom.ProcessId, RawOSMemDump> dumps);
+ => (RequestOutcome outcome, map<mojo_base.mojom.ProcessId, RawOSMemDump> dumps);
};
struct HeapProfileResult {
@@ -396,26 +396,26 @@
LevelOfDetail level_of_detail,
Determinism determinism,
array<string> allocator_dump_names)
- => (MemoryDumpRequestOutcome outcome, GlobalMemoryDump? global_memory_dump);
+ => (RequestOutcome outcome, GlobalMemoryDump? global_memory_dump);
// Sends a dump request to the client process given by the specified pid and
// returns a summarized dump back or null if there was a failure.
RequestGlobalMemoryDumpForPid(
mojo_base.mojom.ProcessId pid, array<string> allocator_dump_names)
- => (MemoryDumpRequestOutcome outcome, GlobalMemoryDump? global_memory_dump);
+ => (RequestOutcome outcome, GlobalMemoryDump? global_memory_dump);
// Requesting a null pid is the same as requesting all pids.
// The returned dump only contains OS metrics. |chrome_allocator_dumps| will
// be empty.
RequestPrivateMemoryFootprint(mojo_base.mojom.ProcessId pid)
- => (MemoryDumpRequestOutcome outcome, GlobalMemoryDump? global_memory_dump);
+ => (RequestOutcome outcome, GlobalMemoryDump? global_memory_dump);
// Broadcasts a dump request to all registered client processes and injects
// the dump in the trace buffer (if tracing is enabled).
RequestGlobalMemoryDumpAndAppendToTrace(DumpType dump_type,
LevelOfDetail level_of_detail,
Determinism determinism)
- => (MemoryDumpRequestOutcome outcome, uint64 dump_id);
+ => (RequestOutcome outcome, uint64 dump_id);
};
// An interface used by client processes to register themselves with a
```
```
The name of the file: services/resource_coordinator/public/cpp/memory_instrumentation/client_process_impl.cc
Insertions: 6, Deletions: 8.
@@ -122,12 +122,11 @@
if (!process_memory_dump) {
// TODO(crbug.com/450929521): In practice, this never happens. Add a CHECK
// in a separate CL.
- std::move(callback).Run(
- mojom::MemoryDumpRequestOutcome::kInProcessMemoryDumpFailed, dump_guid,
- nullptr);
+ std::move(callback).Run(mojom::RequestOutcome::kInProcessMemoryDumpFailed,
+ dump_guid, nullptr);
return;
}
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess, dump_guid,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess, dump_guid,
std::move(process_memory_dump));
}
@@ -187,8 +186,7 @@
}
void ClientProcessImpl::PerformOSMemoryDump(OSMemoryDumpArgs args) {
- mojom::MemoryDumpRequestOutcome outcome =
- mojom::MemoryDumpRequestOutcome::kSuccess;
+ mojom::RequestOutcome outcome = mojom::RequestOutcome::kSuccess;
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
for (const base::ProcessId& pid : args.pids) {
auto handle = base::Process::Open(pid).Handle();
@@ -198,13 +196,13 @@
if (!OSMetrics::FillOSMemoryDump(handle, args.flags, result.get())) {
DLOG(ERROR) << "OS memory dump failed for pid " << pid
<< " (FillOSMemoryDump)";
- outcome = mojom::MemoryDumpRequestOutcome::kFillOsMemoryDumpFailed;
+ outcome = mojom::RequestOutcome::kFillOsMemoryDumpFailed;
} else if (args.mmap_option != mojom::MemoryMapOption::NONE &&
!OSMetrics::FillProcessMemoryMaps(handle, args.mmap_option,
result.get())) {
DLOG(ERROR) << "OS memory dump failed for pid " << pid
<< " (FillProcessMemoryMaps)";
- outcome = mojom::MemoryDumpRequestOutcome::kFillProcessMemoryMapsFailed;
+ outcome = mojom::RequestOutcome::kFillProcessMemoryMapsFailed;
} else {
results[pid] = std::move(result);
}
```
```
The name of the file: chrome/browser/task_manager/sampling/task_manager_impl.cc
Insertions: 1, Deletions: 1.
@@ -600,7 +600,7 @@
}
void TaskManagerImpl::OnReceivedMemoryDump(
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
std::unique_ptr<memory_instrumentation::GlobalMemoryDump> dump) {
waiting_for_memory_dump_ = false;
// We can ignore `outcome` as it is a coarse grained indicator of whether the
```
```
The name of the file: tools/metrics/histograms/metadata/memory/histograms.xml
Insertions: 1, Deletions: 1.
@@ -2079,7 +2079,7 @@
<summary>The memory size freed by each low memory kill event.</summary>
</histogram>
-<histogram name="Memory.MemoryDumpOutcome" enum="MemoryDumpRequestOutcome"
+<histogram name="Memory.MemoryDumpOutcome" enum="RequestOutcome"
expires_after="2026-04-12">
<owner>fdo...@chromium.org</owner>
<owner>catan...@chromium.org</owner>
```
```
The name of the file: components/performance_manager/resource_attribution/memory_measurement_delegate.cc
Insertions: 5, Deletions: 7.
@@ -48,10 +48,9 @@
base::OnceCallback<void(MemorySummaryMap)> callback) final;
private:
- void OnMemorySummary(
- base::OnceCallback<void(MemorySummaryMap)> callback,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
- std::unique_ptr<GlobalMemoryDump> memory_dump);
+ void OnMemorySummary(base::OnceCallback<void(MemorySummaryMap)> callback,
+ memory_instrumentation::mojom::RequestOutcome outcome,
+ std::unique_ptr<GlobalMemoryDump> memory_dump);
raw_ptr<GraphImpl> graph_impl_;
base::WeakPtrFactory<MemoryMeasurementDelegateImpl> weak_factory_{this};
@@ -77,10 +76,9 @@
void MemoryMeasurementDelegateImpl::OnMemorySummary(
base::OnceCallback<void(MemorySummaryMap)> callback,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
std::unique_ptr<GlobalMemoryDump> memory_dump) {
- if (outcome !=
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess) {
+ if (outcome != memory_instrumentation::mojom::RequestOutcome::kSuccess) {
std::move(callback).Run(CreateMemorySummaryMap());
return;
}
```
```
The name of the file: content/browser/tracing/memory_instrumentation_browsertest.cc
Insertions: 4, Deletions: 5.
@@ -51,14 +51,13 @@
base::GetCurrentProcId(),
base::BindOnce(
[](base::OnceClosure quit_closure, uint64_t* private_footprint_kb,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome
- outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
std::unique_ptr<GlobalMemoryDump> result) {
// The global dump should only contain the current process
// (browser).
- EXPECT_EQ(memory_instrumentation::mojom::
- MemoryDumpRequestOutcome::kSuccess,
- outcome);
+ EXPECT_EQ(
+ memory_instrumentation::mojom::RequestOutcome::kSuccess,
+ outcome);
ASSERT_EQ(std::distance(result->process_dumps().begin(),
result->process_dumps().end()),
1);
```
```
The name of the file: content/browser/tracing/memory_tracing_browsertest.cc
Insertions: 16, Deletions: 62.
@@ -35,6 +35,7 @@
using base::trace_event::MemoryDumpManager;
using base::trace_event::MemoryDumpType;
using base::trace_event::ProcessMemoryDump;
+using memory_instrumentation::mojom::RequestOutcome;
using testing::_;
using testing::Return;
@@ -55,7 +56,7 @@
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
base::OnceClosure closure,
uint32_t request_index,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ RequestOutcome outcome,
uint64_t dump_guid) {
// Make sure we run the RunLoop closure on the same thread that originated
// the run loop (which is the IN_PROC_BROWSER_TEST_F main thread).
@@ -67,8 +68,7 @@
dump_guid));
return;
}
- if (outcome ==
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess) {
+ if (outcome == RequestOutcome::kSuccess) {
EXPECT_NE(0u, dump_guid);
}
OnMemoryDumpDone(request_index, outcome);
@@ -174,10 +174,8 @@
EXPECT_TRUE(NavigateToURL(shell, GetTestUrl("", "title1.html")));
}
- MOCK_METHOD2(
- OnMemoryDumpDone,
- void(uint32_t request_index,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome));
+ MOCK_METHOD2(OnMemoryDumpDone,
+ void(uint32_t request_index, RequestOutcome outcome));
std::unique_ptr<MockDumpProvider> mock_dump_provider_;
uint32_t next_request_index_;
@@ -211,11 +209,7 @@
Navigate(shell());
EXPECT_CALL(*mock_dump_provider_, OnMemoryDump(_,_)).WillOnce(Return(true));
- EXPECT_CALL(
- *this,
- OnMemoryDumpDone(
- _,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess));
+ EXPECT_CALL(*this, OnMemoryDumpDone(_, RequestOutcome::kSuccess));
EnableMemoryTracing();
RequestGlobalDumpAndWait(false /* from_renderer_thread */,
@@ -238,11 +232,7 @@
Navigate(shell());
EXPECT_CALL(*mock_dump_provider_, OnMemoryDump(_,_)).WillOnce(Return(true));
- EXPECT_CALL(
- *this,
- OnMemoryDumpDone(
- _,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess));
+ EXPECT_CALL(*this, OnMemoryDumpDone(_, RequestOutcome::kSuccess));
EnableMemoryTracing();
RequestGlobalDumpAndWait(true /* from_renderer_thread */,
@@ -264,11 +254,7 @@
EXPECT_CALL(*mock_dump_provider_, OnMemoryDump(_,_))
.Times(4)
.WillRepeatedly(Return(true));
- EXPECT_CALL(
- *this,
- OnMemoryDumpDone(
- _, memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess))
- .Times(4);
+ EXPECT_CALL(*this, OnMemoryDumpDone(_, RequestOutcome::kSuccess)).Times(4);
EnableMemoryTracing();
RequestGlobalDumpAndWait(true /* from_renderer_thread */,
@@ -312,69 +298,41 @@
.Times(5)
.WillRepeatedly(Return(true));
- EXPECT_CALL(
- *this,
- OnMemoryDumpDone(
- 0,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess));
+ EXPECT_CALL(*this, OnMemoryDumpDone(0, RequestOutcome::kSuccess));
RequestGlobalDump(true /* from_renderer_thread */,
MemoryDumpType::kExplicitlyTriggered,
MemoryDumpLevelOfDetail::kDetailed);
// This dump should fail immediately because there's already a detailed dump
// request in the queue.
- EXPECT_CALL(
- *this,
- OnMemoryDumpDone(
- 1,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kRedundant));
+ EXPECT_CALL(*this, OnMemoryDumpDone(1, RequestOutcome::kRedundant));
RequestGlobalDump(true /* from_renderer_thread */,
MemoryDumpType::kPeriodicInterval,
MemoryDumpLevelOfDetail::kDetailed);
- EXPECT_CALL(
- *this,
- OnMemoryDumpDone(
- 2,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess));
+ EXPECT_CALL(*this, OnMemoryDumpDone(2, RequestOutcome::kSuccess));
RequestGlobalDump(true /* from_renderer_thread */,
MemoryDumpType::kPeriodicInterval,
MemoryDumpLevelOfDetail::kLight);
// This dump should fail immediately because there's already a light dump
// request in the queue.
- EXPECT_CALL(
- *this,
- OnMemoryDumpDone(
- 3,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kRedundant));
+ EXPECT_CALL(*this, OnMemoryDumpDone(3, RequestOutcome::kRedundant));
RequestGlobalDump(true /* from_renderer_thread */,
MemoryDumpType::kPeriodicInterval,
MemoryDumpLevelOfDetail::kLight);
- EXPECT_CALL(
- *this,
- OnMemoryDumpDone(
- 4,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess));
+ EXPECT_CALL(*this, OnMemoryDumpDone(4, RequestOutcome::kSuccess));
RequestGlobalDump(true /* from_renderer_thread */,
MemoryDumpType::kExplicitlyTriggered,
MemoryDumpLevelOfDetail::kLight);
- EXPECT_CALL(
- *this,
- OnMemoryDumpDone(
- 5,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess));
+ EXPECT_CALL(*this, OnMemoryDumpDone(5, RequestOutcome::kSuccess));
RequestGlobalDumpAndWait(true /* from_renderer_thread */,
MemoryDumpType::kExplicitlyTriggered,
MemoryDumpLevelOfDetail::kDetailed);
- EXPECT_CALL(
- *this,
- OnMemoryDumpDone(
- 6,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess));
+ EXPECT_CALL(*this, OnMemoryDumpDone(6, RequestOutcome::kSuccess));
RequestGlobalDumpAndWait(true /* from_renderer_thread */,
MemoryDumpType::kPeriodicInterval,
MemoryDumpLevelOfDetail::kLight);
@@ -407,11 +365,7 @@
// crbug.com/709524. The test still tests if dumping does not crash.
EXPECT_CALL(*this, OnMemoryDumpDone(_, _));
#else
- EXPECT_CALL(
- *this,
- OnMemoryDumpDone(
- _,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess));
+ EXPECT_CALL(*this, OnMemoryDumpDone(_, RequestOutcome::kSuccess));
#endif
EnableMemoryTracing();
```
```
The name of the file: chrome/browser/memory_details.cc
Insertions: 3, Deletions: 5.
@@ -356,7 +356,7 @@
base::kNullProcessId,
base::BindOnce(
[](scoped_refptr<MemoryDetails> details,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
std::unique_ptr<memory_instrumentation::GlobalMemoryDump>
global_dump) {
details->DidReceiveMemoryDump(outcome, std::move(global_dump));
@@ -368,12 +368,10 @@
}
void MemoryDetails::DidReceiveMemoryDump(
- std::optional<memory_instrumentation::mojom::MemoryDumpRequestOutcome>
- outcome,
+ std::optional<memory_instrumentation::mojom::RequestOutcome> outcome,
std::unique_ptr<memory_instrumentation::GlobalMemoryDump> global_dump) {
ProcessData* const chrome_browser = ChromeBrowser();
- if (outcome ==
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess) {
+ if (outcome == memory_instrumentation::mojom::RequestOutcome::kSuccess) {
for (const memory_instrumentation::GlobalMemoryDump::ProcessDump& dump :
global_dump->process_dumps()) {
base::ProcessId dump_pid = dump.pid();
```
```
The name of the file: components/heap_profiling/multi_process/supervisor.cc
Insertions: 2, Deletions: 2.
@@ -142,7 +142,7 @@
auto finished_dump_callback = base::BindOnce(
[](TraceFinishedCallback callback, bool anonymize,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
uint64_t dump_guid) {
// Once the trace has stopped, run |callback| on the UI thread.
auto finish_sink_callback = base::BindOnce(
@@ -166,7 +166,7 @@
auto trigger_memory_dump_callback = base::BindOnce(
[](base::OnceCallback<void(
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
uint64_t dump_guid)> finished_dump_callback) {
memory_instrumentation::MemoryInstrumentation::GetInstance()
->RequestGlobalDumpAndAppendToTrace(
```
```
The name of the file: components/no_state_prefetch/browser/no_state_prefetch_contents.h
Insertions: 1, Deletions: 1.
@@ -241,7 +241,7 @@
// Returns the ProcessMetrics for the render process, if it exists.
void DidGetMemoryUsage(
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
std::unique_ptr<memory_instrumentation::GlobalMemoryDump> dump);
// Sets PreloadingFailureReason based on status corresponding to the
```
```
The name of the file: chrome/test/base/memory_tracing_browsertest.cc
Insertions: 1, Deletions: 1.
@@ -34,7 +34,7 @@
void RequestGlobalDumpCallback(
base::OnceClosure quit_closure,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
uint64_t) {
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
FROM_HERE, std::move(quit_closure));
```
```
The name of the file: services/resource_coordinator/memory_instrumentation/queued_request_dispatcher.h
Insertions: 2, Deletions: 2.
@@ -29,11 +29,11 @@
void(bool, uint64_t, memory_instrumentation::mojom::GlobalMemoryDumpPtr)>;
using ChromeCallback = base::RepeatingCallback<void(
base::ProcessId,
- mojom::MemoryDumpRequestOutcome,
+ mojom::RequestOutcome,
uint64_t,
std::unique_ptr<base::trace_event::ProcessMemoryDump>)>;
using OsCallback = base::RepeatingCallback<
- void(base::ProcessId, mojom::MemoryDumpRequestOutcome, OSMemDumpMap)>;
+ void(base::ProcessId, mojom::RequestOutcome, OSMemDumpMap)>;
using VmRegions =
base::flat_map<base::ProcessId,
std::vector<memory_instrumentation::mojom::VmRegionPtr>>;
```
```
The name of the file: tools/metrics/histograms/metadata/memory/enums.xml
Insertions: 9, Deletions: 9.
@@ -47,9 +47,15 @@
<int value="2" label="kSuccess"/>
</enum>
-<!-- LINT.IfChange(MemoryDumpRequestOutcome) -->
+<enum name="MemoryPressureLevel">
+ <int value="0" label="No memory pressure"/>
+ <int value="1" label="Moderate memory pressure"/>
+ <int value="2" label="Critical memory pressure"/>
+</enum>
-<enum name="MemoryDumpRequestOutcome">
+<!-- LINT.IfChange(RequestOutcome) -->
+
+<enum name="RequestOutcome">
<int value="0" label="Success"/>
<int value="1"
label="Periodic dump request was made with the same level of details as
@@ -70,13 +76,7 @@
label="base::trace_event::MemoryDumpManager::CreateProcessDump failed"/>
</enum>
-<!-- LINT.ThenChange(//services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom:MemoryDumpRequestOutcome) -->
-
-<enum name="MemoryPressureLevel">
- <int value="0" label="No memory pressure"/>
- <int value="1" label="Moderate memory pressure"/>
- <int value="2" label="Critical memory pressure"/>
-</enum>
+<!-- LINT.ThenChange(//services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom:RequestOutcome) -->
<enum name="SelfCompactionCancellationReason">
<int value="0" label="Frozen by App Freezer"/>
```
```
The name of the file: chrome/browser/task_manager/sampling/task_manager_impl.h
Insertions: 1, Deletions: 1.
@@ -126,7 +126,7 @@
void OnVideoMemoryUsageStatsUpdate(
const gpu::VideoMemoryUsageStats& gpu_memory_stats);
void OnReceivedMemoryDump(
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
std::unique_ptr<memory_instrumentation::GlobalMemoryDump> dump);
// task_manager::TaskManagerInterface:
```
```
The name of the file: chrome/browser/metrics/process_memory_metrics_emitter.cc
Insertions: 2, Deletions: 3.
@@ -1381,13 +1381,12 @@
void ProcessMemoryMetricsEmitter::ReceivedMemoryDump(
absl::flat_hash_map<base::ProcessId, ProcessInfo> process_infos,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
std::unique_ptr<GlobalMemoryDump> dump) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
base::UmaHistogramEnumeration("Memory.MemoryDumpOutcome", outcome);
- if (outcome !=
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess) {
+ if (outcome != memory_instrumentation::mojom::RequestOutcome::kSuccess) {
return;
}
```
```
The name of the file: services/resource_coordinator/memory_instrumentation/queued_request_dispatcher.cc
Insertions: 6, Deletions: 8.
@@ -186,7 +186,7 @@
base::trace_event::MemoryDumpLevelOfDetailToString(
request->args.level_of_detail));
- request->outcome = mojom::MemoryDumpRequestOutcome::kSuccess;
+ request->outcome = mojom::RequestOutcome::kSuccess;
// Note: the service process itself is registered as a ClientProcess and
// will be treated like any other process for the sake of memory dumps.
@@ -272,7 +272,7 @@
request->pending_responses.empty()) {
DLOG(ERROR) << "Memory dump request failed due to missing pid "
<< request->args.pid;
- request->outcome = mojom::MemoryDumpRequestOutcome::kProcessNotFound;
+ request->outcome = mojom::RequestOutcome::kProcessNotFound;
return;
}
}
@@ -502,8 +502,7 @@
DLOG(ERROR) << "Tracing is disabled or not setup yet while receiving "
"OS dump for pid "
<< pid;
- request->outcome =
- mojom::MemoryDumpRequestOutcome::kInvalidTracingState;
+ request->outcome = mojom::RequestOutcome::kInvalidTracingState;
}
}
@@ -515,8 +514,7 @@
DLOG(ERROR) << "Tracing is disabled or not setup yet while receiving "
"Chrome dump for pid "
<< pid;
- request->outcome =
- mojom::MemoryDumpRequestOutcome::kInvalidTracingState;
+ request->outcome = mojom::RequestOutcome::kInvalidTracingState;
}
}
}
@@ -574,7 +572,7 @@
// In the single process-case, we want to ensure that global_success
// is true if and only if global_dump is not nullptr.
if (request->args.pid != base::kNullProcessId &&
- request->outcome != mojom::MemoryDumpRequestOutcome::kSuccess) {
+ request->outcome != mojom::RequestOutcome::kSuccess) {
global_dump = nullptr;
}
auto& callback = request->callback;
@@ -586,7 +584,7 @@
TRACE_EVENT_NESTABLE_ASYNC_END2(
base::trace_event::MemoryDumpManager::kTraceCategory, "GlobalMemoryDump",
TRACE_ID_LOCAL(request->dump_guid), "dump_guid", TRACE_STR_COPY(guid_str),
- "success", request->outcome == mojom::MemoryDumpRequestOutcome::kSuccess);
+ "success", request->outcome == mojom::RequestOutcome::kSuccess);
}
bool QueuedRequestDispatcher::AddChromeMemoryDumpToTrace(
```
```
The name of the file: services/resource_coordinator/memory_instrumentation/queued_request.h
Insertions: 2, Deletions: 3.
@@ -30,7 +30,7 @@
// Holds data for pending requests enqueued via RequestGlobalMemoryDump().
struct QueuedRequest {
using RequestGlobalMemoryDumpInternalCallback = base::OnceCallback<void(
- mojom::MemoryDumpRequestOutcome,
+ mojom::RequestOutcome,
uint64_t,
memory_instrumentation::mojom::GlobalMemoryDumpPtr)>;
@@ -115,8 +115,7 @@
// The request's outcome up to now. This is updated whenever an error is
// encountered as part of fulfilling the request. If multiple errors occur,
// this will only represent the last encountered error.
- mojom::MemoryDumpRequestOutcome outcome =
- mojom::MemoryDumpRequestOutcome::kSuccess;
+ mojom::RequestOutcome outcome = mojom::RequestOutcome::kSuccess;
bool dump_in_progress = false;
// This field is set to |true| before a heap dump is requested, and set to
```
```
The name of the file: fuchsia_web/webengine/browser/web_engine_memory_inspector.h
Insertions: 1, Deletions: 1.
@@ -39,7 +39,7 @@
void OnMemoryDumpComplete(
base::TimeTicks requested_at,
fpromise::suspended_task task,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
memory_instrumentation::mojom::GlobalMemoryDumpPtr raw_dump);
// Node holding memory usage information.
```
```
The name of the file: services/resource_coordinator/public/cpp/memory_instrumentation/memory_instrumentation.h
Insertions: 2, Deletions: 3.
@@ -26,11 +26,10 @@
using MemoryDumpLevelOfDetail = base::trace_event::MemoryDumpLevelOfDetail;
using MemoryDumpDeterminism = base::trace_event::MemoryDumpDeterminism;
using RequestGlobalDumpCallback =
- base::OnceCallback<void(mojom::MemoryDumpRequestOutcome outcome,
+ base::OnceCallback<void(mojom::RequestOutcome outcome,
std::unique_ptr<GlobalMemoryDump> dump)>;
using RequestGlobalMemoryDumpAndAppendToTraceCallback =
- base::OnceCallback<void(mojom::MemoryDumpRequestOutcome outcome,
- uint64_t dump_id)>;
+ base::OnceCallback<void(mojom::RequestOutcome outcome, uint64_t dump_id)>;
static void CreateInstance(
mojo::PendingRemote<memory_instrumentation::mojom::Coordinator>
```
```
The name of the file: services/resource_coordinator/public/cpp/memory_instrumentation/memory_instrumentation.cc
Insertions: 1, Deletions: 1.
@@ -16,7 +16,7 @@
void WrapGlobalMemoryDump(
MemoryInstrumentation::RequestGlobalDumpCallback callback,
- mojom::MemoryDumpRequestOutcome outcome,
+ mojom::RequestOutcome outcome,
mojom::GlobalMemoryDumpPtr dump) {
std::move(callback).Run(outcome, GlobalMemoryDump::MoveFrom(std::move(dump)));
}
```
```
The name of the file: chrome/browser/metrics/process_memory_metrics_emitter.h
Insertions: 1, Deletions: 1.
@@ -61,7 +61,7 @@
// performance_manager for each process.
virtual void ReceivedMemoryDump(
absl::flat_hash_map<base::ProcessId, ProcessInfo> process_infos,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
std::unique_ptr<memory_instrumentation::GlobalMemoryDump> dump);
// Virtual for testing. Gets info about each process from performance_manager.
```
```
The name of the file: content/browser/devtools/protocol/tracing_handler.cc
Insertions: 2, Deletions: 3.
@@ -1031,12 +1031,11 @@
void TracingHandler::OnMemoryDumpFinished(
std::unique_ptr<RequestMemoryDumpCallback> callback,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
uint64_t dump_id) {
callback->sendSuccess(
base::StringPrintf("0x%" PRIx64, dump_id),
- outcome ==
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess);
+ outcome == memory_instrumentation::mojom::RequestOutcome::kSuccess);
}
void TracingHandler::OnFrameFromVideoConsumer(
```
```
The name of the file: services/resource_coordinator/public/cpp/memory_instrumentation/tracing_integration_unittest.cc
Insertions: 11, Deletions: 11.
@@ -178,7 +178,7 @@
// Blocks the current thread (spinning a nested message loop) until the
// memory dump is complete. Returns:
// - return value: the |outcome| from the RequestChromeMemoryDump() callback.
- mojom::MemoryDumpRequestOutcome RequestChromeDumpAndWait(
+ mojom::RequestOutcome RequestChromeDumpAndWait(
MemoryDumpType dump_type,
MemoryDumpLevelOfDetail level_of_detail,
std::unique_ptr<base::trace_event::ProcessMemoryDump>* result = nullptr) {
@@ -186,7 +186,7 @@
MemoryDumpRequestArgs request_args{req_guid, dump_type, level_of_detail};
base::test::TestFuture<
- mojom::MemoryDumpRequestOutcome, uint64_t,
+ mojom::RequestOutcome, uint64_t,
std::unique_ptr<base::trace_event::ProcessMemoryDump>>
future;
client_process_->RequestChromeMemoryDump(request_args,
@@ -200,7 +200,7 @@
tuple));
}
- return std::get<mojom::MemoryDumpRequestOutcome>(tuple);
+ return std::get<mojom::RequestOutcome>(tuple);
}
void RequestChromeDump(MemoryDumpType dump_type,
@@ -264,7 +264,7 @@
const std::vector<std::string>& allocator_dump_names,
RequestGlobalMemoryDumpCallback callback) {
client_->RequestChromeDump(dump_type, level_of_detail, determinism);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
mojom::GlobalMemoryDumpPtr());
}
@@ -274,7 +274,7 @@
MemoryDumpDeterminism determinism,
RequestGlobalMemoryDumpAndAppendToTraceCallback callback) {
client_->RequestChromeDump(dump_type, level_of_detail, determinism);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess, true);
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess, true);
}
// Checks that is the ClientProcessImpl is initialized after tracing already
@@ -292,7 +292,7 @@
MockMemoryDumpProvider mdp;
RegisterDumpProvider(&mdp, nullptr, MemoryDumpProvider::Options());
EXPECT_CALL(mdp, OnMemoryDump(_, _)).Times(1);
- EXPECT_EQ(mojom::MemoryDumpRequestOutcome::kSuccess,
+ EXPECT_EQ(mojom::RequestOutcome::kSuccess,
RequestChromeDumpAndWait(MemoryDumpType::kExplicitlyTriggered,
MemoryDumpLevelOfDetail::kDetailed));
DisableTracing();
@@ -335,12 +335,12 @@
// When requesting non-BACKGROUND dumps the MDP will be invoked.
EXPECT_CALL(*mdp, OnMemoryDump(IsLightDump(), _));
- EXPECT_EQ(mojom::MemoryDumpRequestOutcome::kSuccess,
+ EXPECT_EQ(mojom::RequestOutcome::kSuccess,
RequestChromeDumpAndWait(MemoryDumpType::kExplicitlyTriggered,
MemoryDumpLevelOfDetail::kLight));
EXPECT_CALL(*mdp, OnMemoryDump(IsDetailedDump(), _));
- EXPECT_EQ(mojom::MemoryDumpRequestOutcome::kSuccess,
+ EXPECT_EQ(mojom::RequestOutcome::kSuccess,
RequestChromeDumpAndWait(MemoryDumpType::kExplicitlyTriggered,
MemoryDumpLevelOfDetail::kDetailed));
@@ -470,7 +470,7 @@
EnableMemoryInfraTracing();
EXPECT_FALSE(IsPeriodicDumpingEnabled());
- EXPECT_EQ(mojom::MemoryDumpRequestOutcome::kSuccess,
+ EXPECT_EQ(mojom::RequestOutcome::kSuccess,
RequestChromeDumpAndWait(MemoryDumpType::kExplicitlyTriggered,
MemoryDumpLevelOfDetail::kBackground));
DisableTracing();
@@ -509,7 +509,7 @@
run_loop.QuitClosure()));
run_loop.Run();
- EXPECT_EQ(mojom::MemoryDumpRequestOutcome::kSuccess,
+ EXPECT_EQ(mojom::RequestOutcome::kSuccess,
RequestChromeDumpAndWait(MemoryDumpType::kExplicitlyTriggered,
MemoryDumpLevelOfDetail::kDetailed));
DisableTracing();
@@ -523,7 +523,7 @@
// after having checked that the MDP is valid and having decided to invoke it.
TraceLog::GetInstance()->SetEnabled(TraceConfig(
kMemoryInfraTracingOnly, base::trace_event::RECORD_CONTINUOUSLY));
- EXPECT_EQ(mojom::MemoryDumpRequestOutcome::kSuccess,
+ EXPECT_EQ(mojom::RequestOutcome::kSuccess,
RequestChromeDumpAndWait(MemoryDumpType::kExplicitlyTriggered,
MemoryDumpLevelOfDetail::kDetailed));
DisableTracing();
```
```
The name of the file: android_webview/browser/metrics/memory_metrics_logger.cc
Insertions: 2, Deletions: 3.
@@ -27,10 +27,9 @@
// Called once the metrics have been determined. Does the actual logging.
void RecordMemoryMetricsImpl(
MemoryMetricsLogger::RecordCallback done_callback,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
std::unique_ptr<memory_instrumentation::GlobalMemoryDump> dump) {
- if (outcome !=
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess) {
+ if (outcome != memory_instrumentation::mojom::RequestOutcome::kSuccess) {
if (done_callback) {
std::move(done_callback).Run(false);
}
```
```
The name of the file: fuchsia_web/webengine/browser/web_engine_memory_inspector.cc
Insertions: 2, Deletions: 3.
@@ -149,15 +149,14 @@
void WebEngineMemoryInspector::OnMemoryDumpComplete(
base::TimeTicks requested_at,
fpromise::suspended_task task,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
memory_instrumentation::mojom::GlobalMemoryDumpPtr raw_dump) {
DCHECK(!dump_results_);
dump_results_ = std::make_unique<inspect::Inspector>();
// If capture failed then there is no data to report.
- if (outcome !=
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess ||
+ if (outcome != memory_instrumentation::mojom::RequestOutcome::kSuccess ||
!raw_dump) {
task.resume_task();
return;
```
```
The name of the file: services/resource_coordinator/memory_instrumentation/coordinator_impl.cc
Insertions: 19, Deletions: 21.
@@ -121,7 +121,7 @@
RequestGlobalMemoryDumpCallback callback) {
// This merely strips out the |dump_guid| argument.
auto adapter = [](RequestGlobalMemoryDumpCallback callback,
- mojom::MemoryDumpRequestOutcome outcome, uint64_t,
+ mojom::RequestOutcome outcome, uint64_t,
mojom::GlobalMemoryDumpPtr global_memory_dump) {
std::move(callback).Run(outcome, std::move(global_memory_dump));
};
@@ -141,14 +141,14 @@
// Error out early if process id is null to avoid confusing with global
// dump for all processes case when pid is kNullProcessId.
if (pid == base::kNullProcessId) {
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kNullPid, nullptr);
+ std::move(callback).Run(mojom::RequestOutcome::kNullPid, nullptr);
return;
}
// This merely strips out the |dump_guid| argument; this is not relevant
// as we are not adding to trace.
auto adapter = [](RequestGlobalMemoryDumpForPidCallback callback,
- mojom::MemoryDumpRequestOutcome outcome, uint64_t,
+ mojom::RequestOutcome outcome, uint64_t,
mojom::GlobalMemoryDumpPtr global_memory_dump) {
std::move(callback).Run(outcome, std::move(global_memory_dump));
};
@@ -169,7 +169,7 @@
// This merely strips out the |dump_guid| argument; this is not relevant
// as we are not adding to trace.
auto adapter = [](RequestPrivateMemoryFootprintCallback callback,
- mojom::MemoryDumpRequestOutcome outcome, uint64_t,
+ mojom::RequestOutcome outcome, uint64_t,
mojom::GlobalMemoryDumpPtr global_memory_dump) {
std::move(callback).Run(outcome, std::move(global_memory_dump));
};
@@ -190,7 +190,7 @@
RequestGlobalMemoryDumpAndAppendToTraceCallback callback) {
// This merely strips out the |dump_ptr| argument.
auto adapter = [](RequestGlobalMemoryDumpAndAppendToTraceCallback callback,
- mojom::MemoryDumpRequestOutcome outcome, uint64_t dump_guid,
+ mojom::RequestOutcome outcome, uint64_t dump_guid,
mojom::GlobalMemoryDumpPtr) {
std::move(callback).Run(outcome, dump_guid);
};
@@ -246,7 +246,7 @@
DLOG(ERROR)
<< "Memory dump request failed due to disconnected child process "
<< process_id;
- request->outcome = mojom::MemoryDumpRequestOutcome::kProcessUnregistered;
+ request->outcome = mojom::RequestOutcome::kProcessUnregistered;
}
FinalizeGlobalMemoryDumpIfAllManagersReplied();
}
@@ -298,7 +298,7 @@
<< base::trace_event::MemoryDumpLevelOfDetailToString(
args.level_of_detail)
<< ") is already in the queue";
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kRedundant,
+ std::move(callback).Run(mojom::RequestOutcome::kRedundant,
0 /* dump_guid */,
nullptr /* global_memory_dump */);
return;
@@ -333,7 +333,7 @@
DLOG(ERROR) << "Global dump request timed out waiting for "
<< request->pending_responses.size() << " requests";
}
- request->outcome = mojom::MemoryDumpRequestOutcome::kTimeout;
+ request->outcome = mojom::RequestOutcome::kTimeout;
request->pending_responses.clear();
// Callback the consumer of the service.
@@ -422,7 +422,7 @@
void CoordinatorImpl::OnChromeMemoryDumpResponse(
base::ProcessId process_id,
- mojom::MemoryDumpRequestOutcome outcome,
+ mojom::RequestOutcome outcome,
uint64_t dump_guid,
std::unique_ptr<base::trace_event::ProcessMemoryDump> chrome_memory_dump) {
using ResponseType = QueuedRequest::PendingResponse::Type;
@@ -442,7 +442,7 @@
auto* response = &request->responses[process_id];
response->chrome_dump = std::move(chrome_memory_dump);
- if (outcome != mojom::MemoryDumpRequestOutcome::kSuccess) {
+ if (outcome != mojom::RequestOutcome::kSuccess) {
DLOG(ERROR) << "Memory dump request failed: NACK from client process";
request->outcome = outcome;
}
@@ -450,11 +450,10 @@
FinalizeGlobalMemoryDumpIfAllManagersReplied();
}
-void CoordinatorImpl::OnOSMemoryDumpResponse(
- uint64_t dump_guid,
- base::ProcessId process_id,
- mojom::MemoryDumpRequestOutcome outcome,
- OSMemDumpMap os_dumps) {
+void CoordinatorImpl::OnOSMemoryDumpResponse(uint64_t dump_guid,
+ base::ProcessId process_id,
+ mojom::RequestOutcome outcome,
+ OSMemDumpMap os_dumps) {
using ResponseType = QueuedRequest::PendingResponse::Type;
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
QueuedRequest* request = GetCurrentRequest();
@@ -471,7 +470,7 @@
request->responses[process_id].os_dumps = std::move(os_dumps);
- if (outcome != mojom::MemoryDumpRequestOutcome::kSuccess) {
+ if (outcome != mojom::RequestOutcome::kSuccess) {
DLOG(ERROR) << "Memory dump request failed: NACK from client process";
request->outcome = outcome;
}
@@ -479,11 +478,10 @@
FinalizeGlobalMemoryDumpIfAllManagersReplied();
}
-void CoordinatorImpl::OnOSMemoryDumpForVMRegions(
- uint64_t dump_guid,
- base::ProcessId process_id,
- mojom::MemoryDumpRequestOutcome outcome,
- OSMemDumpMap os_dumps) {
+void CoordinatorImpl::OnOSMemoryDumpForVMRegions(uint64_t dump_guid,
+ base::ProcessId process_id,
+ mojom::RequestOutcome outcome,
+ OSMemDumpMap os_dumps) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
auto request_it = in_progress_vm_region_requests_.find(dump_guid);
CHECK(request_it != in_progress_vm_region_requests_.end());
```
```
The name of the file: content/browser/devtools/protocol/tracing_handler.h
Insertions: 1, Deletions: 1.
@@ -118,7 +118,7 @@
const std::set<std::string>& category_set);
void OnMemoryDumpFinished(
std::unique_ptr<RequestMemoryDumpCallback> callback,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
uint64_t dump_id);
void OnFrameFromVideoConsumer(scoped_refptr<media::VideoFrame> frame);
// Assuming that the input is a potentially incomplete string representation
```
```
The name of the file: services/resource_coordinator/memory_instrumentation/coordinator_impl.h
Insertions: 5, Deletions: 7.
@@ -84,10 +84,8 @@
private:
using OSMemDumpMap = base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr>;
- using RequestGlobalMemoryDumpInternalCallback =
- base::OnceCallback<void(mojom::MemoryDumpRequestOutcome,
- uint64_t,
- mojom::GlobalMemoryDumpPtr)>;
+ using RequestGlobalMemoryDumpInternalCallback = base::OnceCallback<
+ void(mojom::RequestOutcome, uint64_t, mojom::GlobalMemoryDumpPtr)>;
friend class CoordinatorImplTest; // For testing
FRIEND_TEST_ALL_PREFIXES(CoordinatorImplTest,
DumpsAreAddedToTraceWhenRequested);
@@ -115,20 +113,20 @@
// Callback of RequestChromeMemoryDump.
void OnChromeMemoryDumpResponse(
base::ProcessId process_id,
- mojom::MemoryDumpRequestOutcome outcome,
+ mojom::RequestOutcome outcome,
uint64_t dump_guid,
std::unique_ptr<base::trace_event::ProcessMemoryDump> chrome_memory_dump);
// Callback of RequestOSMemoryDump.
void OnOSMemoryDumpResponse(uint64_t dump_guid,
base::ProcessId process_id,
- mojom::MemoryDumpRequestOutcome outcome,
+ mojom::RequestOutcome outcome,
OSMemDumpMap);
// Callback of RequestOSMemoryDumpForVmRegions.
void OnOSMemoryDumpForVMRegions(uint64_t dump_guid,
base::ProcessId process_id,
- mojom::MemoryDumpRequestOutcome outcome,
+ mojom::RequestOutcome outcome,
OSMemDumpMap);
void FinalizeVmRegionDumpIfAllManagersReplied(uint64_t dump_guid);
```
```
The name of the file: services/resource_coordinator/memory_instrumentation/coordinator_impl_unittest.cc
Insertions: 80, Deletions: 91.
@@ -174,7 +174,7 @@
mad->AddScalar(MemoryAllocatorDump::kNameSize,
MemoryAllocatorDump::kUnitsBytes, 1024);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
args.dump_guid, std::move(pmd));
});
@@ -184,7 +184,7 @@
const std::vector<base::ProcessId> pids,
RequestOSMemoryDumpCallback& callback) {
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
}
@@ -221,10 +221,9 @@
class MockGlobalMemoryDumpCallback {
public:
MockGlobalMemoryDumpCallback() = default;
- MOCK_METHOD2(OnCall,
- void(mojom::MemoryDumpRequestOutcome, GlobalMemoryDump*));
+ MOCK_METHOD2(OnCall, void(mojom::RequestOutcome, GlobalMemoryDump*));
- void Run(mojom::MemoryDumpRequestOutcome outcome, GlobalMemoryDumpPtr ptr) {
+ void Run(mojom::RequestOutcome outcome, GlobalMemoryDumpPtr ptr) {
OnCall(outcome, ptr.get());
}
@@ -237,9 +236,9 @@
class MockGlobalMemoryDumpAndAppendToTraceCallback {
public:
MockGlobalMemoryDumpAndAppendToTraceCallback() = default;
- MOCK_METHOD2(OnCall, void(mojom::MemoryDumpRequestOutcome, uint64_t));
+ MOCK_METHOD2(OnCall, void(mojom::RequestOutcome, uint64_t));
- void Run(mojom::MemoryDumpRequestOutcome outcome, uint64_t dump_guid) {
+ void Run(mojom::RequestOutcome outcome, uint64_t dump_guid) {
OnCall(outcome, dump_guid);
}
@@ -292,8 +291,7 @@
// Tests that the global dump is acked even in absence of clients.
TEST_F(CoordinatorImplTest, NoClients) {
MockGlobalMemoryDumpCallback callback;
- EXPECT_CALL(callback,
- OnCall(mojom::MemoryDumpRequestOutcome::kSuccess, NotNull()));
+ EXPECT_CALL(callback, OnCall(mojom::RequestOutcome::kSuccess, NotNull()));
RequestGlobalMemoryDump(callback.Get());
}
@@ -309,8 +307,7 @@
EXPECT_CALL(client_process_2, RequestChromeMemoryDumpMock(_, _)).Times(1);
MockGlobalMemoryDumpCallback callback;
- EXPECT_CALL(callback,
- OnCall(mojom::MemoryDumpRequestOutcome::kSuccess, NotNull()))
+ EXPECT_CALL(callback, OnCall(mojom::RequestOutcome::kSuccess, NotNull()))
.WillOnce(RunOnceClosure(run_loop.QuitClosure()));
RequestGlobalMemoryDump(callback.Get());
run_loop.Run();
@@ -341,7 +338,7 @@
task_environment->FastForwardBy(base::Milliseconds(10));
MemoryDumpArgs dump_args{MemoryDumpLevelOfDetail::kDetailed};
auto pmd = std::make_unique<ProcessMemoryDump>(dump_args);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
args.dump_guid, std::move(pmd));
});
@@ -352,21 +349,19 @@
// increasing.
base::TimeTicks before = base::TimeTicks::Now();
base::TimeTicks first_dump_time;
- EXPECT_CALL(callback1,
- OnCall(mojom::MemoryDumpRequestOutcome::kSuccess, NotNull()))
- .WillOnce([&](mojom::MemoryDumpRequestOutcome outcome,
- GlobalMemoryDump* global_dump) {
- EXPECT_LE(before, global_dump->start_time);
- first_dump_time = global_dump->start_time;
- });
- EXPECT_CALL(callback2,
- OnCall(mojom::MemoryDumpRequestOutcome::kSuccess, NotNull()))
- .WillOnce([&](mojom::MemoryDumpRequestOutcome outcome,
- GlobalMemoryDump* global_dump) {
- EXPECT_LT(before, global_dump->start_time);
- EXPECT_LT(first_dump_time, global_dump->start_time);
- run_loop.Quit();
- });
+ EXPECT_CALL(callback1, OnCall(mojom::RequestOutcome::kSuccess, NotNull()))
+ .WillOnce(
+ [&](mojom::RequestOutcome outcome, GlobalMemoryDump* global_dump) {
+ EXPECT_LE(before, global_dump->start_time);
+ first_dump_time = global_dump->start_time;
+ });
+ EXPECT_CALL(callback2, OnCall(mojom::RequestOutcome::kSuccess, NotNull()))
+ .WillOnce(
+ [&](mojom::RequestOutcome outcome, GlobalMemoryDump* global_dump) {
+ EXPECT_LT(before, global_dump->start_time);
+ EXPECT_LT(first_dump_time, global_dump->start_time);
+ run_loop.Quit();
+ });
RequestGlobalMemoryDump(callback1.Get());
RequestGlobalMemoryDump(callback2.Get());
run_loop.Run();
@@ -384,13 +379,13 @@
MockClientProcess::RequestChromeMemoryDumpCallback& callback) {
MemoryDumpArgs dump_args{MemoryDumpLevelOfDetail::kDetailed};
auto pmd = std::make_unique<ProcessMemoryDump>(dump_args);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
args.dump_guid, std::move(pmd));
});
MockGlobalMemoryDumpCallback callback;
EXPECT_CALL(callback,
- OnCall(mojom::MemoryDumpRequestOutcome::kSuccess,
+ OnCall(mojom::RequestOutcome::kSuccess,
Pointee(Field(&mojom::GlobalMemoryDump::process_dumps,
IsEmpty()))))
.WillOnce(RunOnceClosure(run_loop.QuitClosure()));
@@ -410,13 +405,13 @@
const std::vector<base::ProcessId>& pids,
MockClientProcess::RequestOSMemoryDumpCallback& callback) {
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
MockGlobalMemoryDumpCallback callback;
EXPECT_CALL(callback,
- OnCall(mojom::MemoryDumpRequestOutcome::kSuccess,
+ OnCall(mojom::RequestOutcome::kSuccess,
Pointee(Field(&mojom::GlobalMemoryDump::process_dumps,
IsEmpty()))))
.WillOnce(RunOnceClosure(run_loop.QuitClosure()));
@@ -445,7 +440,7 @@
MockGlobalMemoryDumpCallback callback;
EXPECT_CALL(callback,
- OnCall(mojom::MemoryDumpRequestOutcome::kTimeout,
+ OnCall(mojom::RequestOutcome::kTimeout,
Pointee(Field(&mojom::GlobalMemoryDump::process_dumps,
IsEmpty()))))
.WillOnce(RunOnceClosure(run_loop.QuitClosure()));
@@ -483,7 +478,7 @@
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
results[kBrowserPid] = FillRawOSDump(kBrowserPid);
results[kRendererPid] = FillRawOSDump(kRendererPid);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
EXPECT_CALL(renderer_client, RequestOSMemoryDumpMock(_, _, _, _)).Times(0);
@@ -495,7 +490,7 @@
MockClientProcess::RequestOSMemoryDumpCallback& callback) {
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
results[0] = FillRawOSDump(kBrowserPid);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
EXPECT_CALL(renderer_client, RequestOSMemoryDumpMock(_, _, Contains(0), _))
@@ -505,7 +500,7 @@
MockClientProcess::RequestOSMemoryDumpCallback& callback) {
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
results[0] = FillRawOSDump(kRendererPid);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
@@ -521,8 +516,8 @@
});
MockGlobalMemoryDumpCallback callback;
- EXPECT_CALL(callback, OnCall(mojom::MemoryDumpRequestOutcome::kTimeout, _))
- .WillOnce([&run_loop](mojom::MemoryDumpRequestOutcome outcome,
+ EXPECT_CALL(callback, OnCall(mojom::RequestOutcome::kTimeout, _))
+ .WillOnce([&run_loop](mojom::RequestOutcome outcome,
GlobalMemoryDump* global_dump) {
EXPECT_EQ(1U, global_dump->process_dumps.size());
run_loop.Quit();
@@ -553,7 +548,7 @@
const MemoryDumpRequestArgs& args,
MockClientProcess::RequestChromeMemoryDumpCallback& callback) {
client_process_2.reset();
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
args.dump_guid, nullptr);
});
ON_CALL(*client_process_2, RequestChromeMemoryDumpMock(_, _))
@@ -562,14 +557,13 @@
const MemoryDumpRequestArgs& args,
MockClientProcess::RequestChromeMemoryDumpCallback& callback) {
client_process_1.reset();
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
args.dump_guid, nullptr);
});
MockGlobalMemoryDumpCallback callback;
- EXPECT_CALL(
- callback,
- OnCall(mojom::MemoryDumpRequestOutcome::kProcessUnregistered, NotNull()))
+ EXPECT_CALL(callback,
+ OnCall(mojom::RequestOutcome::kProcessUnregistered, NotNull()))
.WillOnce(RunOnceClosure(run_loop.QuitClosure()));
RequestGlobalMemoryDump(callback.Get());
run_loop.Run();
@@ -591,14 +585,13 @@
// The dtor here will cause mojo to post an UnregisterClient call to
// the coordinator.
client_process.reset();
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
args.dump_guid, nullptr);
});
MockGlobalMemoryDumpCallback callback;
- EXPECT_CALL(
- callback,
- OnCall(mojom::MemoryDumpRequestOutcome::kProcessUnregistered, NotNull()))
+ EXPECT_CALL(callback,
+ OnCall(mojom::RequestOutcome::kProcessUnregistered, NotNull()))
.WillOnce(RunOnceClosure(run_loop.QuitClosure()));
RequestGlobalMemoryDump(callback.Get());
run_loop.Run();
@@ -648,8 +641,8 @@
pmd->CreateAllocatorDump("partition_alloc/partitions/not_ignored_2")
->AddScalar(size, bytes, 2 * kB);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
- args.dump_guid, std::move(pmd));
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess, args.dump_guid,
+ std::move(pmd));
});
EXPECT_CALL(renderer_client, RequestChromeMemoryDumpMock(_, _))
.WillOnce(
@@ -661,7 +654,7 @@
"malloc", base::trace_event::MemoryAllocatorDumpGuid(2));
mad->AddScalar(MemoryAllocatorDump::kNameSize,
MemoryAllocatorDump::kUnitsBytes, 1024 * 2);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
args.dump_guid, std::move(pmd));
});
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
@@ -680,7 +673,7 @@
results[2]->platform_private_footprint =
mojom::PlatformPrivateFootprint::New();
results[2]->resident_set_kb = 2;
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
EXPECT_CALL(renderer_client, RequestOSMemoryDumpMock(_, _, _, _)).Times(0);
@@ -695,7 +688,7 @@
results[0]->platform_private_footprint =
mojom::PlatformPrivateFootprint::New();
results[0]->resident_set_kb = 1;
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
EXPECT_CALL(renderer_client, RequestOSMemoryDumpMock(_, _, Contains(0), _))
@@ -708,15 +701,14 @@
results[0]->platform_private_footprint =
mojom::PlatformPrivateFootprint::New();
results[0]->resident_set_kb = 2;
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
MockGlobalMemoryDumpCallback callback;
- EXPECT_CALL(callback,
- OnCall(mojom::MemoryDumpRequestOutcome::kSuccess, NotNull()))
- .WillOnce([&run_loop](mojom::MemoryDumpRequestOutcome outcome,
+ EXPECT_CALL(callback, OnCall(mojom::RequestOutcome::kSuccess, NotNull()))
+ .WillOnce([&run_loop](mojom::RequestOutcome outcome,
GlobalMemoryDump* global_dump) {
EXPECT_EQ(2U, global_dump->process_dumps.size());
mojom::ProcessMemoryDumpPtr browser_dump = nullptr;
@@ -767,7 +759,7 @@
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
results[kBrowserPid] = FillRawOSDump(kBrowserPid);
results[kRendererPid] = FillRawOSDump(kRendererPid);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
EXPECT_CALL(renderer_client, RequestOSMemoryDumpMock(_, _, _, _)).Times(0);
@@ -779,7 +771,7 @@
MockClientProcess::RequestOSMemoryDumpCallback& callback) {
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
results[0] = FillRawOSDump(kBrowserPid);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
EXPECT_CALL(renderer_client, RequestOSMemoryDumpMock(_, _, Contains(0), _))
@@ -789,7 +781,7 @@
MockClientProcess::RequestOSMemoryDumpCallback& callback) {
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
results[0] = FillRawOSDump(kRendererPid);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
@@ -849,13 +841,13 @@
MockClientProcess::RequestChromeMemoryDumpCallback& callback) {
MemoryDumpArgs dump_args{MemoryDumpLevelOfDetail::kDetailed};
auto pmd = std::make_unique<ProcessMemoryDump>(dump_args);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
args.dump_guid, std::move(pmd));
});
MockGlobalMemoryDumpCallback callback;
EXPECT_CALL(callback,
- OnCall(mojom::MemoryDumpRequestOutcome::kSuccess,
+ OnCall(mojom::RequestOutcome::kSuccess,
Pointee(Field(&mojom::GlobalMemoryDump::process_dumps,
IsEmpty()))))
.WillOnce(RunOnceClosure(run_loop.QuitClosure()));
@@ -891,13 +883,12 @@
MockClientProcess::RequestChromeMemoryDumpCallback& callback) {
MemoryDumpArgs dump_args{MemoryDumpLevelOfDetail::kDetailed};
auto pmd = std::make_unique<ProcessMemoryDump>(dump_args);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
args.dump_guid, std::move(pmd));
});
MockGlobalMemoryDumpAndAppendToTraceCallback callback;
- EXPECT_CALL(callback,
- OnCall(mojom::MemoryDumpRequestOutcome::kSuccess, Ne(0ul)))
+ EXPECT_CALL(callback, OnCall(mojom::RequestOutcome::kSuccess, Ne(0ul)))
.WillOnce(RunOnceClosure(run_loop.QuitClosure()));
base::trace_event::TraceConfig trace_config(
@@ -937,7 +928,7 @@
MockClientProcess::RequestOSMemoryDumpCallback& callback) {
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
results[kBrowserPid] = FillRawOSDump(kBrowserPid);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
})
.WillOnce([](mojom::MemoryMapOption,
@@ -946,7 +937,7 @@
MockClientProcess::RequestOSMemoryDumpCallback& callback) {
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
results[kRendererPid] = FillRawOSDump(kRendererPid);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
})
.WillOnce([](mojom::MemoryMapOption,
@@ -955,7 +946,7 @@
MockClientProcess::RequestOSMemoryDumpCallback& callback) {
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
results[kGpuPid] = FillRawOSDump(kGpuPid);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
#else
@@ -966,7 +957,7 @@
MockClientProcess::RequestOSMemoryDumpCallback& callback) {
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
results[0] = FillRawOSDump(kBrowserPid);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
EXPECT_CALL(client_process_2, RequestOSMemoryDumpMock(_, _, Contains(0), _))
@@ -976,7 +967,7 @@
MockClientProcess::RequestOSMemoryDumpCallback& callback) {
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
results[0] = FillRawOSDump(kRendererPid);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
EXPECT_CALL(client_process_3, RequestOSMemoryDumpMock(_, _, Contains(0), _))
@@ -986,7 +977,7 @@
MockClientProcess::RequestOSMemoryDumpCallback& callback) {
base::flat_map<base::ProcessId, mojom::RawOSMemDumpPtr> results;
results[0] = FillRawOSDump(kGpuPid);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
@@ -994,19 +985,18 @@
base::RunLoop run_loop;
MockGlobalMemoryDumpCallback callback;
- EXPECT_CALL(callback,
- OnCall(mojom::MemoryDumpRequestOutcome::kSuccess, Ne(nullptr)))
- .WillOnce([](mojom::MemoryDumpRequestOutcome outcome,
- GlobalMemoryDump* global_dump) {
- EXPECT_EQ(1U, global_dump->process_dumps.size());
- EXPECT_EQ(global_dump->process_dumps[0]->pid, kBrowserPid);
- })
- .WillOnce([](mojom::MemoryDumpRequestOutcome outcome,
- GlobalMemoryDump* global_dump) {
- EXPECT_EQ(1U, global_dump->process_dumps.size());
- EXPECT_EQ(global_dump->process_dumps[0]->pid, kRendererPid);
- })
- .WillOnce([&run_loop](mojom::MemoryDumpRequestOutcome outcome,
+ EXPECT_CALL(callback, OnCall(mojom::RequestOutcome::kSuccess, Ne(nullptr)))
+ .WillOnce(
+ [](mojom::RequestOutcome outcome, GlobalMemoryDump* global_dump) {
+ EXPECT_EQ(1U, global_dump->process_dumps.size());
+ EXPECT_EQ(global_dump->process_dumps[0]->pid, kBrowserPid);
+ })
+ .WillOnce(
+ [](mojom::RequestOutcome outcome, GlobalMemoryDump* global_dump) {
+ EXPECT_EQ(1U, global_dump->process_dumps.size());
+ EXPECT_EQ(global_dump->process_dumps[0]->pid, kRendererPid);
+ })
+ .WillOnce([&run_loop](mojom::RequestOutcome outcome,
GlobalMemoryDump* global_dump) {
EXPECT_EQ(1U, global_dump->process_dumps.size());
EXPECT_EQ(global_dump->process_dumps[0]->pid, kGpuPid);
@@ -1026,9 +1016,8 @@
base::RunLoop run_loop;
MockGlobalMemoryDumpCallback callback;
- EXPECT_CALL(
- callback,
- OnCall(mojom::MemoryDumpRequestOutcome::kProcessNotFound, nullptr))
+ EXPECT_CALL(callback,
+ OnCall(mojom::RequestOutcome::kProcessNotFound, nullptr))
.WillOnce(RunOnceClosure(run_loop.QuitClosure()));
RequestGlobalMemoryDumpForPid(2, {}, callback.Get());
@@ -1072,7 +1061,7 @@
pmd->CreateAllocatorDump("partition_alloc/partitions/2")
->AddScalar(size, bytes, 2 * kB);
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
args.dump_guid, std::move(pmd));
});
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
@@ -1086,7 +1075,7 @@
results[1]->resident_set_kb = 1;
results[1]->platform_private_footprint =
mojom::PlatformPrivateFootprint::New();
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
#else
@@ -1100,12 +1089,12 @@
results[0]->platform_private_footprint =
mojom::PlatformPrivateFootprint::New();
results[0]->resident_set_kb = 1;
- std::move(callback).Run(mojom::MemoryDumpRequestOutcome::kSuccess,
+ std::move(callback).Run(mojom::RequestOutcome::kSuccess,
std::move(results));
});
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
- base::test::TestFuture<mojom::MemoryDumpRequestOutcome,
+ base::test::TestFuture<mojom::RequestOutcome,
memory_instrumentation::mojom::GlobalMemoryDumpPtr>
result;
RequestGlobalMemoryDump(MemoryDumpType::kSummaryOnly,
@@ -1114,8 +1103,8 @@
result.GetCallback());
// Expect that the dump request succeeds.
- ASSERT_EQ(mojom::MemoryDumpRequestOutcome::kSuccess,
- std::get<mojom::MemoryDumpRequestOutcome>(result.Get()));
+ ASSERT_EQ(mojom::RequestOutcome::kSuccess,
+ std::get<mojom::RequestOutcome>(result.Get()));
// Verify that the dump has a single "partition_alloc" top-level node, and
// that the top level dump has children.
```
```
The name of the file: chrome/browser/metrics/process_memory_metrics_emitter_unittest.cc
Insertions: 14, Deletions: 14.
@@ -720,7 +720,7 @@
base::MakeRefCounted<ProcessMemoryMetricsEmitterFake>(test_ukm_recorder_);
emitter->ReceivedMemoryDump(
emitter->GetProcessToPageInfoMap(graph()),
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
+ memory_instrumentation::mojom::RequestOutcome::kSuccess,
GlobalMemoryDump::MoveFrom(std::move(global_dump)));
std::vector<MetricMap> expected_entries;
@@ -759,7 +759,7 @@
base::MakeRefCounted<ProcessMemoryMetricsEmitterFake>(test_ukm_recorder_);
emitter->ReceivedMemoryDump(
emitter->GetProcessToPageInfoMap(graph()),
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
+ memory_instrumentation::mojom::RequestOutcome::kSuccess,
GlobalMemoryDump::MoveFrom(std::move(global_dump)));
std::vector<MetricMap> expected_entries;
@@ -796,7 +796,7 @@
base::MakeRefCounted<ProcessMemoryMetricsEmitterFake>(test_ukm_recorder_);
emitter->ReceivedMemoryDump(
emitter->GetProcessToPageInfoMap(graph()),
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
+ memory_instrumentation::mojom::RequestOutcome::kSuccess,
GlobalMemoryDump::MoveFrom(std::move(global_dump)));
CheckMemoryUkmEntryMetrics(entries_metrics);
@@ -828,7 +828,7 @@
}
emitter->ReceivedMemoryDump(
emitter->GetProcessToPageInfoMap(graph()),
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
+ memory_instrumentation::mojom::RequestOutcome::kSuccess,
GlobalMemoryDump::MoveFrom(std::move(global_dump)));
}
@@ -848,7 +848,7 @@
base::MakeRefCounted<ProcessMemoryMetricsEmitterFake>(test_ukm_recorder_);
emitter->ReceivedMemoryDump(
emitter->GetProcessToPageInfoMap(graph()),
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kTimeout,
+ memory_instrumentation::mojom::RequestOutcome::kTimeout,
GlobalMemoryDump::MoveFrom(std::move(global_dump)));
// Should not record any metrics since the memory dump failed, and don't
@@ -871,7 +871,7 @@
base::MakeRefCounted<ProcessMemoryMetricsEmitterFake>(test_ukm_recorder_);
emitter->ReceivedMemoryDump(
emitter->GetProcessToPageInfoMap(graph()),
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
+ memory_instrumentation::mojom::RequestOutcome::kSuccess,
GlobalMemoryDump::MoveFrom(std::move(global_dump)));
auto entries = test_ukm_recorder_.GetEntriesByName(UkmEntry::kEntryName);
@@ -926,7 +926,7 @@
kTestRendererPid201, test_ukm_recorder_);
emitter->ReceivedMemoryDump(
emitter->GetProcessToPageInfoMap(graph()),
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
+ memory_instrumentation::mojom::RequestOutcome::kSuccess,
GlobalMemoryDump::MoveFrom(std::move(global_dump)));
auto entries = test_ukm_recorder_.GetEntriesByName(UkmEntry::kEntryName);
@@ -962,7 +962,7 @@
kTestRendererPid202, test_ukm_recorder_);
emitter->ReceivedMemoryDump(
emitter->GetProcessToPageInfoMap(graph()),
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
+ memory_instrumentation::mojom::RequestOutcome::kSuccess,
GlobalMemoryDump::MoveFrom(std::move(global_dump)));
// Check that if there are two URLs, neither is emitted.
@@ -997,7 +997,7 @@
kTestRendererPid203, test_ukm_recorder_);
emitter->ReceivedMemoryDump(
emitter->GetProcessToPageInfoMap(graph()),
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
+ memory_instrumentation::mojom::RequestOutcome::kSuccess,
GlobalMemoryDump::MoveFrom(std::move(global_dump)));
auto entries = test_ukm_recorder_.GetEntriesByName(UkmEntry::kEntryName);
@@ -1091,7 +1091,7 @@
base::MakeRefCounted<ProcessMemoryMetricsEmitterFake>(test_ukm_recorder_);
emitter->ReceivedMemoryDump(
emitter->GetProcessToPageInfoMap(graph()),
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
+ memory_instrumentation::mojom::RequestOutcome::kSuccess,
GlobalMemoryDump::MoveFrom(std::move(global_dump)));
// Check that the expected values have been emitted to histograms.
@@ -1179,7 +1179,7 @@
kTestRendererPid201, test_ukm_recorder_);
emitter->ReceivedMemoryDump(
emitter->GetProcessToPageInfoMap(graph()),
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
+ memory_instrumentation::mojom::RequestOutcome::kSuccess,
GlobalMemoryDump::MoveFrom(std::move(global_dump)));
// Histograms should only be emitted when measuring all processes.
@@ -1204,7 +1204,7 @@
base::MakeRefCounted<ProcessMemoryMetricsEmitterFake>(test_ukm_recorder_);
emitter->ReceivedMemoryDump(
emitter->GetProcessToPageInfoMap(graph()),
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
+ memory_instrumentation::mojom::RequestOutcome::kSuccess,
GlobalMemoryDump::MoveFrom(std::move(global_dump)));
// Check that the expected values have been emitted to histograms.
@@ -1232,7 +1232,7 @@
base::MakeRefCounted<ProcessMemoryMetricsEmitterFake>(test_ukm_recorder_);
emitter->ReceivedMemoryDump(
emitter->GetProcessToPageInfoMap(graph()),
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
+ memory_instrumentation::mojom::RequestOutcome::kSuccess,
GlobalMemoryDump::MoveFrom(std::move(global_dump)));
entries = test_ukm_recorder_.GetEntriesByName(
@@ -1261,7 +1261,7 @@
kTestRendererPid201, test_ukm_recorder_);
emitter->ReceivedMemoryDump(
emitter->GetProcessToPageInfoMap(graph()),
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
+ memory_instrumentation::mojom::RequestOutcome::kSuccess,
GlobalMemoryDump::MoveFrom(std::move(global_dump)));
// Per-tab UKM's should only be emitted when measuring all processes.
```
```
The name of the file: components/no_state_prefetch/browser/no_state_prefetch_contents.cc
Insertions: 2, Deletions: 3.
@@ -571,10 +571,9 @@
}
void NoStatePrefetchContents::DidGetMemoryUsage(
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
std::unique_ptr<memory_instrumentation::GlobalMemoryDump> global_dump) {
- if (outcome !=
- memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess) {
+ if (outcome != memory_instrumentation::mojom::RequestOutcome::kSuccess) {
return;
}
```
```
The name of the file: chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc
Insertions: 4, Deletions: 6.
@@ -95,12 +95,11 @@
void RequestGlobalDumpCallback(
base::OnceClosure quit_closure,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
uint64_t) {
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
FROM_HERE, std::move(quit_closure));
- ASSERT_EQ(memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
- outcome);
+ ASSERT_EQ(memory_instrumentation::mojom::RequestOutcome::kSuccess, outcome);
}
void OnStartTracingDoneCallback(
@@ -129,10 +128,9 @@
void ReceivedMemoryDump(
absl::flat_hash_map<base::ProcessId, ProcessInfo> process_infos,
- memory_instrumentation::mojom::MemoryDumpRequestOutcome outcome,
+ memory_instrumentation::mojom::RequestOutcome outcome,
std::unique_ptr<GlobalMemoryDump> ptr) override {
- EXPECT_EQ(memory_instrumentation::mojom::MemoryDumpRequestOutcome::kSuccess,
- outcome);
+ EXPECT_EQ(memory_instrumentation::mojom::RequestOutcome::kSuccess, outcome);
ProcessMemoryMetricsEmitter::ReceivedMemoryDump(std::move(process_infos),
outcome, std::move(ptr));
std::move(quit_closure_).Run();
```
```
The name of the file: chrome/browser/memory_details.h
Insertions: 1, Deletions: 2.
@@ -164,8 +164,7 @@
// `outcome` is the outcome of requesting the memory dump, or nullopt if the
// memory instrumentation service is not available.
void DidReceiveMemoryDump(
- std::optional<memory_instrumentation::mojom::MemoryDumpRequestOutcome>
- outcome,
+ std::optional<memory_instrumentation::mojom::RequestOutcome> outcome,
std::unique_ptr<memory_instrumentation::GlobalMemoryDump> dump);
std::vector<ProcessData> process_data_;
```
[memory] Replace bool success with MemoryDumpRequestOutcome enum.
The Memory.MemoryDumpSuccess histogram shows that global memory dumps
fail ~1% of the time. To diagnose these failures, this CL replaces
boolean "success" flags in the memory instrumentation API with a
`MemoryDumpRequestOutcome` enum, which provides detailed failure
reasons.
This new outcome is reported to the `Memory.MemoryDumpOutcome`
histogram, replacing the old boolean metric.
Also:
The callback for
base::trace_event::MemoryDumpManager::CreateProcessDump() is
updated to receive an enum "outcome" instead of a boolean. Since an
in-process dump cannot currently fail, the new outcome enum only
contains a `kSuccess` value. In the future, we could remove this enum
argument completely, but we keep in for now in case our ongoing
investigations reveal failure modes that would be relevant to report to
the caller.
The `failed_memory_dump_count` member in
memory_instrumentation::QueuedRequest is replaced with an `outcome`
member. The count wasn't used before (only whether it was zero or
non-zero mattered). Now, `outcome` is `kSuccess` in situations where
the count was zero before, and provides more details about what went
wrong in situations where the count was non-zero before.
Use base::test::TestFuture to simplify tests that had to be modified
to support the new enum introduced in this CL.
OBSOLETE_HISTOGRAM[Memory.MemoryDumpSuccess]=Replaced with the more detailed Memory.MemoryDumpOutcome.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |