
There is currently a memory leak with these file request objects due to the callback on_file_request_finish referencing itself in its capture list. This object does not need to be reference counted or allocated on the heap. It is only ever stored in a HashMap until a response is received from the browser, and it is not shared.
27 lines
488 B
C++
27 lines
488 B
C++
/*
|
|
* Copyright (c) 2022, Lucas Chollet <lucas.chollet@free.fr>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/DeprecatedString.h>
|
|
#include <AK/Error.h>
|
|
#include <AK/Function.h>
|
|
|
|
namespace Web {
|
|
|
|
class FileRequest {
|
|
public:
|
|
FileRequest(DeprecatedString path, Function<void(ErrorOr<i32>)> on_file_request_finish);
|
|
|
|
DeprecatedString path() const;
|
|
|
|
Function<void(ErrorOr<i32>)> on_file_request_finish;
|
|
|
|
private:
|
|
DeprecatedString m_path {};
|
|
};
|
|
|
|
}
|