mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1739500 - Modernize lambda that adds a screenshot marker - r=canaltinova
While working on this screenshot marker, I noticed that the lambda initialization could directly copy or move its needed captures, instead of going through separate copies on the stack, which was probably done before C++14 lambda were available to us. Differential Revision: https://phabricator.services.mozilla.com/D130436
This commit is contained in:
parent
9784494cbd
commit
27166e1256
@ -82,18 +82,13 @@ void ProfilerScreenshots::SubmitScreenshot(
|
||||
return;
|
||||
}
|
||||
|
||||
ProfilerThreadId sourceThread = profiler_current_thread_id();
|
||||
uint32_t windowIdentifier = mWindowIdentifier;
|
||||
IntSize originalSize = aOriginalSize;
|
||||
IntSize scaledSize = aScaledSize;
|
||||
TimeStamp timeStamp = aTimeStamp;
|
||||
|
||||
RefPtr<ProfilerScreenshots> self = this;
|
||||
|
||||
NS_DispatchBackgroundTask(NS_NewRunnableFunction(
|
||||
"ProfilerScreenshots::SubmitScreenshot",
|
||||
[self{std::move(self)}, backingSurface, sourceThread, windowIdentifier,
|
||||
originalSize, scaledSize, timeStamp]() {
|
||||
[self = RefPtr<ProfilerScreenshots>{this},
|
||||
backingSurface = std::move(backingSurface),
|
||||
sourceThread = profiler_current_thread_id(),
|
||||
windowIdentifier = mWindowIdentifier, originalSize = aOriginalSize,
|
||||
scaledSize = aScaledSize, timeStamp = aTimeStamp]() {
|
||||
// Create a new surface that wraps backingSurface's data but has the
|
||||
// correct size.
|
||||
if (profiler_thread_is_being_profiled(sourceThread)) {
|
||||
|
Loading…
Reference in New Issue
Block a user